Skip to content
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

kola: cork: Handle QCOW2 EFI firmare images and fix arm64 Secure Boot #560

Merged
merged 3 commits into from
Oct 11, 2024
Merged
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
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,17 @@ wget https://alpha.release.flatcar-linux.net/amd64-usr/current/flatcar_productio
wget https://alpha.release.flatcar-linux.net/amd64-usr/current/flatcar_production_qemu_image.img.sig
gpg --verify flatcar_production_qemu_image.img.sig

wget https://alpha.release.flatcar-linux.net/amd64-usr/current/flatcar_production_qemu_uefi_efi_code.fd
wget https://alpha.release.flatcar-linux.net/amd64-usr/current/flatcar_production_qemu_uefi_efi_code.fd.sig
gpg --verify flatcar_production_qemu_uefi_efi_code.fd.sig
wget https://alpha.release.flatcar-linux.net/amd64-usr/current/flatcar_production_qemu_uefi_efi_code.qcow2
wget https://alpha.release.flatcar-linux.net/amd64-usr/current/flatcar_production_qemu_uefi_efi_code.qcow2.sig
gpg --verify flatcar_production_qemu_uefi_efi_code.qcow2.sig

wget https://alpha.release.flatcar-linux.net/amd64-usr/current/flatcar_production_qemu_uefi_efi_vars.fd
wget https://alpha.release.flatcar-linux.net/amd64-usr/current/flatcar_production_qemu_uefi_efi_vars.fd.sig
gpg --verify flatcar_production_qemu_uefi_efi_vars.fd.sig
wget https://alpha.release.flatcar-linux.net/amd64-usr/current/flatcar_production_qemu_uefi_efi_vars.qcow2
wget https://alpha.release.flatcar-linux.net/amd64-usr/current/flatcar_production_qemu_uefi_efi_vars.qcow2.sig
gpg --verify flatcar_production_qemu_uefi_efi_vars.qcow2.sig

sudo ./bin/kola run --board amd64-usr --key ${HOME}/.ssh/id_rsa.pub -k -b cl -p qemu \
--qemu-firmware flatcar_production_qemu_uefi_efi_code.fd \
--qemu-ovmf-vars flatcar_production_qemu_uefi_efi_vars.fd \
--qemu-firmware flatcar_production_qemu_uefi_efi_code.qcow2 \
--qemu-ovmf-vars flatcar_production_qemu_uefi_efi_vars.qcow2 \
--qemu-image flatcar_production_qemu_image.img \
cl.locksmith.cluster
```
Expand All @@ -113,12 +113,12 @@ wget https://alpha.release.flatcar-linux.net/arm64-usr/current/flatcar_productio
wget https://alpha.release.flatcar-linux.net/arm64-usr/current/flatcar_production_qemu_uefi_image.img.sig
gpg --verify flatcar_production_qemu_uefi_image.img.sig

wget https://alpha.release.flatcar-linux.net/arm64-usr/current/flatcar_production_qemu_uefi_efi_code.fd
wget https://alpha.release.flatcar-linux.net/arm64-usr/current/flatcar_production_qemu_uefi_efi_code.fd.sig
gpg --verify flatcar_production_qemu_uefi_efi_code.fd.sig
wget https://alpha.release.flatcar-linux.net/arm64-usr/current/flatcar_production_qemu_uefi_efi_code.qcow2
wget https://alpha.release.flatcar-linux.net/arm64-usr/current/flatcar_production_qemu_uefi_efi_code.qcow2.sig
gpg --verify flatcar_production_qemu_uefi_efi_code.qcow2.sig

sudo ./bin/kola run --board arm64-usr --key ${HOME}/.ssh/id_rsa.pub -k -b cl -p qemu \
--qemu-firmware flatcar_production_qemu_uefi_efi_code.fd \
--qemu-firmware flatcar_production_qemu_uefi_efi_code.qcow2 \
--qemu-image flatcar_production_qemu_uefi_image.img \
cl.etcd-member.discovery
```
Expand Down
2 changes: 1 addition & 1 deletion cmd/cork/downloadimage.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (platforms *platformList) Set(value string) error {
"esx": {"_vmware_ova.ova"},
"gce": {"_gce.tar.gz"},
"qemu": {"_image.bin.bz2"},
"qemu_uefi": {"_qemu_uefi_efi_code.fd", "_qemu_uefi_efi_vars.fd", "_image.bin.bz2"},
"qemu_uefi": {"_qemu_uefi_efi_code.qcow2", "_qemu_uefi_efi_vars.qcow2", "_image.bin.bz2"},
}

values := strings.Split(value, ",")
Expand Down
2 changes: 1 addition & 1 deletion cmd/kola/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var (

kolaDefaultFirmware = map[string]string{
"amd64-usr": "bios-256k.bin",
"arm64-usr": sdk.BuildRoot() + "/images/arm64-usr/latest/flatcar_production_qemu_uefi_efi_code.fd",
"arm64-usr": sdk.BuildRoot() + "/images/arm64-usr/latest/flatcar_production_qemu_uefi_efi_code.qcow2",
}

kolaSSHRetries = 60
Expand Down
7 changes: 7 additions & 0 deletions kola/tests/misc/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"golang.org/x/net/context"

"github.com/flatcar/mantle/kola"
"github.com/flatcar/mantle/kola/cluster"
"github.com/flatcar/mantle/kola/register"
"github.com/flatcar/mantle/kola/tests/util"
Expand Down Expand Up @@ -58,6 +59,9 @@ func init() {
Distros: []string{"cl"},
// This test is normally not related to the cloud environment
Platforms: []string{"qemu", "qemu-unpriv"},
// Changing the verity hash breaks Secure Boot verification, causing
// GRUB to error and then just sit at the menu forever.
SkipFunc: kola.SkipSecureboot,
})
register.Register(&register.Test{
Run: RecoverBadUsr,
Expand All @@ -68,6 +72,9 @@ func init() {
Distros: []string{"cl"},
// This test is normally not related to the cloud environment
Platforms: []string{"qemu", "qemu-unpriv"},
// Changing the verity hash breaks Secure Boot verification, causing
// GRUB to error and then just sit at the menu forever.
SkipFunc: kola.SkipSecureboot,
})
}

Expand Down
19 changes: 16 additions & 3 deletions platform/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,24 @@ func CreateQEMUCommand(board, uuid, firmware, ovmfVars, consolePath, confPath, d
"-device", "virtio-rng-pci,rng=rng0",
)
if ovmfVars != "" {
var fwFormat, varsFormat string

if strings.HasSuffix(firmware, ".qcow2") {
fwFormat = "qcow2"
} else {
fwFormat = "raw"
}
if strings.HasSuffix(ovmfVars, ".qcow2") {
varsFormat = "qcow2"
} else {
varsFormat = "raw"
}

qmCmd = append(qmCmd,
"-drive", fmt.Sprintf("if=pflash,unit=0,file=%v,format=raw,readonly=on", firmware),
"-drive", fmt.Sprintf("if=pflash,unit=1,file=%v,format=raw", ovmfVars),
"-drive", fmt.Sprintf("if=pflash,unit=0,file=%v,format=%v,readonly=on", firmware, fwFormat),
"-drive", fmt.Sprintf("if=pflash,unit=1,file=%v,format=%v", ovmfVars, varsFormat),
)
if enableSecureboot {
if enableSecureboot && board == "amd64-usr" {
chewi marked this conversation as resolved.
Show resolved Hide resolved
// When OVMF is built for X64 with SMM enabled S3 (suspend/resume)
// must be disabled. This is required for secure boot and not very
// well documented. The flag comes from here:
Expand Down