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.

NEWSCHOOL METHOD:

http://www.fefe.de/netboot/how-to-netboot-installer.html

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;
fixed-address 192.168.1.169;
}

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


OLDSCHOOL METHOD

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

MODULES=netboot
BUSYBOX=y
COMPCACHE_SIZE=""
BOOT=nfs
DEVICE=eth0
NFSROOT=danny:/netboot_home

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 ftp.kernel.org (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:

OLD INFORMATION
http://www.etherboot.org/doc50/html/userman-4.html

NEW INFORMATION
http://etherboot.org/wiki/doc

http://www.mirrorservice.org/sites/ftp.kernel.org/pub/linux/utils/boot/wraplinux/

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: