diff --git a/config/sources/amd64.conf b/config/sources/amd64.conf index 5909fb70e51b..555d9c0c9b92 100644 --- a/config/sources/amd64.conf +++ b/config/sources/amd64.conf @@ -12,6 +12,11 @@ declare -g ARCH='amd64' # Debian name $(dpkg-architecture -q declare -g ARCHITECTURE='x86_64' # "kernel" arch declare -g KERNEL_SRC_ARCH='x86' # kernel SRC_ARCH; there's two for x86_64 declare -g QEMU_BINARY='qemu-x86_64-static' # Hopefully you have this installed. + +# Linux root has a different Type-UUID for every architecture +# See https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ +declare -g PARTITION_TYPE_UUID_ROOT="4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709" # "Linux root (x86-64)" + declare -g MAIN_CMDLINE='' # we set it in common, it was not set before declare -g KERNEL_COMPILER=' ' # hack: use single space for host gcc. won't work on arm64 hosts declare -g KERNEL_USE_GCC=' ' # more hacks. diff --git a/config/sources/arm64.conf b/config/sources/arm64.conf index be2916a7c63b..d6ff527ed697 100644 --- a/config/sources/arm64.conf +++ b/config/sources/arm64.conf @@ -13,6 +13,10 @@ declare -g ARCHITECTURE='arm64' declare -g KERNEL_SRC_ARCH='arm64' declare -g QEMU_BINARY='qemu-aarch64-static' +# Linux root has a different Type-UUID for every architecture +# See https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ +declare -g PARTITION_TYPE_UUID_ROOT="B921B045-1DF0-41C3-AF44-4C6F280D3FAE" # "Linux root (ARM-64)" + # Defaults, if not set by board or family. declare -g KERNEL_IMAGE_TYPE="${KERNEL_IMAGE_TYPE:-"Image"}" declare -g KERNEL_INSTALL_TYPE="${KERNEL_INSTALL_TYPE:-"install"}" diff --git a/config/sources/armhf.conf b/config/sources/armhf.conf index 99ecb8d25c63..37e630fdb23c 100644 --- a/config/sources/armhf.conf +++ b/config/sources/armhf.conf @@ -14,6 +14,10 @@ declare -g KERNEL_SRC_ARCH='arm' declare -g QEMU_BINARY='qemu-arm-static' declare -g INITRD_ARCH='arm' +# Linux root has a different Type-UUID for every architecture +# See https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ +declare -g PARTITION_TYPE_UUID_ROOT="69DAD710-2CE4-4E3C-B16C-21A1D49ABED3" # "Linux root (ARM)" + # Defaults, if not set by board or family. declare -g KERNEL_IMAGE_TYPE="${KERNEL_IMAGE_TYPE:-"zImage"}" declare -g KERNEL_INSTALL_TYPE="${KERNEL_INSTALL_TYPE:-"zinstall"}" diff --git a/config/sources/riscv64.conf b/config/sources/riscv64.conf index 564d45bfae0f..636db2a1ed19 100644 --- a/config/sources/riscv64.conf +++ b/config/sources/riscv64.conf @@ -15,6 +15,10 @@ declare -g QEMU_BINARY='qemu-riscv64-static' declare -g IMAGE_PARTITION_TABLE='gpt' declare -g SKIP_EXTERNAL_TOOLCHAINS='yes' +# Linux root has a different Type-UUID for every architecture +# See https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ +declare -g PARTITION_TYPE_UUID_ROOT="72EC70A6-CF74-40E6-BD49-4BDA08E8F224" # "Linux root (RISC-V-64)" + # Defaults, if not set by board or family. declare -g KERNEL_IMAGE_TYPE="${KERNEL_IMAGE_TYPE:-"Image"}" declare -g KERNEL_INSTALL_TYPE="${KERNEL_INSTALL_TYPE:-"install"}" diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh index f423a85dfca5..7126a34afb09 100644 --- a/lib/functions/image/partitioning.sh +++ b/lib/functions/image/partitioning.sh @@ -214,7 +214,7 @@ function prepare_partitions() { echo "$bootpart : name=\"bootfs\", start=${next}MiB, size=${BOOTSIZE}MiB, type=${type}" local next=$(($next + $BOOTSIZE)) else - # no `size` argument mean "as much as possible" + # No 'size' argument means "expand as much as possible" echo "$bootpart : name=\"bootfs\", start=${next}MiB, type=${type}" fi fi @@ -222,9 +222,20 @@ function prepare_partitions() { # Root filesystem partition if [[ -n "$rootpart" ]]; then # dos: Linux - # gpt: Linux filesystem - [[ "$IMAGE_PARTITION_TABLE" != "gpt" ]] && local type="83" || local type="0FC63DAF-8483-4772-8E79-3D69D8477DE4" - # no `size` argument mean "as much as possible" + # gpt: Linux root + if [[ "$IMAGE_PARTITION_TABLE" != "gpt" ]]; then + local type="83" + else + # Linux root has a different Type-UUID for every architecture + # See https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ + # The ${PARTITION_TYPE_UUID_ROOT} variable is defined in each architecture file (e.g. config/sources/arm64.conf) + if [[ -n "${PARTITION_TYPE_UUID_ROOT}" ]]; then + local type="${PARTITION_TYPE_UUID_ROOT}" + else + exit_with_error "Missing 'PARTITION_TYPE_UUID_ROOT' variable while partitioning the root filesystem!" + fi + fi + # No 'size' argument means "expand as much as possible" echo "$rootpart : name=\"rootfs\", start=${next}MiB, type=${type}" fi }