Skip to content

Commit

Permalink
kola: cork: Handle QCOW2 EFI firmare images and use them by default
Browse files Browse the repository at this point in the history
Forthcoming Flatcar releases will use QCOW2 instead of raw .fd images.

Signed-off-by: James Le Cuirot <[email protected]>
  • Loading branch information
chewi committed Oct 3, 2024
1 parent be36186 commit 492310f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 16 deletions.
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
17 changes: 15 additions & 2 deletions platform/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,22 @@ 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 {
// When OVMF is built for X64 with SMM enabled S3 (suspend/resume)
Expand Down

0 comments on commit 492310f

Please sign in to comment.