[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-xorriso] creating bootable .ISO with multiple methods
From: |
Curt Brune |
Subject: |
Re: [Bug-xorriso] creating bootable .ISO with multiple methods |
Date: |
Fri, 10 Apr 2015 14:13:01 -0700 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri Apr 10 21:56, Thomas Schmitt wrote:
> Hi,
>
> > https://gist.github.com/cbrune/aae2a7a46f7c2c7fd804
>
> Ah. Some unique xorriso features being used.
> This pleases my developer heart.
Cheers.
>
> Correct me if i got the following wrong:
>
> > # Populate .ISO sysroot with x86_64-efi GRUB modules
> > mkdir -p $RECOVERY_ISO_SYSROOT/boot/grub/x86_64-efi
> > (cd $GRUB_HOST_LIB_UEFI_DIR && cp *mod *lst
> > $RECOVERY_ISO_SYSROOT/boot/grub/x86_64-efi)
>
> Above stuff goes to the ISO outside the ESP, i understand.
>
Correct.
>
> > RECOVERY_EFI_DIR="$RECOVERY_DIR/EFI"
> > RECOVERY_EFI_BOOT_DIR="$RECOVERY_EFI_DIR/BOOT"
> > RECOVERY_EFI_BOOTX86_IMG="$RECOVERY_EFI_BOOT_DIR/bootx64.efi"
> > ...
> > RECOVERY_UEFI_IMG="$RECOVERY_ISO_SYSROOT/boot/efi.img"
> > ...
> > # Generate UEFI format GRUB image
> > mkdir -p $RECOVERY_EFI_BOOT_DIR
> > $GRUB_HOST_BIN_UEFI_DIR/grub-mkimage \
> > --format=x86_64-efi \
> > --directory=$GRUB_HOST_LIB_UEFI_DIR \
> > --prefix=/boot/grub \
> > --config=$RECOVERY_CONF_DIR/grub-uefi.cfg \
> > --output=$RECOVERY_EFI_BOOTX86_IMG \
> > part_msdos part_gpt fat iso9660 search
>
> This produces the UEFI Image file which is to be executed
> by EFI as the first custom stage of booting.
> (Not to be confused with image of the FAT filesystem which
> is wrapped around the various UEFI Images and their helpers.)
>
Yep.
>
> > # For UEFI the GRUB image is embedded inside a UEFI ESP (fat16) disk
> > # partition image. Create that here and copy GRUB UEFI image into it.
> >
> > dd if=/dev/zero of=$RECOVERY_UEFI_IMG bs=512 count=$(( 32 * 13 ))
> > mkdosfs $RECOVERY_UEFI_IMG
> > mcopy -s -i $RECOVERY_UEFI_IMG $RECOVERY_EFI_DIR '::/'
>
> I cannot find option -i in my man mcopy. But i guess that
> this copies the UEFI Image file to /boot/efi/bootx64.efi
> in the formerly empty FAT filesystem .../boot/efi.img.
Indeed. I lifted that bit from grub/util/grub-mkrescue.c
>
> (Does mkdosfs create a FAT32, as prescribed by UEFI ?
> Shouldn't there be a -F 32 for clarity ?)
Perhaps. Reading section 12.3 of the UEFI spec says:
EFI encompasses the use of FAT32 for a system partition, and FAT12
or FAT16 for removable media.
Looking at my build products I have a FAT12. It could easily be made
FAT32.
>
> So do i get it right that /boot/efi.img only contains one
> single data file \EFI\BOOT\BOOTX64.EFI (to say it in DOS
> for once).
> And this file is able to boot up GRUB2 so that it finds its
> modules and configuration in /boot/grub of the ISO image
> outside the ESP.
>
Yes.
> (Is "grub-mkimage ... search" the trick which lets BOOTX64.EFI
> find its stuff in the ISO, although it booted from the FAT ?)
Yes! And took me a while to figure out. The embedded grub.cfg (not
included in the gist) looks like this:
search.fs_label RECOVERY root
set prefix=($root)/boot/grub
>
> ------------------------------------------------------------
>
> Some nitpicking about the xorriso commands:
>
Thanks for the tips. I will clean up my configuration.
>
> ------------------------------------------------------------
>
> > Sorry, I did not use grub-mkrescue.
> > Note I am building grub2 from source -- twice, once for i386-pc and
> > again for x86_64-efi.
>
> I read
> http://wiki.osdev.org/GRUB_2#Grub_for_EFI
> and wonder whether the example
>
> ./configure --with-platform=efi --target=x86_64
>
> could be extended to
>
> ./configure --with-platform=efi --with-platform=i386-pc --target=x86_64
>
> in order to prepare for grub-mkrescue.
I wondered the same thing, or a syntax like
--with-platform=efi,i386-pc
If *both* platform library products were available to grub-mkrescue it
should be able to "do the right thing".
Cheers,
Curt