Booting gPXE from a memory stick partition with SYSLINUX

Much like the howto usbwithstorage, this will guide you through installing gPXE on your flash drive (or any other FAT/ext234/btrfs partition for that matter) without losing ability to store files on it. In fact, using EXTLINUX or SYSLINUX, it's possible to use this method to make almost any medium gPXE-bootable.

Warning: Following this guide is generally quite safe, but if you have important data on your USB stick, you may want to make a backup first just to be safe.


I'll leave this part mostly down to you. It's probably available in your distribution's package manager, but if not, you can get it from

NOTE: I'd highly recommend the latest official pre-compiled package (Yes, it's been a source/binary package since the beginning). See also Official Binaries -GeneC

Making the partition bootable

The partition will first need to be labelled as “boot” using fdisk.

Start fdisk. As root:

fdisk /dev/sdb

Replace /dev/sdb with your disk.

Type “p” to show your partition table. Eg, heres mine:

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1012     1035245   83  Linux

Identify which partition it is which you want to make bootable. If, like me, you only have one, this task is trivial.

Type “a” to toggle the bootable flag, and it will ask you which partition number. This done, you can type “w” to write the changes and exit.

Building and copying the gPXE image

Simply enter the source directory (gpxe-*/src) and:

make bin/gpxe.lkrn

This creates a gPXE image which acts a bit like a linux kernel, meaning SYSLINUX will recognise it as its own.

Copy this to your mounted flash drive:

cp bin/gpxe.lkrn /media/disk/

Replace /media/disk/ with the appropriate path.

Installing SYSLINUX

Follow these steps if you are using a FAT16 or FAT32 partition

Now SYSLINUX will need a config file. Here's how you can make a really simple one. No menus or anything:

cat > /media/disk/syslinux.cfg << EOF
default gpxe
label gpxe
kernel /gpxe.lkrn

If you want anything more complex, see the SYSLINUX documentation.

Now that the config's done, you can unmount and install SYSLINUX on the partition. As root:

umount /dev/sdb1
syslinux -s /dev/sdb1

Replacing /dev/sdb1 with your partition.

Continue with the “Installing an MBR” section below.

Installing EXTLINUX

Follow these steps if you're using an ext2/3/4 or btrfs partition. ext4 and btrfs are only supported in EXTLINUX 4.0.0 and later

EXTLINUX requires a different filename for its config file compared to SYSLINUX. Generate a simple one like this:

cat > /media/disk/extlinux.conf << EOF
default gpxe
label gpxe
kernel /gpxe.lkrn

To install EXTLINUX, you don't even need to unmount the medium. As root, simply:

extlinux -i /media/disk/

Continue with the “Installing an MBR” section below.

Installing an MBR

You should have a SYSLINUX mbr.bin file somewhere on your system. For me, it was /usr/share/syslinux/mbr.bin You might be able to find yours using:

locate mbr.bin

As root, write this to your flash drive:

dd if=/usr/share/syslinux/mbr.bin of=/dev/sdb

And you're done! Now you should be able to boot gPXE from the memory stick.


* [[:start|Home]] * [[:about|About our Project]] * [[:download|Download]] * [[:screenshots|Screenshots]] * Documentation * [[:howtos|HowTo Guides]] * [[:appnotes|Application Notes]] * [[:faq:|FAQs]] * [[:doc|General Doc]] * [[:talks|Videos, Talks, and Papers]] * [[:hardwareissues|Hardware Issues]] * [[:mailinglists|Mailing lists]] * [[|Bugtracker]] * [[:contributing|Contributing]] * [[:editing_permission|Wiki Edit Permission]] * [[:wiki:syntax|Wiki Syntax]] * [[:contact|Contact]] * [[:relatedlinks|Related Links]] * [[:commerciallinks|Commercial Links]] * [[:acknowledgements|Acknowledgements]] * [[:logos|Logo Art]]

QR Code
QR Code syslinux (generated for current page)