Skip to content

Commit

Permalink
mantle/aws: set boot mode to uefi-preferred
Browse files Browse the repository at this point in the history
AWS now allows marking an AMI as "UEFI-preferred"; i.e. that both BIOS
and UEFI are supported, but the latter is preferred if the instance type
supports it.

Let's make use of it.

A change proposal has been submitted for Fedora 39 to also do this for
the Fedora Cloud image.

Ref: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html
Ref: https://fedoraproject.org/wiki/Changes/CloudEC2UEFIPreferred
  • Loading branch information
jlebon authored and prestist committed Sep 12, 2023
1 parent f4f1201 commit 3c03739
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mantle/platform/api/aws/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,17 @@ func (a *API) CreateImportRole(bucket string) error {

func (a *API) CreateHVMImage(snapshotID string, diskSizeGiB uint, name string, description string, architecture string) (string, error) {
var awsArch string
var bootmode string
if architecture == "" {
architecture = runtime.GOARCH
}
switch architecture {
case "amd64", "x86_64":
awsArch = ec2.ArchitectureTypeX8664
bootmode = "uefi-preferred"
case "arm64", "aarch64":
awsArch = ec2.ArchitectureTypeArm64
bootmode = "uefi"
default:
return "", fmt.Errorf("unsupported ec2 architecture %q", architecture)
}
Expand Down Expand Up @@ -366,6 +369,7 @@ func (a *API) CreateHVMImage(snapshotID string, diskSizeGiB uint, name string, d
},
EnaSupport: aws.Bool(true),
SriovNetSupport: aws.String("simple"),
BootMode: aws.String(bootmode),
})
}

Expand Down

0 comments on commit 3c03739

Please sign in to comment.