From 193aa467f1745362f5722702453c3c94ab72933d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Mon, 2 Dec 2024 12:00:32 +0100 Subject: [PATCH] distro/rhel9: remove ESP from non-UEFI AMI images RHEL 9.2 and older don't support UEFI on AWS. Let's remove also the ESP from there, as it's absolutely useless there. --- pkg/distro/rhel/rhel9/partition_tables.go | 43 +++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/pkg/distro/rhel/rhel9/partition_tables.go b/pkg/distro/rhel/rhel9/partition_tables.go index cb17cd210d..03959ea627 100644 --- a/pkg/distro/rhel/rhel9/partition_tables.go +++ b/pkg/distro/rhel/rhel9/partition_tables.go @@ -1,6 +1,8 @@ package rhel9 import ( + "strings" + "github.com/osbuild/images/internal/common" "github.com/osbuild/images/pkg/arch" "github.com/osbuild/images/pkg/datasizes" @@ -24,6 +26,47 @@ func defaultBasePartitionTables(t *rhel.ImageType) (disk.PartitionTable, bool) { switch t.Arch().Name() { case arch.ARCH_X86_64.String(): + // RHEL EC2 x86_64 images prior to 9.3 support only BIOS boot + if common.VersionLessThan(t.Arch().Distro().OsVersion(), "9.3") && t.IsRHEL() && (strings.HasPrefix(t.Name(), "ec2") || t.Name() == "ami") { + return disk.PartitionTable{ + UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0", + Type: disk.PT_GPT, + Partitions: []disk.Partition{ + { + Size: 1 * datasizes.MebiByte, + Bootable: true, + Type: disk.BIOSBootPartitionGUID, + UUID: disk.BIOSBootPartitionUUID, + }, + { + Size: bootSize, + Type: disk.XBootLDRPartitionGUID, + UUID: disk.FilesystemDataUUID, + Payload: &disk.Filesystem{ + Type: "xfs", + Mountpoint: "/boot", + Label: "boot", + FSTabOptions: "defaults", + FSTabFreq: 0, + FSTabPassNo: 0, + }, + }, + { + Size: 2 * datasizes.GibiByte, + Type: disk.FilesystemDataGUID, + UUID: disk.RootPartitionUUID, + Payload: &disk.Filesystem{ + Type: "xfs", + Label: "root", + Mountpoint: "/", + FSTabOptions: "defaults", + FSTabFreq: 0, + FSTabPassNo: 0, + }, + }, + }, + }, true + } return disk.PartitionTable{ UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0", Type: disk.PT_GPT,