From 9008cbccba04d4e5a835021964c0f4638fe6f408 Mon Sep 17 00:00:00 2001 From: Miguel Bernal Marin Date: Thu, 25 Oct 2018 16:35:00 -0500 Subject: [PATCH] start_qemu.sh: enable OVMF CODE and VARS usage Currently, we use the traditional BIOS flag "-bios" to specify the OVMF firmware device file. Ken proposes changing to pflash type BIOS and separate BIOS code and variable. -drive file=OVMF_CODE.fd,if=pflash,format=raw,unit=0,readonly=on \ -drive file=OVMF_VARS.fd,if=pflash,format=raw,unit=1 \ Ken has following reasons: 1. -bios can only support single flash binary, but the actual BIOS binary is consisted by many parts like SEC, PEI(Boot Block), DXE(Main Block) and Variable area as non-volatile storage for BIOS settings. During OMVF booting, a file called NvVars.bin will be created at //NvVars.bin for BIOS variable storage. This will pollute original Clearlinux-xxx.img. 2. In future, we can add secure signed SEC BIOS part to enable full secure boot for Clear Linux via pflash. 3. Some version of open stack, it requires separate Var Store NV instead of OVMF.fd. Ken meet with this issue recently. So if can show the separate pflash BIOS file via start_qemu.sh as example. Suggested-by: "Lu, Ken" --- start_qemu.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/start_qemu.sh b/start_qemu.sh index f811728..6b074a2 100755 --- a/start_qemu.sh +++ b/start_qemu.sh @@ -43,11 +43,19 @@ if [ ! -f "$IMAGE" ]; then fi rm -f debug.log +# 10/25/2018: keep back compatibility for a while +UEFI_BIOS="-bios OVMF.fd" + +if [ -f OVMF_VARS.fd -a -f OVMF_CODE.fd ]; then + UEFI_BIOS=" -drive file=OVMF_CODE.fd,if=pflash,format=raw,unit=0,readonly=on " + UEFI_BIOS+=" -drive file=OVMF_VARS.fd,if=pflash,format=raw,unit=1 " +fi + VMN=${VMN:=1} qemu-system-x86_64 \ -enable-kvm \ - -bios OVMF.fd \ + ${UEFI_BIOS} \ -smp sockets=1,cpus=4,cores=2 -cpu host \ -m 1024 \ -vga none -nographic \