The next step is to make a boot floppy disk using Grub. GNU Grub is the GRand Unified Bootloader. It can handle BOOTP and TFTP, so it can boot from network.
In the working directory create a file named grub.conf with the following content:
default=0 timeout=1 title Clone bootp root (nd) kernel /vmlinuz rw root=/dev/ram ramdisk_size=4096 init=/bin/clone initrd /initrd.gz |
In the last four lines are the Grub commands to boot from network:
bootp, to get an IP address from the DHCP server.
root (nd), to set the root in the network (TFTP server). An alternative TFTP server could be set before this command using the command tftpserver <tftp server>
.
kernel, to specify the kernel file and its parameters:
rw
, to specify writable mounting of the root file system.
root
, to specify where to mount the root file system (in ram memory).
ramdisk_size
, to specify the ram disk size. 4096 (kbytes) is the default size but if you needed a greater image, change this parameter accordingly.
init
, to specify (our script) as the first program to run in user mode (in the absence of init and sh).
initrd to specify the file holding the image of the root file system.
To compile Grub, first download the source tarball from the Grub web site and unpack it. Run configure specifying the menu file you just created and the network interface card model. Run make as usual.
# tar xzf grub-0.92.tar.gz # cd grub-0.92 # ./configure --enable-preset-menu=../grub.conf --enable-3c90x # make |
Again, where you see 3c90x put the model of your network interface card. First check if it is supported by Grub.
Once Grub is compiled, the image of the boot floppy disk is the concatenation of the files stage1/stage1 and stage2/stage2. To make the floppy disk run:
# cat stage1/stage1 stage2/stage2 | dd of=/dev/fd0 |
You should now have a boot floppy disk.