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.



  1) Install Linux
  2) Install Windows



  |                                                               |
 \ /                                                              |
CORP PXE SERVER (   +--> QA PXE SERVER (       |
  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, 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


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 that causes the machine being PXE booted to hang when is loaded.  So 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:

set use-cached 1
dhcp net0
set net0/209:string pxelinux.cfg/default
set net0/210:string tftp://
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
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  Compile and place that gpxelinux.0 on the QA PXE server in the /tftpboot/ directory.


If you need to troubleshoot, 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.