Login / Signup

Installing Debian (ARM) on QEMU

  • user warning: Table './devemc/sessions' is marked as crashed and last (automatic?) repair failed query: SELECT COUNT(sid) AS count FROM sessions WHERE timestamp >= 1422801357 AND uid = 0 in /home/devemc/public_html/dev/includes/session.inc on line 157.
  • user warning: Table './devemc/sessions' is marked as crashed and last (automatic?) repair failed query: SELECT COUNT(DISTINCT s.uid) FROM sessions s WHERE s.timestamp >= 1422801357 AND s.uid > 0 in /home/devemc/public_html/dev/modules/user/user.module on line 790.
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


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-versati...

$ wget http://people.debian.org/~aurel32/arm-versatile/initrd.img-2.6.18-6-vers...

$ 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

Debian Reboot

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

cpuinfoThis 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.

dmesg report 

Installing Software Packages
gcc infoI 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.

mplayerI 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


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.




Running Skyeye on Ubuntu
Embedded Linux

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.

Who's online

There are currently users and guests online.

Recent comments