From ddff3faba3d9d6461a28ef1369b388282775331d Mon Sep 17 00:00:00 2001 From: Gauthier Jolly Date: Thu, 9 Oct 2025 12:14:32 +0200 Subject: [PATCH 1/4] cpc/UEFI: set the right partition type for the rootfs To make our disk images more discoverable, we should use the correct partition type for the root filesystem. This aligns with the Discoverable Disk Image (DDI) specification developed by the UAPI group[1] and makes our images more self-describing, e.g. with fdisk, before: Device Start End Sectors Size Type /dev/nbd0p1 2324480 7339998 5015519 2.4G Linux filesystem ... and now after: Device Start End Sectors Size Type /dev/nbd0p1 2324480 7339998 5015519 2.4G Linux root (x86-64) ... [1] https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ --- live-build/functions | 40 +++++++++++++++++++ .../hooks.d/base/disk-image-ppc64el.binary | 4 +- .../hooks.d/base/disk-image-uefi.binary | 7 +++- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/live-build/functions b/live-build/functions index a4b27bd0..4a2c57f7 100644 --- a/live-build/functions +++ b/live-build/functions @@ -1404,3 +1404,43 @@ EOF EOF fi } + +# Determine the appropriate partition type UUID for the root filesystem +# based on the architecture. +# Please see https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ +# for where the GUIDs come from. +gpt_root_partition_uuid() { + local ARCH="$1" + + if [ -z "${ARCH:-}" ]; then + echo "usage: gpt_root_partition_uuid " + exit 1 + fi + + case "${ARCH}" in + "amd64") + ROOTFS_PARTITION_TYPE="4f68bce3-e8cd-4db1-96e7-fbcaf984b709" + ;; + "arm64") + ROOTFS_PARTITION_TYPE="b921b045-1df0-41c3-af44-4c6f280d3fae" + ;; + "armhf") + ROOTFS_PARTITION_TYPE="69dad710-2ce4-4e3c-b16c-21a1d49abed3" + ;; + "riscv64") + ROOTFS_PARTITION_TYPE="72ec70a6-cf74-40e6-bd49-4bda08e8f224" + ;; + "ppc64el") + ROOTFS_PARTITION_TYPE="c31c45e6-3f39-412e-80fb-4809c4980599" + ;; + "s390x") + ROOTFS_PARTITION_TYPE="5eead9a9-fe09-4a1e-a1d7-520d00531306" + ;; + *) + echo "Unsupported architecture: ${ARCH}" + exit 1 + ;; + esac + + echo "${ROOTFS_PARTITION_TYPE}" +} \ No newline at end of file diff --git a/live-build/ubuntu-cpc/hooks.d/base/disk-image-ppc64el.binary b/live-build/ubuntu-cpc/hooks.d/base/disk-image-ppc64el.binary index 50fe4522..701b8604 100755 --- a/live-build/ubuntu-cpc/hooks.d/base/disk-image-ppc64el.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/disk-image-ppc64el.binary @@ -24,7 +24,9 @@ create_partitions() { sgdisk "${disk_image}" \ --new=2::+8M \ --new=1: - sgdisk "${disk_image}" -t 2:4100 + sgdisk "${disk_image}" \ + -t 2:4100 \ + -t 1:"$(gpt_root_partition_uuid $ARCH)" sgdisk "${disk_image}" \ --print } 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 fccccb99..cfe8ca3a 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 @@ -41,7 +41,8 @@ create_partitions() { --typecode=15:ef00 \ --new=13::1G \ --typecode=13:ea00 \ - --new=1: + --new=1: \ + --typecode=1:"$(gpt_root_partition_uuid $ARCH)" ;; riscv64) sgdisk "${disk_image}" \ @@ -51,6 +52,7 @@ create_partitions() { --new=15::+106M \ --typecode=15:ef00 \ --new=1:: \ + --typecode=1:"$(gpt_root_partition_uuid $ARCH)" \ --attributes=1:set:2 ;; amd64) @@ -62,7 +64,8 @@ create_partitions() { --new=1:: sgdisk "${disk_image}" \ -t 14:ef02 \ - -t 15:ef00 + -t 15:ef00 \ + -t 1:"$(gpt_root_partition_uuid $ARCH)" ;; esac sgdisk "${disk_image}" \ From ff6b3824d86163de8c843a3791336622dbea87d6 Mon Sep 17 00:00:00 2001 From: Gauthier Jolly Date: Thu, 9 Oct 2025 12:23:19 +0200 Subject: [PATCH 2/4] cpc/UEFI: name the GPT partition cloudimg-rootfs To boot initrdless, the kernel supports a limited number of ways to specify the location of the root filesystem[1]. One of them is to use the PARTUUID (which will be different for every cloud-image), another is to use the PARTLABEL (partition name). To allow the use of PARTLABEL in the kernel command line and make our cloud-images more self-describing, set the PARTLABEL to cloudimg-rootfs which is the same label we use for the file system inside this partition. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/block/early-lookup.c#n217 --- live-build/ubuntu-cpc/hooks.d/base/disk-image-ppc64el.binary | 1 + live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary | 3 +++ 2 files changed, 4 insertions(+) diff --git a/live-build/ubuntu-cpc/hooks.d/base/disk-image-ppc64el.binary b/live-build/ubuntu-cpc/hooks.d/base/disk-image-ppc64el.binary index 701b8604..66d296ff 100755 --- a/live-build/ubuntu-cpc/hooks.d/base/disk-image-ppc64el.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/disk-image-ppc64el.binary @@ -25,6 +25,7 @@ create_partitions() { --new=2::+8M \ --new=1: sgdisk "${disk_image}" \ + --change-name=1:"$FS_LABEL" \ -t 2:4100 \ -t 1:"$(gpt_root_partition_uuid $ARCH)" sgdisk "${disk_image}" \ 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 cfe8ca3a..ca7c7966 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 @@ -42,6 +42,7 @@ create_partitions() { --new=13::1G \ --typecode=13:ea00 \ --new=1: \ + --change-name=1:"$FS_LABEL" \ --typecode=1:"$(gpt_root_partition_uuid $ARCH)" ;; riscv64) @@ -52,6 +53,7 @@ create_partitions() { --new=15::+106M \ --typecode=15:ef00 \ --new=1:: \ + --change-name=1:"$FS_LABEL" \ --typecode=1:"$(gpt_root_partition_uuid $ARCH)" \ --attributes=1:set:2 ;; @@ -63,6 +65,7 @@ create_partitions() { --new=15::+106M \ --new=1:: sgdisk "${disk_image}" \ + --change-name=1:"$FS_LABEL" \ -t 14:ef02 \ -t 15:ef00 \ -t 1:"$(gpt_root_partition_uuid $ARCH)" From 287bf9145063a65908c019efe007a5f01506d677 Mon Sep 17 00:00:00 2001 From: Gauthier Jolly Date: Fri, 10 Oct 2025 09:50:15 +0200 Subject: [PATCH 3/4] d/changelog --- debian/changelog | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 6542195f..7683884a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,14 @@ -livecd-rootfs (26.04.1) UNRELEASED; urgency=medium +livecd-rootfs (26.04.1) resolute; urgency=medium + [ Heinrich Schuchardt ] * Remove unused riscv64 SUBARCHs - -- Heinrich Schuchardt Fri, 10 Oct 2025 14:57:45 +0200 + [ Gauthier Jolly ] + * ubuntu-cpc: + - Use the right specific UUID type for the root filesystem partition. + - Set a PARTLABEL (cloudimg-rootfs) on the root filesystem partition. + + -- Gauthier Jolly Mon, 20 Oct 2025 08:55:25 +0200 livecd-rootfs (25.10.24) questing; urgency=medium From 922faa0d12d9f22ebefae7cdb125bb5da75d7b73 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Thu, 23 Oct 2025 12:42:12 +1300 Subject: [PATCH 4/4] update version number --- debian/changelog | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 7683884a..dc0009b1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,4 @@ -livecd-rootfs (26.04.1) resolute; urgency=medium - - [ Heinrich Schuchardt ] - * Remove unused riscv64 SUBARCHs +livecd-rootfs (26.04.2) UNRELEASED; urgency=medium [ Gauthier Jolly ] * ubuntu-cpc: