Sunday, 18 September 2011

Netboot 2.6 Kernels with gPXE/Etherboot and BOOTP

When you can't use ISC dhcpd and pxelinux for Netbooting Diskless clients.


Here's my ISC dhcpd configuration for booting a laptop at home:

host thinksen {
filename "/tftpboot/debian/pxelinux.0";
server-name "danny";
next-server servername;
hardware ethernet 00:11:25:5C:E4:EB;

tng@danny:/tftpboot/debian$ ls
debian- mini.iso pxelinux.0
debian-installer netboot.tar.gz pxelinux.cfg


However, sometimes bootpd is already installed and a moving everything over the dhcpd just isn't the way to do things. We need to work with what is already installed and used and understood. In this case a new kernel was required for newer hardware.

Building a kernel is well understood, but there are a few options that need to be set. You can either build a monolithic kernel or a kernel with an initial ramdisk. If you are building an initial ramdisk, then make a new directory

# cp -rp /etc/initramfs-tools /etc/initramfs-tools-nfsroot

# Edit /etc/initramfs-tools-nfs/initramfs.conf


Build a kernel and a Ramdisk

#mkinitramfs -d /etc/initramfs-tools-nfsroot -o initrd.img-2.x.yz.abnfs 2.x.yz.abnfs

(Where 2.x.yz.abnfs is the name of the kernel and the modules directory in /lib/modules/)

The usual procedure having got a kernel and an initrd.img is to build a wrapped image. This contains the extra information that the gPXE/Etherboot Kernel needs and any optional arguments. Now the usual procedure for etherboot is to use mkelf-linux, but 2.6 kernels are *not* supported. Sometimes they boot and say ok at the end of the tftp but don't load into Memory. Sometimes they crap out during the tftp load .......

The only workaround for these errors is to use wraplinux which needs downloading from (which is currently down due to break-ins) - pub/linux/utils/boot/wraplinux. This information is hidden in the etherboot documentation, but the etherboot manual shows up before the wiki:



Build it as usual: extract the tarball, configure; make; make install

# wraplinux -p 'ip=bootp root=/dev/nfs rw nfsroot=danny:/netboot_home' -i initrd.img-2.x.yz.abnfs -o ./gpxe-vmlinuz bzImage-2.x.yz.abnfs

Alternatively, it is possible to build a monolithic Kernel

The following options need enabling:

#Kernel configuration->#Networking Support->#Networking Options
[*] IP: Kernel level autoconfiguration
[*] IP: DHCP Support
[*] IP: BOOTP Support

#File Systems->#Network File Systems
[*] Root Filesystem on NFS

# wraplinux -p 'ip=bootp root=/dev/nfs rw nfsroot=danny:/netboot_home' -o ./gpxe-vmlinuz bzImage-2.x.yz.abnfs

Copy the kernel to the bootp server, edit the /etc/bootptab to suit and then boot off your gPXE.iso.

No comments: