First, I didn't succeed in building an EFI bootable AMD64 image of Debian, bootable in every situation (on a DVD or on a USB stick or...).
But as I wanted to succeed, I did going back to the fundamentals, and I found instructions for Repacking a Debian ISO with its original boot equipment
Adapting the contents to 2023's ISO, I was able to write and successfully test the following procedure.
For the example, I will modify Debian 11.6 AMD64 stable ISO. I will add in its /firmware
directory all firmware you can find on a Debian computer in /usr/lib/firmware
after installing the following 3 Debian packages: firmware-linux
firmware-linux-free
firmware-linux-nonfree
:
sudo apt install firmware-linux firmware-linux-free firmware-linux-nonfree
And after still for the example, I will repack the ISO, copying it on a USB key and successfully boot in legacy (MBR) and in UEFI mode
The image also work when burned on a DVD.
Make a root mkiso
directory:
mkdir /home/nba/mkiso
cd /home/nba/mkiso
wget https://cdimage.debian.org/debian-cd/current/amd64/iso-dvd/debian-11.6.0-amd64-DVD-1.iso
Extract source ISO:
mkdir deb
sudo apt install xorriso
xorriso -osirrox on -indev deb11.6-nba-amd64.iso -extract / ./deb
or
sudo apt install bsdtar
bsdtar -C ./deb -xf debian-11.6.0-amd64-DVD-1.iso
Add files / firmware. We want to add firmware to the ISO image:
sudo apt install firmware-linux firmware-linux-free firmware-linux-nonfree
mkdir -p /home/nba/mkiso/fw
cp -rf /usr/lib/firmware /home/nba/mkiso/fw/
Extract xorriso build command from source ISO:
cat deb/.disk/mkisofs
xorriso -as mkisofs -r -checksum_algorithm_iso sha256,sha512 -V 'Debian 11.6.0 amd64 1' -o /srv/cdbuilder.debian.org/dst/deb-cd/out/3bullseyeamd64/debian-11.6.0-amd64-DVD-1.iso -checksum-list /srv/cdbuilder.debian.org/src/deb-cd/tmp/3bullseyeamd64/bullseye/checksum-check -jigdo-checksum-algorithm md5 -jigdo-force-checksum /pool/ -jigdo-min-file-size 1024 -jigdo-exclude 'README*' -jigdo-exclude /doc/ -jigdo-exclude /md5sum.txt -jigdo-exclude /.disk/ -jigdo-exclude /pics/ -jigdo-exclude 'Release*' -jigdo-exclude 'Packages*' -jigdo-exclude 'Sources*' -jigdo-jigdo /srv/cdbuilder.debian.org/dst/deb-cd/out/3bullseyeamd64/debian-11.6.0-amd64-DVD-1.jigdo -jigdo-template /srv/cdbuilder.debian.org/dst/deb-cd/out/3bullseyeamd64/debian-11.6.0-amd64-DVD-1.template -jigdo-map Debian=/srv/cdbuilder.debian.org/src/ftp/debian/ -jigdo-exclude boot1 -J -joliet-long -cache-inodes -isohybrid-mbr syslinux/usr/lib/ISOLINUX/isohdpfx.bin -b isolinux/isolinux.bin -c isolinux/boot.cat -boot-load-size 4 -boot-info-table -no-emul-boot -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat -isohybrid-apm-hfsplus boot1 CD1
Modify xorriso build command (remove -jidgo options + related checksum...):
xorriso -as mkisofs -r -V 'deb11.6-nba-amd64' -o ./deb11.6-nba-amd64.iso -J -joliet-long -cache-inodes -isohybrid-mbr ./isohdpfx.bin -b isolinux/isolinux.bin -c isolinux/boot.cat -boot-load-size 4 -boot-info-table -no-emul-boot -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat -isohybrid-apm-hfsplus deb fw
Generate MBR by extracting first 432 bytes from source ISO:
cd /home/nba/mkiso
dd if=debian-11.6.0-amd64-DVD-1.iso of=isohdpfx.bin bs=1 count=432
Build new iso (adding deb/
and fw/firmware
to the ISO):
xorriso -as mkisofs -r -V 'deb11.6-nba-amd64' -o ./deb11.6-nba-amd64.iso -J -joliet-long -cache-inodes -isohybrid-mbr ./isohdpfx.bin -b isolinux/isolinux.bin -c isolinux/boot.cat -boot-load-size 4 -boot-info-table -no-emul-boot -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat -isohybrid-apm-hfsplus deb fw
Verify by extracting the newly created ISO:
mkdir /home/nba/mkiso/deb2
cd /home/nba/mkiso/
xorriso -osirrox on -indev deb11.6-nba-amd64.iso -extract / deb2
Verify firmware are present in /home/nba/mkiso/deb2/firmware
:
ls /home/nba/mkiso/deb2/firmware
Test boot: use xorriso -report_system_area
options on source ISO and on new ISO and compare:
xorriso -indev debian-11.6.0-amd64-DVD-1.iso -report_system_area as_mkisofs
xorriso -indev deb11.6-nba-amd64.iso -report_system_area as_mkisofs
Verify you have line:
-isohybrid-mbr --interval:local_fs:0s-15s:zero_mbrpt,zero_gpt,zero_apm:'deb11.6-nba-amd64.iso'
and lines:
-eltorito-alt-boot
-e '/boot/grub/efi.img'
-no-emul-boot
Copy to USB key and try to boot:
sudo dd if=deb11.6-nba-amd64.iso of=/dev/sda bs=256M status=progress
Reboot on key !
Please note :
- It boot on a USB stick
- It work when dd copy on an hard drive and try to boot on this drive
- I also burn the ISO on a DVD and it was also bootable
- I also try to boot on the ISO file directly from an hypervisor, and it was - working and booting
All that for say that my repacked ISO image was bootable in every situation (MBR and UEFI on all supports) like the original Debian ISO image.