From 61f1b20a5ab1b0318e1f4f8d8b378f908aefa7c0 Mon Sep 17 00:00:00 2001 From: Simon Poirier Date: Wed, 17 Jul 2024 10:31:59 -0400 Subject: [PATCH] disk-image-uefi.binary: shift down boot number to 13 Support some systems which don't handle partition numbers higher than 15. (LP: #2072929) Partition 16 was added for /boot to enable cloud FDE (commit a8b2a9b01) --- live-build/functions | 7 +++++-- .../ubuntu-cpc/hooks.d/base/disk-image-uefi.binary | 14 +++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/live-build/functions b/live-build/functions index 7dc688b8..912804ac 100644 --- a/live-build/functions +++ b/live-build/functions @@ -237,10 +237,13 @@ mount_disk_image() { mount_image ${disk_image} "${rootpart}" mount_partition "${rootfs_dev_mapper}" $mountpoint - local boot_dev="${loop_device}p16" + local boot_dev="${loop_device}p13" if flock -x ${loop_device} \ [ -b ${boot_dev} -a -e $mountpoint/boot ]; then - flock -x ${loop_device} mount "${boot_dev}" $mountpoint/boot + # Only mount if assumed boot_dev is XBOOTLDR type + if sgdisk -i13 "${loop_device}" | grep -i BC13C2FF-59E6-4262-A352-B275FD6F7172 ; then + flock -x ${loop_device} mount "${boot_dev}" $mountpoint/boot + fi fi # Having one partition mounted should avoid udev-triggered partition diff --git a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary index d4ec5f0c..bcb18acf 100755 --- a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary @@ -37,28 +37,28 @@ create_partitions() { case $ARCH in arm64|armhf) sgdisk "${disk_image}" \ + --new=13::1G \ + --typecode=13:ea00 \ --new=15:0:204800 \ --typecode=15:ef00 \ - --new=16::1G \ - --typecode=16:ea00 \ --new=1: ;; riscv64) sgdisk "${disk_image}" \ --set-alignment=2 \ + --new=13::1G \ + --typecode=13:ea00 \ --new=15::+106M \ --typecode=15:ef00 \ - --new=16::1G \ - --typecode=16:ea00 \ --new=1:: \ --attributes=1:set:2 ;; amd64) sgdisk "${disk_image}" \ + --new=13::1G \ + --typecode=13:ea00 \ --new=14::+4M \ --new=15::+106M \ - --new=16::1G \ - --typecode=16:ea00 \ --new=1:: sgdisk "${disk_image}" \ -t 14:ef02 \ @@ -71,7 +71,7 @@ create_partitions() { create_and_mount_boot_partitions() { uefi_dev="${loop_device}p15" - boot_dev="${loop_device}p16" + boot_dev="${loop_device}p13" mountpoint="$1" mkfs.vfat -F 32 -n UEFI "${uefi_dev}"