Root over NFS - Another Approach: Preparing the boot disk

Next Previous Contents

## 4. Preparing the boot disk

To prepare a boot disk we just want a kernel, `syslinux` and a 1,44MB diskette. `Syslinux` is tiny boot loader, designed specifically to boot a kernel and pass some arguments through its command line using a diskette. As we will see it very easy to configure, too.

## 4.1 Building a kernel

Always choose the newest kernel to build. As of this time of writing (Wed Sep 12 17:28:22 2001) the newest kernel is 2.4.9. Building an older kernel can only save you time updating the nesessary programms. Also, be sure you have the program versions described in `/usr/src/linux/Documentation/Changes`. It is a good idea to compile the kernel using the base system to be served. The kernel can be build according to your needs of drivers, but it must contain the following options:

- Build in support for the cient 's network card (`Network device support ---> Select your card driver`).
- Build in support for the BOOTP protocol (`Networking options ---> IP: kernel level autoconfiguration ---> IP: BOOTP support`).
- Build in support for NFS and root over NFS (`File systems ---> Network File Systems ---> NFS file system support` and `File systems ---> Network File Systems ---> NFS file system support ---> Root over NFS`).
- Build in support for loopback devices (`Block devices ---> Loopback device support`).

Do not forget to compile in the VESA framebuffer driver. Then go on with the familiar kernel compilation routine. Unless you have build the kernel using the base system, copy all the modules created to the `base/lib/modules` directory of the exported directory structure. The new kernel resides at `/usr/src/linux/arch/i386/boot`.

You also have to set the root device to your kernel. You have to use the `rdev` programm. Execute the following commands:

> `

>     mknod /dev/boot255 c 0 255
>     rdev /path/to/kernel/file /dev/boot255

> `

## 4.2 Creating the boot disk

Now, we have to use the `syslinux` programm. Insert a disk into the first floppy drive and run:

> `

>     syslinux -s /dev/fd0

> `

Mount the floppy and notice that syslinux has written 2 files: `syslinux.cfg` and `ldlinux.sys`. The second is the boot loader executable. The `syslinux.cfg` is the programm configuration file. A typical structure for that file is the following:

> `

>     default linux
>        append init=/sbin/init root=/dev/nfs
>             ip=:195.251.160.10:195.251.160.254:255.255.255.0:::'bootp'
>             nfsroot=195.251.160.10:/usr/local/linux/ws/\%s vga=0x318

>        prompt 1
>        timeout 30
>        readinfo 2

> `

The default statment is the kernel name to be booted and the append is the command line to be passed to the kernel. Now, you have to copy the kernel you have created to the floppy and rename it to 'linux'.

## 4.3 The kernel command line

To boot a diskless client, its kernel must have the following command line options:

- `init=/sbin/init`: If your init programm is elsewhere just change the path.
- `root=/dev/nfs`: An alias to say the kernel that it has to mount its root directory over nfs
- `ip`: This command line option tells the kernel how to get it's IP address and which is the NFS server's address
- `nfsroot`: Tells the kernel to mount this directory as its root. The % is an alias to the host 's IP address.
- `vga`: If you want to be able to start X windows in framebuffer mode, switch to a framebuffer mode. The one given stands for 1024x768@16M colors.

All these options are discussed in detail in `/usr/src/linux/Documentation/nfsroot.txt`. Read it and adjust the given command line to your needs.

Now you have created the boot disk you are ready to test the system you have build. Start the NFS and BOOTP services and boot a client with the boot disk. No one has been able to do it from the first time. So go on to the next section!

Next Previous Contents