6

Suppose you have an iso image that contains a bios bootable partition. You can write this image to a usb disk

In linux you could do this for example with

dd if=pmagic_2013_02_28.iso of/dev/sdc1

Your USB disk is now bootable on computers with bios. However on my UEFI system, the usb disk does not boot. How can you make it EFI bootable?

1

3 Answers 3

1

Some magic of El Torito is required when creating the iso image. See this.

0

For the image to be (U)EFI bootable, it needs to have a primary VFAT32 partition containing the initramfs image file to be booted under the path /efi/boot/bootx64.efi.

0

I guess your only chance is to rebuild the ISO image and add the UEFI files needed for it. With xorriso you can do that.

First, extract the contents of the original ISO file:

xorriso -osirrox on -indev IMAGE.ISO -extract / ISO_DIR

Then you need to create the ESP (EFI System Partition), which has to be a FAT partition. We will create a file that contains such partition:

BOOT_IMG=efi.img

grub-mkimage \
    -C xz \
    -O x86_64-efi \
    -p /boot/grub \
    -o bootx64.efi \
    boot linux normal configfile \
    part_gpt btrfs fat iso9660 loopback \
    test keystatus gfxmenu regexp \
    efi_gop efi_uga all_video gfxterm font \
    echo read ls cat png jpeg halt

mkfs.vfat -C $BOOT_IMG \
    $(( ($(stat -c %s bootx64.efi) / 1024 + 511) / 32 * 32 ))

mmd -i $BOOT_IMG ::/efi
mmd -i $BOOT_IMG ::/efi/boot
mmd -i $BOOT_IMG ::/boot
mmd -i $BOOT_IMG ::/boot/grub

mcopy -Q -i $BOOT_IMG bootx64.efi ::/efi/boot

# You may create a grub.cfg file if you want.
[ -f grub.cfg ] &&
    mcopy -Q -i $BOOT_IMG grub.cfg ::/boot/grub

Once the ESP is generated, you can build a UEFI bootable ISO image with:

xorriso -as mkisofs \
    -r -J -l \
    -iso-level 3 \
    -joliet-long \
    -append_partition 2 0xef $BOOT_IMG \
    -partition_cyl_align all \
    -o uefi-bootable.iso \
    ISO_DIR

Your ISO image will be created as uefi-bootable.iso in your current directory.


You can read these resources about bootable ISO images:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .