Difference between revisions of "PXE booting for BIOS updates"

From FnordWiki
Jump to navigation Jump to search
Line 19: Line 19:
 
Running Debian, atftpd is installed with the command <code>apt-get install atftpd</code>. The package maintainer scripts will add an entry to /etc/inetd.conf and will create a directory called /var/lib/tftpboot from which atftpd will serve files.
 
Running Debian, atftpd is installed with the command <code>apt-get install atftpd</code>. The package maintainer scripts will add an entry to /etc/inetd.conf and will create a directory called /var/lib/tftpboot from which atftpd will serve files.
   
= install pxelinux and create a config file =
+
= Setting up pxelinux and create a config file =
== default config file ==
+
== installing pxelinux ==
  +
PXElinux is part of [http://syslinux.zytor.com syslinux]. Install it thusly:
== PXElinux's memdisk driver ==
 
  +
apt-get install syslinux
  +
install -o root -g root -m 444 /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot/pxelinux.0
  +
  +
== a PXElinux config file ==
  +
The config file telling PXElinux what to do is also fetched from the TFTP server by the client machine. The config files live in the <code>pxelinux.cfg</code> directory under the TFTP server's root. For us, this will be <code>/var/lib/tftpboot/pxelinux.cfg</code>. PXElinux tries to fetch a number of config files in turn. This process is documented in <code>/usr/share/doc/syslinux/pxelinux.txt.gz</code>. For our purposes, we'll just be setting up the <code>default</code> config file. It reads like so:
  +
label dos
  +
kernel memdisk
  +
append initrd=fdboot.img
  +
This config file instructs PXElinux to load the memdisk driver from the TFTP server instead of a Linux kernel. And it tells the memdisk driver to read in the fdboot.img file from the TFTP server to use as a fake disk drive.
  +
  +
The memdisk driver is part of the syslinux distribution and must be copied to the TFTP server's root directory before the client can load it:
  +
install -o root -g root -m 444 /usr/lib/syslinux/memdisk /var/lib/tftpboot/memdisk
  +
 
== syslinux's memdisk module ==
  +
The syslinux memdisk module can load a disk image over the network and create a RAM-backed virtual floppy or hard drive. For our purposes, a floppy will perform nicely. Most BIOS updates are pretty small files (1.8Mbytes for our Dell GX740 update). memdisk will support
  +
 
= create a floppy image to netboot =
 
= create a floppy image to netboot =
 
== Get FreeDOS bits ==
 
== Get FreeDOS bits ==

Revision as of 21:38, 19 January 2011

So you're all about the free software. But you've just obtained a new (or old) machine. And its firmware is out of date and in need of updates. It doesn't have a floppy drive, just a CD or DVD drive and USB hard drive support. There aren't any copies of DOS or Windows in the house that might be used to for a firmware update. Ah, but it will netboot!

set up DHCP to point net-booting machines at a TFTP server

Here's an /etc/dhcp/dhcpd.conf stanza for the to-be-updated machine:

host yesdear {
        hardware ethernet 00:1a:a0:25:fc:f3;
        fixed-address 172.16.0.150;
        option host-name "yesdear";
        next-server 172.16.0.1;
        filename "pxelinux.0";
}

The "next-server" keyword tells the client machine which TFTP server to contact. And the "filename" keyword tells it which file to download from that TFTP server.

install a TFTP server

TFTP is the "trivial file transfer protocol" defined in RFC 1350 (and others). It's a UDP based mechanism often used to get boot images over a network.

I'm running the "atftpd" TFTP server. It's home on the web seems to be ftp://ftp.mamalinux.com/pub/atftp/

Running Debian, atftpd is installed with the command apt-get install atftpd. The package maintainer scripts will add an entry to /etc/inetd.conf and will create a directory called /var/lib/tftpboot from which atftpd will serve files.

Setting up pxelinux and create a config file

installing pxelinux

PXElinux is part of syslinux. Install it thusly:

apt-get install syslinux
install -o root -g root -m 444 /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot/pxelinux.0

a PXElinux config file

The config file telling PXElinux what to do is also fetched from the TFTP server by the client machine. The config files live in the pxelinux.cfg directory under the TFTP server's root. For us, this will be /var/lib/tftpboot/pxelinux.cfg. PXElinux tries to fetch a number of config files in turn. This process is documented in /usr/share/doc/syslinux/pxelinux.txt.gz. For our purposes, we'll just be setting up the default config file. It reads like so:

label dos
        kernel memdisk
        append initrd=fdboot.img

This config file instructs PXElinux to load the memdisk driver from the TFTP server instead of a Linux kernel. And it tells the memdisk driver to read in the fdboot.img file from the TFTP server to use as a fake disk drive.

The memdisk driver is part of the syslinux distribution and must be copied to the TFTP server's root directory before the client can load it:

install -o root -g root -m 444 /usr/lib/syslinux/memdisk /var/lib/tftpboot/memdisk

syslinux's memdisk module

The syslinux memdisk module can load a disk image over the network and create a RAM-backed virtual floppy or hard drive. For our purposes, a floppy will perform nicely. Most BIOS updates are pretty small files (1.8Mbytes for our Dell GX740 update). memdisk will support

create a floppy image to netboot

Get FreeDOS bits

mtools to format

  • update /etc/mtools.conf:
    • specify a file instead of a floppy special device
    • specify 12-bit FAT
  • use FreeDOS boot sector

copy FreeDOS programs into floppy image

copy BIOS updater into floppy image

boot client machine