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