Skip to content

Commit

Permalink
partitioning: Set correct partition type UUID for root filesystem
Browse files Browse the repository at this point in the history
Previously, only the type "Generic Linux filesystem" was used.
Use the correct type "Linux root ($ARCHITECTURE)" for the root filesystem.
  • Loading branch information
ColorfulRhino authored and igorpecovnik committed Aug 5, 2024
1 parent a027c4b commit 1092d60
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 4 deletions.
5 changes: 5 additions & 0 deletions config/sources/amd64.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions config/sources/arm64.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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"}"
Expand Down
4 changes: 4 additions & 0 deletions config/sources/armhf.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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"}"
Expand Down
4 changes: 4 additions & 0 deletions config/sources/riscv64.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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"}"
Expand Down
19 changes: 15 additions & 4 deletions lib/functions/image/partitioning.sh
Original file line number Diff line number Diff line change
Expand Up @@ -214,17 +214,28 @@ 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
# 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
}
Expand Down

0 comments on commit 1092d60

Please sign in to comment.