===== Making a gPXE-bootable CD/DVD using ISOLINUX =====
gPXE already offers an option to make a bootable iso image via make bin/gpxe.iso, but what if you also want to store files on the disc? Once you've written the <1MB image to the CD, you still have 701MB left, so you might as well put it to good use.
==== You will need ====
SYSLINUX - This is probably available with your distribution. If not, you can get a copy from http://syslinux.zytor.com/
genisoimage or mkisofs - Again, probably included with your distribution. If not, it's available as part of cdrkit: http://www.cdrkit.org/
==== Preparing the Files ====
First, you need to put all the files you want to burn to the CD into a folder. You can make it wherever you like, but for this howto, I'll assume that its in ~/filesToBurn
Next, you need an isolinux.cfg file in the root of the folder. Here's a command to write a simple configuration; consult the SYSLINUX documentation if you want something more complex:
cat > ~/filesToBurn/isolinux.cfg << EOF
default gpxe
label gpxe
kernel /gpxe.lkr
EOF
The reason for the truncated filename will be explained later.
Next, you need to find the isolinux.bin file. Mine was /usr/share/syslinux/isolinux.bin but you can find yours using:
locate isolinux.bin
Once you've found it, copy it to your directory of files to write:
cp /usr/share/syslinux/isolinux.bin ~/filesToBurn/
==== Creating and installing the gPXE image ====
Enter the source directory (gpxe-*/src) and compile the lkrn image:
make bin/gpxe.lkrn
Copy the image to the directory of files to burn, renaming it to gpxe.lkr:
cp bin/gpxe.lkrn ~/filesToBurn/gpxe.lkr
This is because ISOLINUX only supports [[http://en.wikipedia.org/wiki/8.3_filename|8.3 filenames]], so gpxe.lkrn would be invalid.
Other files on the CD can still have long file names though.
==== Generating the image ====
Once you're happy that everything's in the right place, generate the .iso image like so:
genisoimage -o gPXEimage.iso -b isolinux.bin -no-emul-boot \
-boot-load-size 4 -boot-info-table -J ~/filesToBurn/
If that doesn't work, try substituting genisoimage for mkisofs.
If you aren't planning on using the disk on a windows machine, feel free to use the "-r" flag rather than "-J"
You should now have an iso image gPXEimage.iso in the current directory, which you can write to a disk using your favourite CD-burning software. You should then be able to both boot gPXE and read files from the CD.