Merge lp:~mwhudson/debian-cd/half-the-grubs into lp:~ubuntu-cdimage/debian-cd/ubun3

Proposed by Michael Hudson-Doyle
Status: Merged
Merged at revision: 2080
Proposed branch: lp:~mwhudson/debian-cd/half-the-grubs
Merge into: lp:~ubuntu-cdimage/debian-cd/ubun3
Prerequisite: lp:~mwhudson/debian-cd/document-xorriso-options
Diff against target: 70 lines (+22/-25)
1 file modified
tools/boot/groovy/boot-amd64 (+22/-25)
To merge this branch: bzr merge lp:~mwhudson/debian-cd/half-the-grubs
Reviewer Review Type Date Requested Status
Steve Langasek Approve
Paride Legovini (community) Needs Fixing
Review via email:

Description of the change

go back to two copies of grub on the ISO, not four

Staring hard at the previous command line and some experimentation got me there
in the end. Read the comments for more explanation.

To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) :
Revision history for this message
Michael Hudson-Doyle (mwhudson) :
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :


Revision history for this message
Paride Legovini (paride) wrote :

Two inline comments, of which one I think it's an actual thing to fix.

review: Needs Fixing
Revision history for this message
Paride Legovini (paride) wrote :

The static validation of the Groovy images is currently failing because UTAH is unable to find the EFI files, but the images themselves work. I'd prefer to see this MP land before working on UTAH to avoid fixing it twice :)

The ISO testing jobs are currently only testing the images booting them in cdrom mode (both bios and uefi). I'd like to add jobs to also test the "boot as disk" path at some point, as that's certainly the most common scenario nowadays.

2082. By Michael Hudson-Doyle

review feedback

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Thanks for the review! I'd like this to land soon too :/

Revision history for this message
Steve Langasek (vorlon) wrote :

We'll have to subject this to testing to figure out in the end if it's correct.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tools/boot/groovy/boot-amd64'
2--- tools/boot/groovy/boot-amd64 2020-09-10 23:09:52 +0000
3+++ tools/boot/groovy/boot-amd64 2020-09-10 23:09:53 +0000
4@@ -36,14 +36,11 @@
5 mkdir cd-boot-images
6 $BASEDIR/tools/apt-selection download cd-boot-images-amd64
7 dpkg --fsys-tarfile cd-boot-images-amd64*_all.deb | tar xf - -C cd-boot-images
9-# --efi-boot -efi-boot-part --efi-boot-image seem to generate broken
10-# .iso, specifically despite -partition_offset 16, the first partition
11-# is mountable, but results in I/O errors without anything
12-# readable. Thus use just append_partition syntax to add ESP & -e
13-# "more rawly" way to specify ESP.
15-# TODO test if --efi-boot-image can be used instead of -e
16+# we should add isohdpfx.bin to cd-boot-images and then the next three lines
17+# will not be needed.
18+mkdir syslinux
19+$BASEDIR/tools/apt-selection download isolinux
20+dpkg --fsys-tarfile isolinux*_all.deb | tar xf - -C syslinux ./usr/lib
22 mkisofs_opts ()
23 {
24@@ -77,11 +74,15 @@
26 # The bootloader to write to the MBR for legacy-disk boot.
27 #
28-# Another approach is to use the very small isohdpfx.bin from isolinux
29-# and -isohybrid-mbr to boot from a disk (isohdpfx.bin just jumps to
30-# the legacy el torito boot block set up above) but this didn't work
31-# when mwhudson tested it in July 2020.
32-mkisofs_opts --grub2-mbr cd-boot-images/usr/share/cd-boot-images-amd64/tree/boot/grub/i386-pc/boot_hybrid.img
33+# We use the very small isohdpfx.bin from isolinux and -isohybrid-mbr
34+# to boot from a disk which just jumps to the legacy el torito boot
35+# block set up above.
37+# We also needs -isohybrid-mbr to have the -isohybrid-gpt-basdat below
38+# to have any effect. Newer xorriso supports a "-part_like_isohybrid"
39+# option which makes -isohybrid-gpt-basdat work without -isohybrid-mbr
40+# but it's not in the xorriso in Xenial.
41+mkisofs_opts -isohybrid-mbr syslinux/usr/lib/ISOLINUX/isohdpfx.bin
43 ## Set up the mkisofs options for UEFI boot.
45@@ -99,18 +100,14 @@
47 # Add an ESP for uefi-disk boot.
48 #
49-# This is a very by hand way of doing it: it is possible to create a
50-# partition table that points to the FAT filesystem above that will be
51-# used by the uefi-cdrom boot. But it seems this leads to xorriso
52-# creating a GPT that does not work; instead of creating a GPT with
53-# overlapping partitions (which is not allowed by the spec) like so:
54-# | partition 1 / p1 |
55-# | ESP |
56-# it splits the "main" partition so the partitions look like this:
57-# | p1 | ESP | p3 |
58-# which doesn't work at all when we mount p1 (it doesn't contain all
59-# the files!)
60-mkisofs_opts -append_partition 2 0xef cd-boot-images/usr/share/cd-boot-images-amd64/tree/boot/grub/efi.img
61+# This isn't what this command is documented to do (which is "Mark El
62+# Torito boot image as Basic Data in GPT") but the effect of it is to
63+# create an invalid (!) GPT and a MBR with two partitions, one of type
64+# 0 covering the whole ISO and one of type 0xef (i.e. ESP) pointing at
65+# the boot/grub/efi.img specified above, which perhaps more by luck
66+# than judgement allows the ISO to boot when used as a disk in an UEFI
67+# system.
68+mkisofs_opts -isohybrid-gpt-basdat
70 ## Create a partition table entry that covers the iso9660 filesystem.


People subscribed via source and target branches