bug-xorriso
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-xorriso] creating bootable .ISO with multiple methods


From: Thomas Schmitt
Subject: Re: [Bug-xorriso] creating bootable .ISO with multiple methods
Date: Fri, 10 Apr 2015 21:56:28 +0200

Hi,

>   https://gist.github.com/cbrune/aae2a7a46f7c2c7fd804

Ah. Some unique xorriso features being used.
This pleases my developer heart.


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.


> 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.)


> # 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.

(Does mkdosfs create a FAT32, as prescribed by UEFI ?
 Shouldn't there be a -F 32 for clarity ?)


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.

True ? (wink)


(Is "grub-mkimage ... search" the trick which lets BOOTX64.EFI
 find its stuff in the ISO, although it booted from the FAT ?)


------------------------------------------------------------

Some nitpicking about the xorriso commands:

> -find /boot -name efi.img -exec report_lba ...

If you want to inquire exactly the data file /boot/efi.img
you may also use its path as -find starting point. This is
less ambiguous, in case /boot has subdirectories.
Better put a separator '--' after the end of -find arguments.
Just in case anybody ever wants to add more xorriso commands.

  -find /boot/efi.img -exec report_lba --

> https://gist.github.com/cbrune/7efd35a5ef0c4e001401
> boot_image any system_area=embedded.img
> boot_image any next 

Although it does not harm, the command "boot_image any next"
is not needed because system_area= has global effect on
the emerging ISO. There can only be one System Area and
it is not governed by El Torito, for which "any next"
is the marker to start a new boot catalog entry.

Same with
> # Boot catalog file 
> boot_image any cat_path=/boot/boot.cat  

This is the thing which contains the various boot image
entries. "any next" separates the parameter lists of
the items in there.

(I have to confess that the command -boot_image evolved to
 nothing better than the traditional -as mkisofs options.
 I ponder about a description language which is a bit
 more regular and allows to express things which i do not
 think of myself. But it is such a wide and messy field.)

------------------------------------------------------------

> 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.

(Vladimir and i discussed combined BIOS and EFI, when we
 made xorriso ready for GRUB2's new needs. So there must
 be a way to get grub-mkrescue to do it.)


Have a nice day :)

Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]