From 752546fd53b65d8e13ec0633db76d1fb54168191 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 19 Mar 2020 22:22:35 +0000 Subject: [PATCH] Move the "4k implies uefi" logic into kola As part of eventually making `cmd-run` go away, and also aiding using `kola run` against 4k drives etc. --- mantle/cmd/kola/options.go | 10 +++++++++- src/cmd-run | 4 ---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/mantle/cmd/kola/options.go b/mantle/cmd/kola/options.go index b200894c12..bb1e7be9dd 100644 --- a/mantle/cmd/kola/options.go +++ b/mantle/cmd/kola/options.go @@ -132,7 +132,7 @@ func init() { sv(&kola.PacketOptions.StorageURL, "packet-storage-url", "gs://users.developer.core-os.net/"+os.Getenv("USER")+"/mantle", "Google Storage base URL for temporary uploads") // QEMU-specific options - sv(&kola.QEMUOptions.Firmware, "qemu-firmware", "bios", "Boot firmware: bios,uefi,uefi-secure") + sv(&kola.QEMUOptions.Firmware, "qemu-firmware", "", "Boot firmware: bios,uefi,uefi-secure (default bios)") sv(&kola.QEMUOptions.DiskImage, "qemu-image", "", "path to CoreOS disk image") sv(&kola.QEMUOptions.DiskSize, "qemu-size", "", "Resize target disk via qemu-img resize [+]SIZE") bv(&kola.QEMUOptions.Native4k, "qemu-native-4k", false, "Force 4k sectors for main disk") @@ -162,6 +162,14 @@ func syncOptionsImpl(useCosa bool) error { kolaPlatform = "qemu-unpriv" } + // native 4k requires a UEFI bootloader + if kola.QEMUOptions.Native4k && kola.QEMUOptions.Firmware == "bios" { + return fmt.Errorf("native 4k requires uefi firmware") + } + if kola.QEMUOptions.Firmware == "" { + kola.QEMUOptions.Firmware = "bios" + } + if err := validateOption("platform", kolaPlatform, kolaPlatforms); err != nil { return err } diff --git a/src/cmd-run b/src/cmd-run index 6f4b261d5d..26ad53866f 100755 --- a/src/cmd-run +++ b/src/cmd-run @@ -261,10 +261,6 @@ esac if [ "${IMAGE_TYPE}" == metal4k ]; then kola_args+=("--qemu-native-4k") - # native 4k requires a UEFI bootloader - if [ "${FIRMWARE}" == bios ]; then - FIRMWARE=uefi - fi fi case "${FIRMWARE}" in