Step by step solutions to IT problems

PXE Booting a Laptop

Turn an old laptop with a pcmcia network card into a thin client instead of thowing it out. They make ideal thin clients, as they are small, low power and can run quietly.

Available Options

Most modern laptops with built in network cards already have support for network booting (using PXE), but older laptops usually only support booting from either disk,cd or floppy. This means that even if a pcmcia card supported PXE (and I've not yet found one that does), there would be not way for the computer bios to use it.

This means we need to use software to do the PXE stuff for us, which means booting from a floppy,cd or hard drive and kicking off a PXE boot from there. The ideal solution is to replace the hard drive with a compact flash card in a compact-flash to 2.5" ide converter, which would give a reliable, silent and low power boot device.

There are two main programs for creating software for PXE booting, etherboot and netboot.

Etherboot's best feature is the rom-o-matic service, which is a website that creates the software package for your network card for you, without you needing build it yourself, and even better, supports creating DOS .com files , which gives you much more control over the boot process. Unfortunately Etherboot does not support pcmcia cards, which makes it no use for booting a laptop.

Netboot works similarly to etherboot, but provides no automated build website, so you have to install the software (on linux) yourself in order to build the boot package. Also Netboot only supports building ROM files (of no use to us) and floppy disk images. Floppy disk images we can use, even from a hard disk. The best feature of netboot is that it is not limited to a short list of supported network cards, but will support any card for which there is either a packet driver, or dos driver available.

Unfortunately many newer pcmcia network cards don't bother with dos or packet drivers any more, but plenty of older ones do. In this example I'm using a Netgear FA 410TX for which there are packet drivers available.

Getting Started with Netboot

You will need a linux box to build the boot software, so if you don't have one, either find someone who does, or download a vmware linux appliance, or a copy of coLinux.

Download and install the netboot software. I had problems getting the latest version (0.10.1) to install, so I downloaded a previous version (0.9.8) instead, which installed fine.

make install

Once you've got it installed, you need to grab a copy of either the dos or packet driver for your pcmcia card. I'm using the packet driver, called FA410.COM. Copy the file to the correct netboot driver directory - packet drivers go in /usr/local/lib/netboot/netdrvr/pktdrvr and then run the makerom command, which builds the floppy image as well as a rom file (which we ignore).

# makerom

Bootrom configuration program, Version 0.9.8 (netboot) Copyright (C) 1995-2003 G. Kuhlmann

Build bootrom for a processor older than 386 (y/n) [no] ? n Include support for old-style menus (not recommended) (y/n) [no] ? n Do you want the BIOS to look for boot disks (y/n) [no] ? n Do you want the bootrom to ask before booting from network (y/n) [no] ? n

List of known network cards: (0) unknown card with user supplied driver (1) 3Com 3C501 Etherlink ISA

Press <ENTER> to continue listing

(130) SMC StarCard Plus/A (WD8003ST/A) MCA (131) Znyx ZX312/314 EtherAction PCI

Select a network card (-1 to review the list) [-1]: 0

Known network card bus types: (1) ISA bus (including PnP) (2) EISA bus (3) MCA bus (4) PCI bus Select the bus type of your network card [1]: 1 Enter PnP device ID string (maybe empty):

The following network driver interfaces are available: (1) Packet Driver Interface (PD) (2) Network Driver Interface Specification (NDIS) (3) Universal Network Driver Interface (UNDI) Select the interface you wish to use [1]: 1 Enter path of packet driver ('*' for directory listing): Enter command line for packet driver [0x%S]: Enter minimum execution size in bytes (-1 = default) (decimal): -1 Enter maximum execution size in bytes (-1 = default) (decimal): -1 Do you want to use the packet driver debugger (y/n) [no] ? n Do you want to specify an additional program (y/n) [no] ? n

Available output file types for rom image: (1) Raw binary (2) Intel hex (3) Motorola hex (4) Tektronix hex (5) Image for programming a FlashCard across the network Select the format you wish to use [1]: 1

# ls image.* image.flo image.rom #

You should now have two files, a floppy disk image, and a rom image. We are only interested in the floppy disk image. Copy the image onto a floppy drive

# dd if=image.flo of=/dev/fd0
From windows you can use rawrite (or rawritent) to copy the image to a floppy. Now try booting the laptop with the floppy disk, to check it works. You should see it load the packet driver, and then send a dhcp request. Assuming you have a setup PXE server, then it should connect and run whatever PXE configuration you have set up.

Tweaking the boot

One of the annoying things about netboot, is that it destroys the formatting on the disk it's copied to, so you can't use the disk for anything else. However, there is a solution for this. In order to be able to use netboot easily from either a floppy or hard disk, we will turn the small image.flo into a proper floppy image, and then use syslinux and memdisk to boot the floppy image instead. Although this adds a couple of steps to the boot procedure, it means you can boot from a FAT partition on a floppy, hard drive, or compact flash disk, without destroying the rest of data.

Download a copy of syslinux and memdisk, and install syslinux onto a floppy initially (before we mess with your hard drive) and copy memdisk onto the floppy. In order for memdisk to recognise the image.flo as a floppy image, we need to pad it out to the size of a small floppy. The smallest floppy memdisk recognises is 368,640 bytes. So look at the size of the image file, and see how short it is, and create a padding file to append to the end. In this example image.flo is 27284 bytes long, so we need to pad 341,356 bytes to the end

# ls -l image.*
-rw-r--r--    1 root     root        27284 Sep 30 08:21 image.flo
-rw-r--r--    1 root     root        32768 Sep 30 08:21 image.rom
# dd if=/dev/zero of=image.pad bs=341356 count=1
1+0 records in
1+0 records out
# cat image.flo image.pad > image.img
# ls -l image.*
-rw-r--r--    1 root     root        27284 Sep 30 08:21 image.flo
-rw-r--r--    1 root     root       368640 Sep 30 08:42 image.img
-rw-r--r--    1 root     root       341356 Sep 30 08:42 image.pad
-rw-r--r--    1 root     root        32768 Sep 30 08:21 image.rom

Now configure the SYSLINUX.CFG file on your floppy to get memdisk to load the floppy image


LABEL NETBOOT KERNEL memdisk APPEND initrd=image.img

Now copy the image.img file onto the floppy, so assuming you installed syslinux onto the floppy, and copied on the files you shoud have the following on the floppy disk.

Now boot with this floppy, if it works, syslinux, will load memdisk, which will load the floppy image, which will start the packetdriver and initialise a PXE boot.

If it worked from the floppy, then you can install syslinux onto a FAT partition on your hard drive, and copy over the other files, and do a PXE boot from your hard drive. Or, buy a small compact flash card, and compact flash to 2.5" ide converter, and install the setup on that.

Submit to    digg    reddit    simpy