Getting FOS on a bootable ISO image
-
@mechalas Just figured that iPXE can build an ISO for UEFI just as well as for legacy BIOS systems.
So following our wiki entry on iPXE compilation and using this build command should be all you need to do:
UEFI:
make bin-x86_64-efi/ipxe.iso EMBED=ipxescript
legacy BIOS:make bin/ipxe.iso EMBED=ipxescript
(though not in the same source directory as it needs different headers - carefully read the wiki!) -
@sebastian-roth I will give this a shot. Thank you!
-
So these instructions build iPXE, and I presume the idea is to chain load the FOG image from the server?
I am not sure if that will help me. What I really need is to be able to boot FOS directly from an iso. I am leery of involving PXE in the process at all.
-
@mechalas said in Getting FOS on a bootable ISO image:
@sebastian-roth UEFI boot
UEFI is pretty simple to boot. I have a few tutorial depending on where you want to jump into the process.
I think the simpliest one for uefi is this: https://forums.fogproject.org/topic/6350/usb-boot-uefi-client-into-fog-menu-easy-way
If you want to boot right into fos linux with some of the limitations of the process: https://forums.fogproject.org/topic/7727/building-usb-booting-fos-image
-
@mechalas said in Getting FOS on a bootable ISO image:
So these instructions build iPXE, and I presume the idea is to chain load the FOG image from the server?
I am not sure if that will help me. What I really need is to be able to boot FOS directly from an iso. I am leery of involving PXE in the process at all.Yes and no. While loading iPXE from the ISO is skipping some major part of PXE booting it would still need the DHCP server to hand out PXE information (at least option 66 - next server) for iPXE to be able to pull the next file via TFTP.
Well then it’s going to be the more complicated way of building an ISO with GRUB and FOS kernel&init. Will provide further information on that soon.
-
@sebastian-roth I did give this a shot on one of our problem systems. It had a 25% success rate, meaning it took four tries before it worked. The first three tries, it hung at “iPXE Initializing devices” and had to be power-cycled (which, thankfully, I can do remotely). The fourth time it worked, which is the first time this system has ever successfully PXE booted.
-
@mechalas After playing with this stuff for a bit I came up with two different ways to create an UEFI bootable FOS ISO.
Using grub-mkrescue:
Hint: For this to work you need an UEFI based 64 bit Linux system that you can use to create the ISO. If you try this on a BIOS machine or 32 bit system it will still build the ISO for you but it might not boot on 64 bit UEFI systems.sudo -i apt install grub-efi-amd64-bin mtools xorriso mkisofs mkdir -p iso/boot/grub cp /var/www/html/fog/service/ipxe/bzImage iso/boot/ cp /var/www/html/fog/service/ipxe/init.xz iso/boot/ vi iso/boot/grub/grub.cfg grub-mkrescue -o fos-x86_64-efi.iso iso/
Insert whatever
grub.cfg
you want. For example use the one @george1421 posted in his tutorial on USB booting. Be aware that you definitely need to use the kernel parameterboottype=usb
to make it pull the parameters that iPXE would receive and pass on through the dynamic boot instructions generated.Using grub-mkstandalone and xorriso manually:
sudo -i apt install grub-efi-amd64-bin mtools xorriso mkisofs mkdir -p iso/boot/grub/ mkdir -p iso/EFI/BOOT/ cp /var/www/html/fog/service/ipxe/bzImage iso/boot/ cp /var/www/html/fog/service/ipxe/init.xz iso/boot/ vi iso/boot/grub/grub.cfg grub-mkstandalone -o iso/EFI/BOOT/BOOTX64.EFI -O x86_64-efi "boot/grub/grub.cfg=iso/boot/grub/grub.cfg" dd if=/dev/zero of=iso/EFI/BOOT/efiboot.img bs=1M count=10 mkfs.msdos -F 12 -n 'EFIBOOTISO' iso/EFI/BOOT/efiboot.img mmd -i iso/EFI/BOOT/efiboot.img ::EFI mmd -i iso/EFI/BOOT/efiboot.img ::EFI/BOOT mcopy -i iso/EFI/BOOT/efiboot.img iso/EFI/BOOT/BOOTX64.EFI ::EFI/BOOT/BOOTX64.EFI cd iso xorriso -as mkisofs -V 'FOGPROJECT' -e EFI/BOOT/efiboot.img -no-emul-boot -o ../fos-x86_64-efi.iso .
Same here, use the
grub.cfg
file George provided in his tutorial. But you need to add those two lines at the start for George’s config example to work in this setup:set root=(cd0) set prefix=(memdisk)/boot/grub
Every time you change the contents of
grub.cfg
you need to run all the commands starting fromgrub-mkstandalone
again.Resouces used:
https://willhaley.com/blog/custom-debian-live-environment-grub-only/
https://github.com/syzdek/efibootiso
https://github.com/linuxkit/linuxkit/blob/master/tools/mkimage-iso-efi/make-efi
https://unix.stackexchange.com/a/611846 -
@sebastian-roth Thank you! This looks promising. I will give it a shot on Monday.
-
@sebastian-roth I used the grub-mkrescue method and it worked on the first attempt! This is very encouraging, and I am going to ask our lab tech to try this on the other problem systems.
I cannot thank you enough for your help.
-
@mechalas You are welcome.
From what I have seen in the verbose output of grub-mkrescue (just add
-v
as command line option) the ISO created might even boot on legacy BIOS systems as well. Not exactly sure though. -
@sebastian-roth as you suspected, this ISO image did boot both legacy and EFI. Which has been a boon.
I have used this ISO four times this week, and it has been a huge time-saver.