bug-xorriso
[Top][All Lists]
Advanced

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

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


From: Curt Brune
Subject: [Bug-xorriso] creating bootable .ISO with multiple methods
Date: Thu, 9 Apr 2015 10:25:42 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

Hello,

Long time user, first time poster.  Tip of the hat to all who have
come before and apologies for dumb questions...

The landscape:

I am trying to create a .ISO for a x86 Linux distribution that is bootable
for legacy BIOS and UEFI environments.  The image should boot as both
a CD-ROM image and a hard disk image.  To avoid ambiguous terminology,
I illustrate my requirements using 4 QEMU examples.

The following QEMU examples should work:

  $ qemu -cdrom  linux-amd64.iso                 <-- legacy BIOS
  $ qemu -hda    linux-amd64.iso                 <-- legacy BIOS
  $ qemu -hda    linux-amd64.iso -bios OVMF.fd   <-- UEFI
  $ qemu -cdrom  linux-amd64.iso -bios OVMF.fd   <-- UEFI

More requirements:

 - only use GRUB2, no SYSLINUX.  A bit arbitrary, but that's what I want.
 - should not have to use 'sudo' to create the image

The good news is I have managed to do it, but am wondering about
alternatives.

The two CD-ROM scenarios were straight forward using xorriso.

The UEFI hard disk scenario was also straight forward using xorriso
with the "efi_boot_part=--efi-boot-image" option.  That creates a GPT
with one partition pointing at the EFI ESP.

With GPT in place, however, it was difficult to add support for the
legacy BIOS hard disk boot.  That requires a bit of MBR work plus
storing the core.img in a "BIOS boot partition".  I could not find a
method to do this that did not require using 'sudo'.  My attempts
followed the methods described here:

  
http://lukeluo.blogspot.com/2013/06/grub-how-to-5-ubuntu-distributition-iso.html
  [ near the bottom, using grub-bios-setup ]

I looked at the grub-bios-setup source code and it looks like that
code does a number of "fix ups" on the images before writing them to
disk.  Looked non-trivial.

So I stepped back and used xorriso to instead add a GRUB2 disk image
in the system_area.  Then using sfdisk, I created a MBR partition
table that contained a partition entry of type 0xef pointing to the
EFI ESP.

So the resulting .ISO has *no* GPT, only a MBR partition table.
Fortunately the UEFI spec requires that firmware support the MBR
format.  And the resulting image works in all four scenarios.

My question is "is there a better way?"  Is there a "pure xorriso" way
of doing it without using sfdisk?

Alternatively, sticking with the GPT approach, is there a xorriso way
to update the MBR and add the GRUB2 core.img to the "BIOS boot
partition" (including fix-ups)?  This would simulate what
grub-setup-bios does, but without requiring sudo.

That got me thinking perhaps a new bootspec for the -boot_image
option?  Or maybe it exists already and I missed it?

Cheers,
Curt



reply via email to

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