Knoppix Network Boot Floppy with GRUB

Introduction

This small HOWTO describes how to set up a server and build a bootfloppy that uses GRUBs feature that it can use the network to load the menu and the kernel. Unlike the knoppix-terminal server it does not need a DHCP server with special configuration for network boot. The floppy has a hardcoded server in it's config file. All it needs is a TFTP and NFS server. Any machine on the network can be used, even two different ones.


However it can also be used with Etherboot or PXE, thanks to the nbigrub and pxegrub images. Those can be loaded by a bootrom on the network card. It's the same as working with a bootfloppy as soon as they are loded. (in this case a specialy configured DHCP server is needed though)


The bootfloppy needs to be build for the network card found in the client computer, multiple drivers can be used on the same floppy. The bootmenu on the floppy simply loads the bootmenu from the server, meaning that the bootfloppy does not need to be changed when new Knoppix versions are added

on the server.

Requirements

$ apt-get install nfs-kernel-server #or any other NFS server

$ apt-get install tftpd

$ apt-get install dosfstools #mkfs.msdos

$ apt-get source grub

and gcc is used to compile GRUB.

Creating the Bootfloppy

Edit "make_bootfloppy":

Set the "SERVERIP" to your TFTP servers IP number (names are not allowed).


GRUB can be configurend and compiled too, if "COMPILE" is set to "1". In that case is DRIVERS a list of --enable-XXX (options to GRUBS ./configure script) and "GRUB" itself is the path to the GRUB sources. (also add --enable-diskless if you want the nbigrub and pxegrub images)


Attention: "configure" and "make clean" is executed in the "GRUB" directory, it will overwrite any existing configuration and build!


The generated bootfloppy does use DHCP to discover the clients IP number. In environments without DHCP server, that specific line can be chaged to "ifconfig IP" (see GRUBs manual for more details). In that case, its required to make a boot floppy for each client IP number.


The bootfloppy image that is built, uses the FAT filesystem, so that the menu file on the disk can easily be edited on any machine. However, it is usualy not needed if DHCP is available as the bootfloppy loads the main menu from the server.

Setting up the server

* TFTP

Ensure that /tftpboot is served by tftpd, check /etc/inetd.conf. Create the directory /tftpboot, add kernel and miniroot.gz from a Knoppix terminalserver in that directory. The most recent versions should be named "current-vmlinuz" and "current-miniroot.gz". These may be links to and other version, e.g. to 2003-03-30-vmlinuz etc.


/etc/inetd.conf needs to contain a line like this:

tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /tftpboot

* The boot menu for the clients

The clients load "/tftpboot/menu.lst", this means that each Knoppix version needs an entry in this file, maybe even multiple entries for different cheatcodes (like on the CD, e.g. fb800x600 lang=XX etc).


It contains the IP number of the NFS server. See tftpboot/menu.lst for an example. If desired, different NFS servers for different images can be used. You can even add entries to the menu to "jump" from one server to an other (just use an "tftpserver IP" and then load the new menu with "loadconfig (nd)/tftpboot/menu.lst")


The example menu.lst as well as the above created bootfloppy have a menu entry to load and display "/tftpboot/readme.txt" from the server. This can be used to describe the different boot options or what the different menu entries do. Its also helpful if different servers with knoppix images exist.


This configration file must not contain the "dhcp" or "ifconfig" options. It's not needed anyway as the client machine already has a configurend network setup that was used to get this menu file.

* NFS

Ensure that /knoppix is exported for all clients, add a line like this in /etc/exports:

/knoppix 192.168.1.0/255.255.255.0(ro,no_root_squash,async)


In the directory /knoppix, create subdirectories for each Knoppix version you want to serve. /knoppix/current should exist and can be a link to an other directory. These directories must contain a folder named KNOPPIX and in that the file KNOPPIX, like you find it in a CD. You can copy the full CD to that loaction or just KNOPPIX/KNOPPPIX. If Knoppix is booting on a client machine, it will look for the file KNOPPIX/index.html. You can provide your own file file with links for your site etc. or just leave it away.


The easiest way to get to vmlinuz and miniroot.gz is to run Knoppix from the CD and start the terminal-server. These files can be found in /tftpboot after it's started. Don't forget to select all appropriate network drivers for your hardware (but not all, as they don't fit in the miniroot).

* Summary

The GRUB bootloader on the floppy (or nbigrub/pxegrub) needs to be compiled for the network card found in the client machines. The miniroot on the server needs support for the same network cards. (The names of network drivers in GRUB and miniroot are different.) GRUB needs to be compiled by you, the miniroot can be obtained by running a Knoppix terminal-server for a minute.


The bootfloppy loads the menu file from the server, it does not need to be changed when new versions of Knoppix are added.


File listing from the Server:


Files in /tftpboot:

-rw-r--r-- 926k 2003-03-30-miniroot.gz
-rw-r--r-- 904k 2003-03-30-vmlinuz
lrwxrwxrwx 22 current-miniroot.gz -> 2003-03-30-miniroot.gz
lrwxrwxrwx 18 current-vmlinuz -> 2003-03-30-vmlinuz
-rw-r--r-- 939 menu.lst
-rw-r--r-- 564 readme.txt


Example files in /knoppix:

drwxr-xr-x 72 2003-03-30
lrwxrwxrwx 19 current -> /knoppix/2003-03-30


Make sure that the KNOPPIX file is it's place and that it is world readble.

drwxr-xr-x 72 /knoppix/2003-03-30/KNOPPIX
-r--r--r-- 693M /knoppix/2003-03-30/KNOPPIX/KNOPPIX



(C) 2003 Chris Liechti <cliechti@gmx.net>


DISCLAIMER

THIS IS EXPERIMENTAL SOFTWARE. USE AT YOUR OWN RISK. THE AUTHORS CAN
NOT BE HELD LIABLE UNDER ANY CIRCUMSTANCES FOR DAMAGE TO HARDWARE OR
SOFTWARE, LOST DATA, OR OTHER DIRECT OR INDIRECT DAMAGE RESULTING
FROM THE USE OF THIS SOFTWARE AND/OR DOCUMENTATION. IF YOU DO NOT
AGREE TO THESE CONDITIONS, YOU ARE NOT PERMITTED TO USE OR FURTHER
DISTRIBUTE THIS SOFTWARE.