Burning gPXE into ROM

For a permanent deployment of gPXE, you can burn it into your network card's expansion ROM, as a replacement for the card's legacy PXE ROM. Most modern network cards store their expansion ROMs in flash memory, and most manufacturers will provide a utility to allow you to update the expansion ROM.

A network card

The gPXE ROM will show up as a boot device in the BIOS boot menu. Some BIOSes do not show specific devices in the boot menu, but instead show a generic option such as “Boot from LAN”.

The gPXE ROM will become a permanent fixture of your network card; if you move the card to another machine then the gPXE ROM will be available in the new machine.

Network card Original Equipment Manufacturers (OEMs) can burn gPXE into their cards at the point of manufacture. There are no licensing fees for providing cards containing gPXE ROMs, but please be aware that you must comply with gPXE's GPL license terms.

Determining the PCI ID

Some expansion ROMs

To build a ROM image for your network card, you need to know the PCI vendor and device IDs for your card. The BIOS may check the PCI IDs embedded within the ROM image against the PCI IDs of the card; if they do not match then some BIOSes will ignore the ROM.

You can identify your card's PCI IDs using a tool such as lspci:

  [root@localhost]# lspci
  00:00.0 Host bridge: Intel 82865G/PE/P DRAM Controller
  00:01.0 PCI bridge: Intel 82865G/PE/P AGP Controller
  00:1d.0 USB Controller: Intel 82801EB/ER USB UHCI Controller
  00:1d.1 USB Controller: Intel 82801EB/ER USB UHCI Controller
  00:1e.0 PCI bridge: Intel 82801 PCI Bridge
  01:00.0 VGA compatible controller: ATI Radeon RV100
  02:00.0 Ethernet controller: D-Link System Inc DGE-528T

In this example, the network card is the last line of output, with the PCI bus:dev.fn number 02:00.0. To find the PCI vendor and device ID, use

  lspci -n -s 02:00.0

where 02:00.0 is the PCI bus:dev.fn number corresponding to your network card. You should see something like

  [root@localhost]# lspci -n -s 02:00.0
  02:00.0 Class 0200: 1186:4300 (rev 10)

Make a note of the vendor and device IDs (1186 and 4300 respectively in the above example).

Building the ROM image

Download gPXE and build a ROM image:

  cd gpxe/src
  make bin/11864300.rom

An expansion ROM

where 1186 and 4300 are the PCI vendor and device IDs for your network card. Make a note of the ROM image file (bin/11864300.rom in the above example).

Check the size of the ROM image file. If your BIOS does not support PCI 3.0, it must fit alongside any other option ROMs in your system (video cards often take up 50kb or so, and bootable RAID and SCSI controllers take up space as well) in the 128kb option ROM space. If you overflow this space, the result will depend on your BIOS; maybe gPXE won't be loaded at all, maybe you'll get an error message with an option to continue, maybe your boot will freeze entirely. To recover the NIC in the latter situation, see the “Recovering from a bad flash” section below.

Burning the image into ROM

To burn the image file into ROM, you will need to use a utility specific to your network card. Instructions are available for:

It probably goes without saying, but you should not boot DOS over SAN from the NIC you're flashing in order to flash it! MEMDISK is safe, though.

Recovering from a bad flash

If you accidentally burn a corrupted ROM image file, or with some buggy BIOSes even a perfectly fine one that's large enough to overflow option ROM space, you will likely run into a dilemma: you can't boot your system with the NIC installed, but you need to run a program with the NIC installed in order to reflash it. The solution to this is not an attempt at PCI hot-plugging (it has been tried and did not work); instead, try these suggestions.

Most likely you will be able to enter BIOS Setup before the point at which your boot fails. Search for any option to disable Option ROM scan, either globally or for the PCI slot containing your network card. Try putting gPXE very late in the boot process. If you own a ROM burner and your NIC has a socketed ROM, you can use the ROM burner to erase the ROM; the BIOS won't try booting any option ROM that's missing the 55 AA signature.

If that doesn't work, you'll need to acquire another gPXE-flashable NIC. Take the bad NIC out of your computer, and flash gPXE onto the new NIC. Put both NICs in your computer, such that the new NIC has a lower PCI bus:dev:fn number than the bad NIC; usually this means the new NIC should be closer to the CPU. Now boot. The BIOS will scan for option ROMs in PCI bus order, so gPXE on the new NIC gets called to initialize itself before the old NIC has a chance to screw things up. When you get prompted with

Press Ctrl-B to configure gPXE...

do so. You now have a regular gPXE prompt, capable of loading e.g. a DOS floppy using MEMDISK that contains a flash tool to fix your broken NIC.