[TECHNICAL!]Manually build a bootable live ISO with UEFI support

Post your tutorials and howtos here.
User avatar
Arjen Balfoort
Site Admin
Posts: 8860
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

[TECHNICAL!]Manually build a bootable live ISO with UEFI support

Postby Arjen Balfoort » 29 May 2016 20:32

This article assumes you know how to create the squashfs files needed for the live ISO.
This article only describes how to build a bootable ISO for both BIOS and UEFI machines and can be booted from CD, DVD, BR and USB.

Create a new directory called my_iso and within the following structure:

Directory structure and most important files:

Code: Select all

/boot/
  .solydxk
  |_boot/
    |_grub/
      grub.cfg
      ...
  |_isolinux/
    efiboot.img
    isolinux.cfg
    ...
  |_live/
    filesystem.packages
    filesystem.packages-remove
    filesystem.squashfs
    initrd.img
    vmlinuz
/EFI/
  |_BOOT/
    bootx64.efi
/root/
  |_This is the chroot environment of the OS (as created by the SolydXK Constructor)
Note: the EFI/BOOT directory is placed outside the /boot directory and is not part of the ISO as such. The EFI/BOOT directory and its contents is embedded in the efiboot.img file later on.

Packages:

Code: Select all

sudo apt-get install xorriso isomd5sum dosfstools mtools
Create embedded.cfg

Code: Select all

search --file --set=root /.solydxk
if [ -e ($root)/boot/grub/grub.cfg ]; then
    set prefix=($root)/boot/grub
    configfile $prefix/grub.cfg
else
    echo "Could not find /boot/grub/grub.cfg!"
fi
Generate bootx64.efi:

Code: Select all

grub-mkimage --prefix '' --config 'embedded.cfg' -O x86_64-efi -o './my_iso/EFI/BOOT/bootx64.efi' part_gpt part_msdos ntfs ntfscomp hfsplus fat ext2 normal chain boot configfile linux multiboot iso9660 gfxmenu gfxterm loadenv efi_gop efi_uga loadbios fixvideo png ext2 ntfscomp loopback search minicmd cat cpuid appleldr elf usb videotest halt help ls reboot echo test normal sleep memdisk tar font video_fb video gettext true  video_bochs video_cirrus multiboot2 acpi gfxterm_background gfxterm_menu
Note: the --prefix is left empty because that is handled by the embedded.cfg. You cannot omit it, though. grub-mkimage will throw an error.

Generate efiboot.img:

Code: Select all

rm ./my_iso/boot/isolinux/efiboot.img
mkdosfs -F12 -n "SOLYDXK_EFI" -C ./my_iso/boot/isolinux/efiboot.img 2048
mcopy -s -i ./my_iso/boot/isolinux/efiboot.img ./my_iso/EFI ::
Note: change the value of the -n parameter accordingly.

Check with:

Code: Select all

mount ./my_iso/boot/isolinux/efiboot.img /mnt
ls /mnt
which should list the EFI/BOOT/bootx64.efi file.

Code: Select all

umount /mnt
Create Grub reference file:

Code: Select all

touch ./my_iso/boot/.solydxk
Build ISO:

Code: Select all

xorriso -as mkisofs -r -V 'SolydK 8 64-bit' -o './my_iso/solydk_8_64_201605.iso' -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -partition_offset 16 -J -l -joliet-long -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 ./my_iso/boot
Note: change the values of the -V parameter accordingly.

Implant md5:

Code: Select all

implantisomd5 ./my_iso/solydk_8_64_201605.iso
You can check the ISO/md5 with:

Code: Select all

checkisomd5 ./my_iso/solydk_8_64_201605.iso
With this solution (using a fat formatted image file) you can dd the ISO to an ext4 formatted USB and it would still boot:

Code: Select all

sudo dd if=solydk_8_64_201605.iso of=/dev/sdb bs=4M && sync
Note: replace /dev/sdb with your the device path of your USB.

[EDIT]
As of May 30, 2016 the nightly builds were constructed this way: http://downloads.solydxk.nl/nightly/
The new SolydXK Constructor (version 2.7.2) has these changes implemented.
You can find the source of the SolydXK Constructor on Github.


SolydXK needs you!
Development | Testing | Translations

Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 1 guest