From 7248c04f089f7f61d6a735e94962892c168f1a3e Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Mon, 4 Aug 2025 19:02:34 +0200 Subject: [PATCH 1/2] bib: set the boot mode to UEFI only for aarch64 Setting it to hybrid creates the BIOS boot partition (1 MiB empty partition at the start of the partition table), which can cause boot issues with certain devices. --- bib/cmd/bootc-image-builder/image.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bib/cmd/bootc-image-builder/image.go b/bib/cmd/bootc-image-builder/image.go index 273fc59c..ea9cb897 100644 --- a/bib/cmd/bootc-image-builder/image.go +++ b/bib/cmd/bootc-image-builder/image.go @@ -310,10 +310,16 @@ func genPartitionTableDiskCust(c *ManifestConfig, diskCust *blueprint.DiskCustom if err != nil { return nil, err } + + bootMode := platform.BOOT_HYBRID + if c.Architecture == arch.ARCH_AARCH64 { + // This prevents the creation of BIOS boot partitions for ARM devices + bootMode = platform.BOOT_UEFI + } partOptions := &disk.CustomPartitionTableOptions{ PartitionTableType: basept.Type, // XXX: not setting/defaults will fail to boot with btrfs/lvm - BootMode: platform.BOOT_HYBRID, + BootMode: bootMode, DefaultFSType: defaultFSType, RequiredMinSizes: requiredMinSizes, Architecture: c.Architecture, From 0f80cd9aae60aef547cda1e8d7ccae262db03fff Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Mon, 4 Aug 2025 19:52:28 +0200 Subject: [PATCH 2/2] WIP: test --- test/test_manifest.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/test_manifest.py b/test/test_manifest.py index bf275401..1d611804 100644 --- a/test/test_manifest.py +++ b/test/test_manifest.py @@ -558,6 +558,11 @@ def test_manifest_fs_customizations_xarch(tmp_path, build_container, fscustomiza assert_fs_customizations(fscustomizations, rootfs, output) + # aarch64 partition table does not include boot partition (UEFI only) + sfdisk_options = find_sfdisk_stage_from(output) + assert sfdisk_options["partitions"][0]["size"] != 2048 + assert not sfdisk_options["partitions"][0].get("bootable", False) + def find_grub2_iso_stage_from(manifest_str): manifest = json.loads(manifest_str) @@ -946,3 +951,12 @@ def test_manifest_image_customize_disk(tmp_path, build_container): ], encoding="utf8") sfdisk_options = find_sfdisk_stage_from(manifest_str) assert sfdisk_options["partitions"][2]["size"] == 3 * 1024 * 1024 * 1024 / 512 + + if platform.uname().machine == "x86_64": + # x86_64 partition table always includes boot partition for hybrid boot + assert sfdisk_options["partitions"][0]["size"] == 2048 + assert sfdisk_options["partitions"][0]["bootable"] + elif platform.uname().machine == "aarch64": + # aarch64 partition table does not include boot partition (UEFI only) + assert sfdisk_options["partitions"][0]["size"] != 2048 + assert not sfdisk_options["partitions"][0].get("bootable", False)