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}" \