Skip to content

Conversation

@aesteve-rh
Copy link

When validating a dos partition (MBR) with more than 4 partitions, check also if there is an extended partition type (0f) before actually failing.

@aesteve-rh aesteve-rh requested review from a team and achilleas-k as code owners January 8, 2026 09:40
@aesteve-rh aesteve-rh requested review from croissanne and lzap January 8, 2026 09:40
@alexlarsson
Copy link
Contributor

Note: This is required for the automotive project to build MBR based rpi4 bootc images.

Copy link
Member

@supakeen supakeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me preface with: it's been a while since I thought about extended partitions. Are the additional partitions actually contained inside the extended partition or do the follow the extended partition and the extended partition only contains the information about the (potentially multiple) following partition?

If the former then I think it'd be nicer to len(o.Partitions) - len(PartitionsThatAreExtended). If the latter then, while I can probably make up more validation, we can keep it as is :)

Separate question for @alexlarsson what partition layout are you aiming for that you need more than 4 on an RPi4? Fedora images usually have 3 (or 2).

@alexlarsson
Copy link
Contributor

The (physical) extended partition will cover the remaining space of the disk and the logical partitions are within it. There is however not really a "this partition is extended" info in the json format, so your example isn't that easy to do. I think what we want to check is that either the len is <= 4, or there is an extended partition in the first four slots.

@alexlarsson
Copy link
Contributor

Separate question for @alexlarsson what partition layout are you aiming for that you need more than 4 on an RPi4? Fedora images usually have 3 (or 2).

When we use UKIBoot we need at least these partitions: EFI, ukiboot_a, ukiboot_b, ukibootctl, rootfs. Then additionally we may need a separate /var.

@martinezjavier
Copy link
Contributor

@supakeen and the problem we have is that the bootROM for many automotive grade SoCs only know how to parse MBR and not GPT.

Albert mentioned the rpi4 but for that the first stage firmware can actually be updated so is no longer a limitation, but other platforms (e.g,: TI AM69) has the first stage firmware in a ROM and can't be updated.

@aesteve-rh
Copy link
Author

I think what we want to check is that either the len is <= 4, or there is an extended partition in the first four slots.

So iiuc it should only check/iterate the first four partitions in the validate loop?

When validating a `dos` partition (MBR) with more than
4 partitions, check also if there is an extended partition
type (0f) before actually failing. The updated check
verifies that len(partitions) <= 4 or there is an
extended partition in the first four slots.

Signed-off-by: Albert Esteve <[email protected]>
@aesteve-rh aesteve-rh force-pushed the check-extended-dos-part branch from 18a2f97 to 8c30a56 Compare January 8, 2026 12:50
Copy link
Member

@supakeen supakeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK to me, @achilleas-k is most knowledgeable about this part so let's see what he thinks too.

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.

5 participants