Getting this task done took a lot of effort. I briefly describe how I got my system going below. Check out the references if you wish to build your own. Before we get started, we need to know which drives are present on which bus.
IDE-0 Master: Hard Disk
IDE-0 Slave : -
IDE-1 Master: CompactFlash
IDE-1 Slave : CDROM
On a linux system, this means that the hard drive is /dev/hda
and the
CompactFlash is /dev/hdc. The flash memory can be used as an
IDE drive
because it implements the IDE command set on chip. So, a CompactFlash
chip is smart where as the SmartMedia memory is dumb! In order to build a working system, you need the following packages -
tar xvzf linux-2.4.20.tar.gzThe sources come with programs to help you configure kernel parameters. So, do the following -
cd /usr/src/linux-2.4.20/This starts up a GUI application with various buttons. You can select the features you want enabled or disabled. For the sake of simplicity, I compiled all drivers needed by my hardware into the kernel as opposed to compiling them as modules. Disabling all unnecessary support helps speedup the boot process. For instance, if you don't have a scsi drive, there is no point in compiling those drivers. My linux setup required me to select the following options (there are other selection too, but there were the ones that I abosultely needed to bootup) -
make xconfig
make depIf the build is successful, the kernel image is put in the /usr/src/linux-2.4.20/arch/i386/boot directory.
make bzImage
Busybox provides us with the 'init' program which is run when the kernel starts up. Along with this, it also provides various other utilities such as ls, mount, ifconfig, df, swapon, swapoff etc. A complete list can be found at http://www.busybox.net. Download the source and unpack in any directory. Edit Configure.h to enable or disable the programs you want to keep. Remember that we want to build a minimal system, so only the utilities that are absolutely essential should be compiled in order to keep the size down. Here is a quick breakdown of the tasks:
drwxr-xr-x 2 root root 1024 Dec 6 17:13 boot drwxr-xr-x 2 root root 1024 Dec 5 19:02 dev drwxr-xr-x 2 root root 1024 Dec 7 06:16 etc drwxr-xr-x 2 root root 1024 Dec 4 17:13 proc drwxr-xr-x 2 root root 1024 Dec 6 17:13 tmp drwxr-xr-x 2 root root 1024 Dec 6 18:27 varCopy the kernel image that was build earlier to the boot directory. Be careful here and copy to /mnt/boot and not to /boot. Also copy the boot.b from /boot to /mnt/boot.
Populate the dev directory by copying nodes from your development system.
Switch to /mnt/etc directory. We need to create an inittab file. The 'init' program uses this file to figure out what to do. It must contain the following text:
::sysinit:/etc/rcS ::respawn:/bin/ash ::ctrlaltdel:/bin/umount -a -rThis tells 'init' to run /etc/rcS script on startup, start an 'ash' shell (you may have selected a different shell during the configuration of busybox) and to unmount all when ctrl-alt-del is pressed. The programs that you want run automatically on startup should be put in the rcS script.
/etc/lilo.conf is used by the bootloader to set things up. The listing is shown below:
boot=/dev/hdc
disk=/dev/hdc
bios=0x80
map=/boot/map
install=/boot/boot.b
default=linux
linear
prompt
timeout=100
image=/boot/bzImage
label=linux
root=/dev/hdc1
read-only
The 'bios=0x80' line tells lilo that when we set the secondary IDE as the
boot drive in the BIOS, 0x80 will point to /dev/hdc instead of the usual
/dev/hda. It's a little confusing, read more about this in the lilo
manual. Now you are ready to install the bootloader on /dev/hdc. Change directory to /mnt/boot and execute the following:
lilo -r /mnt/ -C etc/lilo.confNow pray that everything goes alright! If successful, move on...
Your filesystem should look something like this.
Here is a screenshot of my embedded bootup
process.