Skip to content

Add GPT type-guid option and validate partuuid - #125

Draft
mschwan-phytec wants to merge 10 commits into
mainfrom
wip-gpt-support
Draft

mschwan-phytec wants to merge 10 commits into
mainfrom
wip-gpt-support

Conversation

@mschwan-phytec

Copy link
Copy Markdown
Collaborator

This PR adds two GPT-related improvements to the layout configuration:

New type-guid partition option. It sets an arbitrary GPT partition type GUID, for example the Discoverable Partitions Specification
GUIDs. Partition flags only map to a fixed set of types. The GUID is applied via sfdisk --part-type after the flags, so it overrides any flag-derived type.

Early partuuid validation. A malformed partuuid on a GPT disk now fails with a parse error that names the partition. Before, it failed late in sfdisk while writing. type-guid is validated the same way.

Configuration values like partuuid are handed to sfdisk unchecked, so
a typo only shows up late as an sfdisk failure. Add a helper that
checks the canonical 8-4-4-4-12 hexadecimal UUID format, so such values
can be validated while parsing the layout configuration.

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
A malformed partuuid used to be passed to sfdisk, which failed only
while writing to the device. Validate the value when parsing the layout
configuration, so the error is reported early and names the partition.
Values on non-GPT disks are still ignored with a warning as before.

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
Partition flags only map to a fixed set of GPT partition type GUIDs.
Add a helper that sets an arbitrary type GUID using sfdisk --part-type,
mirroring pu_partition_set_partuuid().

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
Partition flags cannot express arbitrary GPT partition type GUIDs, such
as the ones of the Discoverable Partitions Specification. Add the
type-guid option to set any type GUID on a partition. Like partuuid, it
is validated while parsing on GPT disks and ignored with a warning on
other disk labels.

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
Signed-off-by: Martin Schwan <m.schwan@phytec.de>
Cover valid values on GPT, malformed values failing with a parse error
on GPT, and the same malformed values being ignored on msdos disks, so
existing msdos configurations keep working.

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
The test needs root privileges for the loop device and was not run
as part of the user suite.

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
Signed-off-by: Martin Schwan <m.schwan@phytec.de>
Describe the new type-guid option and that malformed partuuid and
type-guid values are rejected on GPT partitioned devices.

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
Signed-off-by: Martin Schwan <m.schwan@phytec.de>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant