Fix structure sorting and partition numbering

Bug #1642999 reported by Barry Warsaw
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Image
Fix Released
Critical
Barry Warsaw

Bug Description

In LP: #1631423 we changed the way structures are sorted, which had a side-effect of changing the partition numbering scheme. Structures were sorted by disk offset (implicit or explicit) and the associated partitions (for all but the special 'mbr' type, which doesn't get a partition) are numbered by the sort order.

This breaks certain existing use cases where the partition numbering needs to be explicitly described. Specifically, some device firmwares look for the bootloader at a specific partition number, but that partition may be at a non-zero offset, with partitions having higher numbers placed earlier in the disk image.

The gadget.yaml spec does not support explicit partition numbering so we need to implicitly number partitions according to the order in which the structures appear in the gadget.yaml. The sorting by offset breaks this.

However we still need to sort by offset in order to do the no-overlap sanity check. We need to continue to verify that none of the structure definitions cause partitions to overlap. It's just that we should not expose this structure sorting to the disk image building code that applies the partition numbering. This should re-establish the behavior where partition numbers are assigned based on the order in which the structures appear in the gadget.yaml.

Revision history for this message
Barry Warsaw (barry) wrote :

One other complication; we currently calculate the rootfs offset based on the disk-offset sorted order of the gadget.yaml named partitions. It lives just after the farthest out (which previously equaled the last) partition.

Now, because the farthest out won't necessarily be the last named partition, we have to still ensure that the rootfs gets written after the farthest out partition, *not* the last named partition.

Revision history for this message
Barry Warsaw (barry) wrote :
Barry Warsaw (barry)
Changed in ubuntu-image:
status: In Progress → Fix Committed
Barry Warsaw (barry)
Changed in ubuntu-image:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.