Linux 2.6.18, Syslinux 4.02, nasm 2.09

I've spent the past several days trying to figure out how to add a new PXE server to our environment at work.  We have a corporate PXE server which I do not have access to, but I can request that a hook be put into place on the main PXE server and build my own.  It seems this process is typically called PXE chaining.

 

Currently

CORP PXE SERVER
  MENU
  1) Install Linux
  2) Install Windows
  ..

 

Desired

  +---------------------------------------------------------------+
  |                                                               |
 \ /                                                              |
CORP PXE SERVER (10.90.1.2)   +--> QA PXE SERVER (10.5.0.2)       |
  MENU                        |     MENU                          |
  1) Install Linux            |     1) Update BIOS                |
  2) Install Windows          |     2) Install Xen                |
  3) QA PXE Server------------+     3) Return to CORP PXE Server--+

 

The best method of accomplishing this is with pxechain.com, which is part of the syslinux project.  To set it up, you need at least version 4.04 of syslinux.  Then your CORP server's /tftpboot/pxelinux.cfg/default would have an entry like this:

LABEL qapxe
MENU LABEL QA PXE Server
KERNEL pxechain.com
APPEND 10.5.0.2::pxelinux.0

 

The issue I ran into is that the corporate PXE server is on an old version of syslinux (4.02), which has a bug in pxechain.com/pxelinux.0 that causes the machine being PXE booted to hang when pxechain.com is loaded.  So pxechain.com was not an option for me as I could not upgrade syslinux on the corporate server.

 

The second option I came across was gpxe.  Turns out it works with syslinux 4.02.  To configure it:

1) Download syslinux 4.02

2) Compile (make) the package with cd syslinux-4.02 ; make

3) Go into the syslinux-4.02/gpxe

4) Modify the pxelinux.gpxe script to look like this:

#!gpxe
set use-cached 1
dhcp net0
set net0/209:string pxelinux.cfg/default
set net0/210:string tftp://10.5.0.2/
imgload pxelinux.0
boot pxelinux.0

5) Run make again in the gpxe directory.  This will produce a binary called gpxelinux.0 that contains the above script embedded within it.  Install gpxelinux.0 on the corporate PXE server in the /tftpboot/ directory

6) Add an entry similar to this to /tftpboot/pxelinux.cfg/default:

LABEL qapxe
MENU LABEL QA PXE Server
KERNEL gpxelinux.0

 

The process for creating the menu entry on the QA PXE server that returns to the CORP PXE server is similar.  Edit the pxelinux.gpxe script and change the IP address to 10.90.1.2.  Compile and place that gpxelinux.0 on the QA PXE server in the /tftpboot/ directory.

 

If you need to troubleshoot pxechain.com, you need to uncomment the %define DEBUG in modules/pxechain.asm and be sure to use nasm 2.09.  nasm 2.03.01 on CentOS 5.5 wouldn't compile for me.  I had better luck with Debian Squeeze, which has a modern nasm.