2. Booting from flash

While Linux was booting using an NFS filesystem, this was not enough. For an actual field product, we needed Linux to boot from an independent device, without the need for a network at all. We decided to create a special kind of image, called initrd, which is basically a Linux kernel with a compressed file. The compressed file includes a Linux filesystem. The filesystem is unpacked to a ramdisk on boot, and mounted as the root filesystem.

During the boot process, the bootloader relocated the kernel image to address zero - which was fine, and the initrd part to a higher address. The area to which initrd was relocated was not mapped in our kernel's memory, and all we got was a kernel error (access to bad area). After modifying the bootloader to relocate initrd to a different address, all was fine and Linux booted succesfully.

Tip

If your board has some NVRAM memory, it would be a good idea to use it for bootloader purposes. After writing a module for our NVRAM memory (out of scope for this paper), we modified the bootloader, so that the kernel command-line, and MAC address were saved in NVRAM. When the bootloader starts, it checks NVRAM and if it is initialized (by a certain magic number), the bootloader uses the command line written there. Otherwise, the bootloader reverts to a default command line, allowing the user to edit it.