From e525be6623ac34b7e695b57e3ce7b482fa58c9a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= Date: Thu, 14 Mar 2024 13:46:24 -0400 Subject: [PATCH] partitioning: Add partattrs property to partition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a 'partattrs' property to partitions. It allows the GPT partition attribute bits to be set for a partition. Notably this is needed to set bits 48 and 56, which are part of the GUID specific range, to allow a ChromeOS Kernel partition to be booted on Chromebooks. Signed-off-by: NĂ­colas F. R. A. Prado --- actions/image_partition_action.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/actions/image_partition_action.go b/actions/image_partition_action.go index 61ac62bb..7ed04666 100644 --- a/actions/image_partition_action.go +++ b/actions/image_partition_action.go @@ -58,6 +58,7 @@ a 32 bits hexadecimal number (e.g. '1234ABCD' without any dash separator). fsck: bool fsuuid: string partuuid: string + partattrs: list of partition attributes Mandatory properties: @@ -95,6 +96,9 @@ for partition. - flags -- list of additional flags for partition compatible with parted(8) 'set' command. +- partattrs -- list of GPT partition attribute bits. See description for +--part-attrs in sfdisk(8) for examples. + - fsck -- if set to `false` -- then set fs_passno (man fstab) to 0 meaning no filesystem checks in boot time. By default is set to `true` allowing checks on boot. @@ -187,6 +191,7 @@ type Partition struct { Name string PartLabel string PartType string + PartAttrs []string PartUUID string Start string End string @@ -531,6 +536,13 @@ func (i ImagePartitionAction) Run(context *debos.DebosContext) error { } } + if p.PartAttrs != nil { + err = debos.Command{}.Run("sfdisk", "sfdisk", "--part-attrs", context.Image, fmt.Sprintf("%d", p.number), strings.Join(p.PartAttrs, ",")) + if err != nil { + return err + } + } + /* PartUUID will only be set for gpt partitions */ if len(p.PartUUID) > 0 { err = debos.Command{}.Run("sfdisk", "sfdisk", "--part-uuid", context.Image, fmt.Sprintf("%d", p.number), p.PartUUID)