# First we'll clone iPXE
$ git clone git://git.ipxe.org/ipxe.git
# Go into the src directory of the cloned git repo
$ cd ipxe/src
# Compile the UEFI iPXE executable
$ make bin-x86_64-efi/ipxe.efi
# First we'll wipe the USB drive (THIS WILL DESTROY ALL DATA)
$ sudo dd if=/dev/zero of=/dev/sdxY bs=512 count=1
# Then we'll partition the drive
$ sudo cfdisk /dev/sdxY
# cfdisk will ask you what type of partition table you want, select GPT
- Make a partition at least
512M
in size. - Switch the type from
Linux Filesystem
toEFI system
. - Write these changes to the USB drive and quit.
# First we'll format it FAT32
$ sudo mkfs.fat -F32 /dev/sdxY
# Now we'll make a directory to mount the USB drive in
$ mkdir /tmp/efidrive
# Now we can mount the USB drive
$ sudo mount /dev/sdxY /tmp/efidrive
# Assuming you're still in the ipxe/src directory
# Make the necessary efi/boot directory in the USB drive
$ sudo mkdir -p /tmp/efidrive/efi/boot
# copy the executable and rename it to bootx64.efi to conform to the UEFI standard
$ sudo cp bin-x86_64-efi/ipxe.efi /tmp/efidrive/efi/boot/bootx64.efi
# unmount the drive
$ sudo umount /tmp/efidrive
That's it! You should now have a UEFI-bootable USB drive with the UEFI ipxe binary!
Yes, apparently this 5 year old gist has finally been replaced by upstream code in Jan 2021. See
src/util/genfsimg
.https://github.com/ipxe/ipxe/blob/master/src/util/genfsimg
They use
mcopy
for making USB images (with FAT filesystems) and look for one ofgenisoimage mkisofs xorrisofs
, so exactly what we've been doing here.[edit]
I take it back, there was a
src/util/genefidsk
that was commited in 2015.So the only value in this gist are the comments showing how it's done with out compiling from source, requiring only
curl
andmcopy
.