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)
ubuntu/oracular
Simon Poirier 5 months ago
parent 1a6895d2ba
commit 61f1b20a5a

@ -237,10 +237,13 @@ mount_disk_image() {
mount_image ${disk_image} "${rootpart}" mount_image ${disk_image} "${rootpart}"
mount_partition "${rootfs_dev_mapper}" $mountpoint mount_partition "${rootfs_dev_mapper}" $mountpoint
local boot_dev="${loop_device}p16" local boot_dev="${loop_device}p13"
if flock -x ${loop_device} \ if flock -x ${loop_device} \
[ -b ${boot_dev} -a -e $mountpoint/boot ]; then [ -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 fi
# Having one partition mounted should avoid udev-triggered partition # Having one partition mounted should avoid udev-triggered partition

@ -37,28 +37,28 @@ create_partitions() {
case $ARCH in case $ARCH in
arm64|armhf) arm64|armhf)
sgdisk "${disk_image}" \ sgdisk "${disk_image}" \
--new=13::1G \
--typecode=13:ea00 \
--new=15:0:204800 \ --new=15:0:204800 \
--typecode=15:ef00 \ --typecode=15:ef00 \
--new=16::1G \
--typecode=16:ea00 \
--new=1: --new=1:
;; ;;
riscv64) riscv64)
sgdisk "${disk_image}" \ sgdisk "${disk_image}" \
--set-alignment=2 \ --set-alignment=2 \
--new=13::1G \
--typecode=13:ea00 \
--new=15::+106M \ --new=15::+106M \
--typecode=15:ef00 \ --typecode=15:ef00 \
--new=16::1G \
--typecode=16:ea00 \
--new=1:: \ --new=1:: \
--attributes=1:set:2 --attributes=1:set:2
;; ;;
amd64) amd64)
sgdisk "${disk_image}" \ sgdisk "${disk_image}" \
--new=13::1G \
--typecode=13:ea00 \
--new=14::+4M \ --new=14::+4M \
--new=15::+106M \ --new=15::+106M \
--new=16::1G \
--typecode=16:ea00 \
--new=1:: --new=1::
sgdisk "${disk_image}" \ sgdisk "${disk_image}" \
-t 14:ef02 \ -t 14:ef02 \
@ -71,7 +71,7 @@ create_partitions() {
create_and_mount_boot_partitions() { create_and_mount_boot_partitions() {
uefi_dev="${loop_device}p15" uefi_dev="${loop_device}p15"
boot_dev="${loop_device}p16" boot_dev="${loop_device}p13"
mountpoint="$1" mountpoint="$1"
mkfs.vfat -F 32 -n UEFI "${uefi_dev}" mkfs.vfat -F 32 -n UEFI "${uefi_dev}"

Loading…
Cancel
Save