Installing Debian (ARM) on QEMU
Full Linux for the Embedded Systems
In most cases, the embedded systems are tailor-made for specific application environment. Only the necessary software components are installed due to limited budget on storage and computing capabilities. Usually a full Linux is not necessary for either consumers or developers.
The embedded Linux is a complicated process for the designers and developers. The conventional development method is starting from scratch (LFS). They have to collect, build and install all of the necessary development tools on a PC with correct patches and libraries. These tools include cross-compiler, assembler, libraries, kernels, bootloader, and many supporting components for Linux or Cygwin. Finally, they must program the kernel and initrd into the onboard flash memories and configure the bootloader correctly to bring up the whole system. The whole process is so complicated, that I still have a lot of stuff to be mentioned.
On the other hand, the embedded Linux is an open source close system for the ordinary consumer. Why do I call it as open source yet close system? Linux is open source system, as everybody knows. However the specific release for one platform is close system anyway. For example, Motorola A1200 mobile phone is a Linux phone, but can you hack your phone as a consumer? No, you can not find the alternative OS to replace the preinstalled one.
As the fast development and convergence of general purpose mobile computing, we can see a lot of new products. These products usually have powerful processors and cheap mass storage devices. For example, a smart phone has 200MHz ARM CPU and 2GB flash card, which can run a full distribution of Linux. ARM also releases SMP and high speed processors for the Netbook market. Apparently, ARM and Intel architecture are competing on mobile computing market.
As a result, it will be a trend and valuable practice to install a full Linux distribution for ARM devices. Both consumers and developers can benefit from it. The consumers can choose different operation systems for their devices. The engineers can build the projects with native compiler, rather than the cross-compiler. Since most of the projects are not designed for cross-compiling at very beginning, porting these projects to the embedded platforms is not an easy job. The native compiling can avoid such dependency and tool issues.
So I spent some day on trying to install Debian distribution for ARM. Before installation an embedded Linux on real hardware devices, it is better to try it with an emulator to avoid bricking the devices. I refer a web page written by a Debian maintainer to install the Debian on an emulator, QEMU.
Installing QEMU
Download and install QEMU on your Linux PC. In Ubuntu 8.04, you can install QEMU by:
$ sudo apt-get install qemu
Preparing
Before downloading all of the working files, please create a working folder to hold all of the files and then, create an image of the emulated hard disk, by:
$ cd qemu (or any folder)
$ qemu-img create -f qcow hda.img 10G
Then you can download a kernel, initrd and the Debian installer. Please type following instructions to download them individually.
$ wget http://people.debian.org/~aurel32/arm-versatile/vmlinuz-2.6.18-6-versatile
$ wget http://people.debian.org/~aurel32/arm-versatile/initrd.img-2.6.18-6-versatile
$ wget http://ftp.de.debian.org/debian/dists/etch/main/installer-arm/current/images/rpc/netboot/initrd.gz
Installing Debian Etch and Reboot
Please enter following command to start the installation procedure:
$ qemu-system-arm -M versatilepb -kernel vmlinuz-2.6.18-6-versatile -initrd initrd.gz -hda hda.img -append "root=/dev/ram"
The installation starts after a while. Please follow the instruction step by step, just like you did on your desktop. You can skip the warning messages about no kernels and bootloader, and then you will see the final reboot screen. During your installation, it is very important to select a fast and reliable internet connection to the selected Debian archive source. If the installation is failed because of the connection, you can close the installer and restart the installation. Alternatively, you can recreate hda.img file and restart the installation.
Using Embedded Debian

When you see the reboot screen, close the QEMU window, and enter following command to boot the Debian Linux:
$ qemu-system-arm -M versatilepb -kernel vmlinuz-2.6.18-6-versatile -initrd initrd.img-2.6.18-6-versatile -hda hda.img -append "root=/dev/sda1"
When Debian reboots, you can explore it in the command line mode or in 256 color X-Window mode. You can have fun now. I have tried to measure the performance of the emulated system by:
$ cat proc/cpuinfo
This command reports the major parameters of the emulated machine. The bogoMIPS of my emulated ARM926EJ is 273, while my native Linux PC (Pentium M 1.4GHz) is 2793, 10 times of the emulated machine. A beagle board user reports its OMAP3530 (600MHz) has bogoMIPS index for 499. The emulated system can run faster than the real device if you run it on a high speed PC.
You can type dmesg to have more detail information for your emualted ARM system. Check out the dmesg report.
Installing Software Packages
I have checked two software packages: gcc [Fig 4] and mplayer [Fig 5]. In Debian, you can install gcc with following command:
$ apt-get install gcc
You can type following command to check the supported target machine:
$ gcc -dumpmachine
The answer is “arm-linux-gnu”. That means an ARM native compiler. You can try to compile any Linux application software with this native compiler. Of course, a native compiler running on QEMU is slow, but you can install distributed build tool distcc to build a big project on several emulated ARM Linux.
I also install the mplayer package, but I don't expect that it have identical performance as its desktop version. The mplayer package uses many commercial decoders (like Real video decoder) in the form of Windows DLL, which can not be directly used in ARM port.
$ apt-get install mplayer
Conclusion
The whole installation process is quite simple if you have setup the connection properly. The developers who are working on embedded systems should explore the capabilities of this method. It may help you solve some technical roadblocks in your project.
If you want to install Debian (ARM) on a real hardware computer, you have many candidates: Sharp PDA, some handheld PC, Openmoko, beagle-board, and NOKIA tablet. If you want to build some project, the Marvell based NAS is the best choice. The ARM SoC in a NAS usually runs on 500MHz, and you can use the HDD on NAS.
If you are interested in this topic, you must visit the mojo project. You can find much useful information on the ARM based Linux distributions of different platforms. Remember, even there chips have a common name, ARM. They are still different in instruction sets, peripherals and co-processors.
Reference
http://www.aurel32.net/info/debian_arm_qemu.php.en
http://mojo.handhelds.org/
- allankliu's blog
- 13824 reads





Nice article! Going to try
Nice article! Going to try it myself and see how good it works :-)
How *well* it works. Good is
How *well* it works. Good is an adjective, well is an adverb.
Hey; interesting read, great
Hey; interesting read, great job.
I'd hate to be "that guy", but some of the awkward phrasing was a little distracting though...I.E. saying "The embedded Linux" instead of "Embedded Linux" and "close system" instead of "CLOSED system".
This seems indicative of either a failure to proof-read or English as a second language. The former is irritating, but the latter is forgivable.
Possible to install on MyBook?
MyBook network storage station seems to support Debian. I am wondering how you can actually install Lenny on this device?
The guide here (http://www.ismprofessional.net/pascucci/documenti/mybook/mybook-hacking-en.html) uses an much older version of Debian, and I am not sure if doing a dist-upgrade is safe.
Any idea how to inject Lenny into that device?
Some updates on Debian
Problem setting up wireless on Debian 5
How to extract pycaptcha-0.4
Some good updates:
http://www.techunits.com/content/list_all/18/debian
I keep getting SCSI errors
I keep getting SCSI errors when Debian tries to format the drive.
lsi_scsi: error: Unimplemented message 0x0c
lsi_scsi: error: Unimplemented message 0x0d
lsi_scsi: error: Reselect with pending DMA
lsi_scsi: error: Reselect with pending DMA
On the other hand, the
On the other hand, the embedded Linux is an open source close system for the ordinary consumer. Why do I call it as open source yet close system?
You run into this contradiction because you avoid using the word "freedom" (or "free", as in "free software"). Both concepts mean different things. For example Linux (the kernel) is open source, or at least most of it, but it's not always free software. When used in a locked device, the freedom to modify it has been put away.
Getting error selecting repositary
Hello, thanks for sharing the article.
I got error trying to get a working repositary, i tried many site, but all shows error that failed to download a file and let me
retry or change mirror.
I am doing the work under debian in virtualbox using bridge network connection, and after failure i tried to test my connection with wget in the shell that setup program provided. The connection seems to work.
Any suggestions? Any reply will be welcomed.
Me too
I'm getting the same results... does not matter what mirror I choose. I have verified that network is working, I tested wget with other sites. What is the installer doing under the hood? Is it looking for something that's specific to the versatile pb?
Same result
Hello,
I got the same result. I even thought that the problem relies on network settings of qemu, since it doesn't have a bridge connection by default (At least, in my case). By the way, there is a debian-arm installer at Debian official site, I tried to boot it in qemu, but it did not work either, with the error of no bootable device. Have any idea?
Regards
gpgv
I had some problem...
problem seems to be in gpg verify.
I just skipped gpg verify:
when installation start switch to tty2 (alt+f2)
then press enter and type "mv /usr/bin/gpgv /usr/bin/gpgvb"
then switch back to tty1 (alt+f1) and continue with installation
!! REMEMBER THAT SKIPPING GPG VERIFY IS UNSECURE !!
(you can be victim of man-in-middle attack)
Thanks. This fixed the
Thanks. This fixed the problem.
mirrors don't work
gets to install the packages and I get mirror errors whatever I choose as a mirror. I've tried various ways to fix but with no luck
I have the same mirror
I have the same mirror problem. They don`t work.
Answers for some questions
It is just a blog of recording what I have done on QEMU to evaluate Debian for ARM. It is safe to run QEMU since it doesn't damage any hardware. I saw many feedbacks for language, license, technical questions. I will try to answer some questions hereafter.
1) Language issue. Yes, English is not my native language, even my editor usually complains about it. And I am a Chinese engineer has experiences in semiconductors and software. I will try my best to improve it.
2) MyBook NAS, it is better to find a dedicated collections for specified model. Since the Linux is not everything of embedded system. You'd better collect the whole package (bootloader and others). There are many hacking tutorials and firmware releases. Try to locate the resources before you jump in.
3) Repository. These pictures are the screen snap from my Linux PC. The repository works in my PC. If you still have the questions. I suggest you can try to install Ubuntu (ARM), rather than Debian (ARM).
Recently Ubuntu is quite active in embedded market, many devices were released on Ubuntu. You can google "smart Q5 Q7" or "smartbook". You can buy an Ubuntu enabled MID/SmartBook online (from China). These devices have 500MHz ARM11, supports Ubuntu Linux and Windows CE. You can find some hacking courses online to tell you how to deal with these smart devices. It was designed for you hackers.
Post new comment