initrd
This chapter covers the more esoteric booting options, namely those that
involve an initial ram disk (initrd
). The casual user can safely
skip this chapter. The features described in this chapter are subject to
change.
To get started, an empty ram disk should be created. The following example creates an empty filesystem of about 4 MB. There are no particular restrictions on the size of the disk at this point, but making it needlessly large will just consume RAM when the machine is running later on.
dd if=/dev/zero of=myramdisk bs=1k count=4096 mke2fs -F myramdisk insmod loop mount -oloop myramdisk /mnt
The disk can now be populated by copying files into /mnt
. Keep in
mind that for each binary, all necessary libraries and configuration files
must be installed as well. Finally, you should create a file called
/mnt/linuxrc
and make it executable. This script will be run when
the disk is booted. The chroot
command is helpful for testing out
the disk before installing it. Once you are satisfied, the next step is to
unmount, then compress the disk image:
umount /mnt gzip myramdisk
This will produce a file called myramdisk.gz
. There are size
restrictions on this compressed ram disk image, as explained in the next
section. If your image is too large, you'll have reduce the number of files
you put into the image.
The compressed ram disk image can either be burned into the flash memory chip, or it can be fetched via TFTP when the NetWinder boots. The first option allows for diskless, networkless booting of a NetWinder, while the second option allows a somewhat larger ram disk to be loaded.
The compressed disk image can be written to the unused portion of the flash
memory. The proceedure is to simply join the compressed image on to the end
of a standard nettrom
binary image, and then to write the combined
image into the flash memory:
cat nettrom-2.0.X.bin myramdisk.gz >combined.img insmod nwflash flashwrite -base64 combined.img 0
NetWinders normally have 1 MB of flash memory, with the top 64 kB reserved
for configuration data. The total size of `combined.img
' must not
exceed 983040 bytes (that's 1 MB minus 64 kB), otherwise it won't work (and
if you were expecting a little warning message to be printed if you exceed
the size, guess again...)
To try out the image, reboot the NetWinder and go into the firmware control
menu. Issue the command setenv initrd flash
, save the parameters
if you wish, and boot it. If you've done things correctly, your ram disk
will be loaded and the linuxrc
script will be run.
A somewhat larger initial ram disk can be loaded via TFTP protocol over the network. This option is only available with version 2.0.7 of the NetWinder firmware. The compressed ram disk should be concatenated onto a normal NetWinder kernel. The maximum allowable size of the combined kernel and compressed filesystem is 4 MB (ie. 4194304 bytes). Please note that at this time, only ELF kernels (ie. most 2.0.35 kernels) will work - the 2.2 kernel series are not recognized as ELF and the ramdisk won't be detected. This will be fixed in an upcoming nettrom.
cat /boot/vmlinux myramdisk.gz >vmlinux+ramdisk
The resulting file vmlinux+ramdisk
should be transfered to the TFTP
server machine, perhaps via ftp or nfs. The NetWinder should then be
rebooted and the firmware settings for TFTP booting should be activated:
setenv kernconfig tftp setenv kerntftpserver 10.2.3.4 setenv kerntftpfile vmlinux+ramdisk
Of course the IP address and filename will need to be adjusted for your particular setup. For more details, consult the TFTP example in the `Using the firmware' chapter.
It is possible to download a kernel via the serial port. This is intended for emergency situations only where the flash memory doesn't contain a valid boot image. See the last section in the `Updating the firmware' chapter for details.