diff options
author | Roland Hieber <rhi@pengutronix.de> | 2023-10-20 11:05:19 +0200 |
---|---|---|
committer | Robert Schwebel <r.schwebel@pengutronix.de> | 2023-10-20 12:54:11 +0200 |
commit | 1022b05b735f6081cf1b2d8bbaa06ff9f10ec6bf (patch) | |
tree | 1cab2c803e5002a60743eb1c5e508c12816b3cb8 /configs/platform-v7a/config/images/rpi2.config | |
parent | 0a18747b6cf13d3c232d4fe0c8c8204da64e6b35 (diff) | |
download | DistroKit-1022b05b735f6081cf1b2d8bbaa06ff9f10ec6bf.tar.gz DistroKit-1022b05b735f6081cf1b2d8bbaa06ff9f10ec6bf.tar.xz |
images: convert to GPT format
The GUID Partition Table format has several advantages over the legacy
MBR format. Especially when we want to make use of systemd-repart
functionality later, the GPT format is a necessity. Therefore, migrate
all images to the GPT format.
For some platforms (Raspberry Pi, AM355x, AT91), we still need a legacy
MBR partition table so that the ROM code can find a bootable partition
(which contains our barebox image). For those cases, transform the image
into a hybrid format containing an MBR at offset 0, which contains the
VFAT boot partition for the ROM loader, and a protective GPT partition
of partition type 0xEE after it to claim the remaining space on the
storage medium for GPT purposes. Then a GPT header is added at the
default GPT offset of 0x200, which defines the boot partition as well as
the root partition, and which is read by Barebox and Linux to boot the
system.
For images that contain a raw barebox image at a fixed offset outside of
a GPT partition, make sure that the GPT does not conflict with the
barebox image, and write only the primary GPT header into the hole
specified by the barebox image (offset 440 to 1K), but move the GPT
partition array to an offset behind the barebox image. (genimage will
then also offset the following partitions accordingly.)
Remove any 'disk-signature' options, which are not compatible with GPT;
genimage will generate a random Disk UUID instead. Also remove any
'partition-type' options, and set the respective partition type GUIDs
specified by the Discoverable Partitions Specification [1], or let
genimage default to the 'linux-generic' partition type.
For the rpi1 image-hdimg, overwrite the upstream hd.config with a
hardcoded genimage config file since it is not possible to build a
hybrid MBR/GPT image with the image recipe from upstream PTXdist.
For the v7a image-hdimg, enable GPT support in the platformconfig menu,
and re-add the respective config lines from the upstream version of the
config file in order to make GPT work.
The images with fixed partition sizes for qemu need to stay below the
size specified in the 'size' option, so decrease the size of the last
partition further to make space for the secondary GPT header, which will
reside in the last block of the image.
Link: [1] https://uapi-group.org/specifications/specs/discoverable_partitions_specification/
Signed-off-by: Roland Hieber <rhi@pengutronix.de>
Link: https://lore.pengutronix.de/20231020090519.3320460-6-rhi@pengutronix.de
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Diffstat (limited to 'configs/platform-v7a/config/images/rpi2.config')
-rw-r--r-- | configs/platform-v7a/config/images/rpi2.config | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/configs/platform-v7a/config/images/rpi2.config b/configs/platform-v7a/config/images/rpi2.config index eebf705..71baae3 100644 --- a/configs/platform-v7a/config/images/rpi2.config +++ b/configs/platform-v7a/config/images/rpi2.config @@ -10,24 +10,24 @@ image rpi2-boot.vfat { image @IMAGE@ { hdimage { align = 1M - disk-signature = 0xbedf7893 + partition-table-type = hybrid } partition boot { offset = 4M image = rpi2-boot.vfat partition-type = 0xc + partition-type-uuid = F bootable = true } partition root-A { image = root.ext2 - partition-type = 0x83 + partition-type-uuid = 69dad710-2ce4-4e3c-b16c-21a1d49abed3 # root-arm } partition root-B { image = root.ext2 - partition-type = 0x83 + partition-type-uuid = 69dad710-2ce4-4e3c-b16c-21a1d49abed3 # root-arm } partition data { - partition-type = 0x83 size = 512M } } |