Sample Header Ad - 728x90

Add UEFI boot capability to a BIOS only Ubuntu 18.04 based custom iso

0 votes
1 answer
1048 views
I am trying to add UEFI boot capability to a BIOS only Ubuntu 18.04 based custom iso. All the methods I've found so far require an efi.img file which isn't present in the iso. Can I use the file out of a full install Ubuntu 18.04? If yes, do I need to edit it? If not, how can I construct an efi.img file? The custom iso is designed to run from a USB, not installed. It is also intended for distribution to new Linux users. Adding UEFI capabilities to the USB rather than the iso isn't the solution we're looking for. This is the script that I used to build the fat partition. It is run in the folder containing the extracted iso: #! /bin/sh BOOT_IMG_DATA="$PWD" BOOT_IMG=efi.img #Ensure needed folders exist if [ ! -d "$BOOT_IMG_DATA"/efi/boot ]; then mkdir -p "$BOOT_IMG_DATA"/efi/boot fi if [ ! -d "$BOOT_IMG_DATA"/boot/grub ]; then mkdir -p "$BOOT_IMG_DATA"/boot/grub fi chmod -R +rw "$BOOT_IMG_DATA"/boot/grub chmod -R +rw "$BOOT_IMG_DATA"/efi/boot # Create the 64-bit EFI GRUB binary (bootx64.efi) and the El-Torito boot # image (efiboot.img) that goes in the /isolinux directory for booting on # UEFI systems. # First, build bootx64.efi, which will be installed here in /EFI/BOOT: grub-mkimage --format=x86_64-efi --output=bootx64.efi --config=grub.cfg --compression=xz --prefix=/EFI/BOOT part_gpt part_msdos fat ext2 hfs hfsplus iso9660 udf ufs1 ufs2 zfs chain linux boot appleldr ahci configfile normal regexp minicmd reboot halt search search_fs_file search_fs_uuid search_label gfxterm gfxmenu efi_gop efi_uga all_video loadbios gzio echo true probe loadenv bitmap_scale font cat help ls png jpeg tga test at_keyboard usb_keyboard # Then, create a FAT formatted image that contains bootx64.efi in the # /EFI/BOOT directory. This is used to bootstrap GRUB from the ISO image. dd if=/dev/zero of=efiboot.img bs=1K count=1440 # Format the image as FAT12: mkdosfs -F 12 efiboot.img # Create a temporary mount point: MOUNTPOINT=$(mktemp -d) # Mount the image there: mount -o loop efiboot.img $MOUNTPOINT # Copy the GRUB binary to /EFI/BOOT: mkdir -p $MOUNTPOINT/EFI/BOOT cp -a bootx64.efi -s $MOUNTPOINT/EFI/BOOT # Unmount and clean up: umount $MOUNTPOINT rmdir $MOUNTPOINT # Move the efiboot.img to isolinux: mv efiboot.img isolinux mv bootx64.efi efi/boot echo echo "Done building /EFI/BOOT/bootx64.efi and /isolinux/efiboot.img." This is the script I use to build the iso: #!/bin/bash # The example names get mapped to their roles here orig_iso="$HOME"/foxclone/foxclone025-01.iso new_iso="$HOME"/foxclone/foxclone025-02.iso new_files="$PWD" mbr_template=isohdpfx.bin # Extract MBR template file to disk dd if="$orig_iso" bs=1 count=432 of="$mbr_template" # Create the new ISO image xorriso -as mkisofs \ -U \ -allow-lowercase \ -r -V 'foxclone025-02' \ -o "$new_iso" \ -J -J -joliet-long \ -isohybrid-mbr "$mbr_template" \ -c isolinux/boot.cat \ -b isolinux/isolinux.bin \ -no-emul-boot -boot-load-size 4 -boot-info-table \ -eltorito-alt-boot \ -e isolinux/efiboot.img \ -no-emul-boot \ -isohybrid-gpt-basdat \ "$new_files" Does anyone see a problem in the code? I really appreciate a different set of eyes looking at this as I think I've gotten "too close to the forest to see the trees". TIA, Larry
Asked by larry78723 (21 rep)
Jan 12, 2020, 12:59 AM
Last activity: Sep 29, 2022, 12:05 PM