First of all, build a kernel for the clients. I suggest you build it on the server, this will be useful later for modules installation. Use a zImage to reduce its size. Include everything you need, but try to use as many modules as possible, because many BOOTP client implementations are unable to load very large kernels (at least on intel x86 architectures). Also include iramdisk support, NFS protocol support, root filesystem on NFS support, support for your NIC, kernel level IP autoconfiguration via BOOTP; do not use modules for these! Then, if you plan to use the same remote root filesystem for several clients, add support for ext2fs or some other filesystem and ramdisks (16 Megabytes ramdisks will do fine on most systems). You can then modify the kernel arguments as usual (see the BootPrompt-HOWTO for information on this topic), but you will have another opportunity to modify kernel arguments later.
Then, if you plan to use BOOTP, copy the kernel zImage on the server. We will assume it resides in /tftpboot, its name is zImage, the name of the image you want to create from this zImage for BOOTP operation is kernel, and the nfs root filesystem will reside in /nfsroot.
Issue the following commands on the server (the mknbi package should be installed):
# cd /tftpboot # chmod 0555 zImage # chown root:root zImage # mknbi-linux zImage --output=kernel --rootdir=/nfsroot |
If you are using LanWorks EPROMs, also issue the following commands (you need the imggen utility):
# mv -f kernel tmpkernel # imggen -a tmpkernel kernel # rm -f tmpkernel |
Your kernel is ready for BOOTP/DHCP/ROM operation. You of course don't need to do this if you plan to use a local drive.
It is possible to use a ramdisk for the root filesystem. In this case, the command used to modify the kernel's binary image is slightly different. If you choose to do so, you have to enable support for initial ramdisk (initrd), and you probably don't need NFS support, or you probably can compile it as a module.
Its time to give an overview of what happens when you use initrd. The full documentation for this is in your kernel source tree, in the Documentation/initrd.txt file. I have to warn you I did never try this :).
When initrd is enabled, the boot loader first loads the kernel and the inital ramdisk into memory. Then, the ramdisk is mounted read-write as root filesystem. The kernel looks for a /linuxrc file (a binary executable or a script beginning with #!). When /linuxrc terminates, the traditionnal root filesystem is mounted as /, and the usual boot sequence is performed. So, if you want to run your box entirely from ramdisk, you just have to create a link from /linuxrc to /sbin/init, or to write there a shell script to perform any action you like, and then shutdown the computer.
After the kernel has been compiled, you have to build a root filesystem for your installation. This is explained in the "Clients setup, creation of the root filesystem" section. I will assume here that this is already done and that the root filesystem for your clients temporarily resides in /tmp/rootfs. You now have to create a ramdisk image. A simple way to do so is the following:
Make sure the computer you are working on has support for ramdisks and has such a device (/dev/ram0).
Create an empty filesystem with the appropriate size on this ramdisk:
# mke2fs -m0 /dev/ram0 300 |
Mount it somewhere:
# mount -t ext2 /dev/ram0 /mnt |
Copy what you need for your new root filesystem, and create your future /linuxrc if you did not create it in /tmp/rootfs/linuxrc:
# cp -a /tmp/rootfs/* /mnt |
Unmount the ramdisk:
# umount /mnt |
Save the ramdisk image to some file and free it:
# dd if=/dev/ram0 of=initrd bs=1024 count=300 # freeramdisk /dev/ram0 |
Then, you have to modify the kernel image, as was told above, with the mknbi-linux utility. Its invocation will slightly differ from the above, though (I will assume your just compiled zImage resides in /tftpboot/zImage and your initial ramdisk image resides in /tmp/initrd):
# cd /tftpboot # chmod 0555 zImage # chown root:root zImage # rdev zImage /dev/ram0 # mknbi-linux zImage --output=kernel --rootdir=/dev/ram0 /tmp/initrd |