Skip to content

bib: set the boot mode to UEFI only for aarch64 #1010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion bib/cmd/bootc-image-builder/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 14 additions & 0 deletions test/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Loading