Skip to content

Commit d1ba9b1

Browse files
committed
Switch from raw (.fd) EDK2 firmware images to QCOW2, plus 4MB on amd64
The new arm64 firmware supporting Secure Boot (see next commit) is in QCOW2 format only, avoiding the extra space taken up by the 64MB padding. Supporting both raw and QCOW2 images would be messy, so switch entirely to QCOW2. Only the 4MB images are in QCOW2 format on amd64, so also switch away from the 2MB images. 4MB images are now the default for most distributions as they are needed to apply certain Windows updates. Signed-off-by: James Le Cuirot <[email protected]>
1 parent d67c395 commit d1ba9b1

File tree

8 files changed

+24
-25
lines changed

8 files changed

+24
-25
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ jobs:
278278
scripts/artifacts/images/flatcar_production_image*.txt
279279
scripts/artifacts/images/flatcar_production_image*.json
280280
scripts/artifacts/images/flatcar_production_image_pcr_policy.zip
281-
scripts/artifacts/images/flatcar_production_*_efi_*.fd
281+
scripts/artifacts/images/flatcar_production_*_efi_*.qcow2
282282
scripts/artifacts/images/flatcar_production_qemu.sh
283283
284284
- name: Upload developer container
@@ -317,7 +317,7 @@ jobs:
317317
path: |
318318
scripts/artifacts/images/*.img
319319
scripts/artifacts/images/*.bin
320-
scripts/artifacts/images/flatcar_production_*_efi_*.fd
320+
scripts/artifacts/images/flatcar_production_*_efi_*.qcow2
321321
scripts/artifacts/images/*.txt
322322
scripts/artifacts/images/flatcar-*.raw
323323
scripts/artifacts/images/flatcar_production_*.sh

.github/workflows/run-kola-tests.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ jobs:
162162
# Extract the generic image we'll use for qemu tests.
163163
# Note that the qemu[_uefi] tests use the generic image instead of the
164164
# qemu vendor VM image ("Astronaut: [...] Always have been.").
165-
mv flatcar_production_image.bin flatcar_production_qemu_uefi_efi_code.fd flatcar_production_qemu_uefi_efi_vars.fd scripts/
165+
mv flatcar_production_image.bin flatcar_production_qemu_uefi_efi_code.qcow2 flatcar_production_qemu_uefi_efi_vars.qcow2 scripts/
166166
167167
mv flatcar_test_update.gz scripts/
168168
@@ -197,8 +197,8 @@ jobs:
197197
cat > sdk_container/.env <<EOF
198198
# export the QEMU_IMAGE_NAME to avoid to download it.
199199
export QEMU_IMAGE_NAME="/work/flatcar_production_image.bin"
200-
export QEMU_UEFI_FIRMWARE="/work/flatcar_production_qemu_uefi_efi_code.fd"
201-
export QEMU_UEFI_OVMF_VARS="/work/flatcar_production_qemu_uefi_efi_vars.fd"
200+
export QEMU_UEFI_FIRMWARE="/work/flatcar_production_qemu_uefi_efi_code.qcow2"
201+
export QEMU_UEFI_OVMF_VARS="/work/flatcar_production_qemu_uefi_efi_vars.qcow2"
202202
export QEMU_UPDATE_PAYLOAD="/work/flatcar_test_update.gz"
203203
export QEMU_DEVCONTAINER_URL="http://${TESTS_WEBSERVER_IP}:${TESTS_WEBSERVER_PORT}"
204204
export QEMU_DEVCONTAINER_BINHOST_URL="http://${TESTS_WEBSERVER_IP}:${TESTS_WEBSERVER_PORT}"

build_library/qemu_template.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ fi
274274

275275
if [ -n "${VM_PFLASH_RO}" ] && [ -n "${VM_PFLASH_RW}" ]; then
276276
set -- \
277-
-drive if=pflash,unit=0,file="${SCRIPT_DIR}/${VM_PFLASH_RO}",format=raw,readonly=on \
278-
-drive if=pflash,unit=1,file="${SCRIPT_DIR}/${VM_PFLASH_RW}",format=raw "$@"
277+
-drive if=pflash,unit=0,file="${SCRIPT_DIR}/${VM_PFLASH_RO}",format=qcow2,readonly=on \
278+
-drive if=pflash,unit=1,file="${SCRIPT_DIR}/${VM_PFLASH_RW}",format=qcow2 "$@"
279279
fi
280280

281281
if [ -n "${IGNITION_CONFIG_FILE}" ]; then

build_library/vm_image_util.sh

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -825,25 +825,23 @@ _write_qemu_conf() {
825825
}
826826

827827
_write_qemu_uefi_conf() {
828-
local flash_ro="$(_dst_name "_efi_code.fd")"
829-
local flash_rw="$(_dst_name "_efi_vars.fd")"
828+
local flash_ro="$(_dst_name "_efi_code.qcow2")"
829+
local flash_rw="$(_dst_name "_efi_vars.qcow2")"
830830
local script="$(_dst_dir)/$(_dst_name ".sh")"
831831

832832
_write_qemu_conf
833833

834834
case $BOARD in
835835
amd64-usr)
836-
cp "/usr/share/edk2-ovmf/OVMF_CODE.fd" "$(_dst_dir)/${flash_ro}"
837-
cp "/usr/share/edk2-ovmf/OVMF_VARS.fd" "$(_dst_dir)/${flash_rw}"
836+
cp "/usr/share/edk2/OvmfX64/OVMF_CODE_4M.qcow2" "$(_dst_dir)/${flash_ro}"
837+
cp "/usr/share/edk2/OvmfX64/OVMF_VARS_4M.qcow2" "$(_dst_dir)/${flash_rw}"
838838
;;
839839
arm64-usr)
840840
# Get edk2 files into local build workspace.
841841
info "Updating edk2 in /build/${BOARD}"
842842
emerge-${BOARD} --nodeps --select --verbose --update --getbinpkg --newuse sys-firmware/edk2-aarch64
843-
cp "${BOARD_ROOT}/usr/share/AAVMF/AAVMF_CODE.fd" "$(_dst_dir)/${flash_ro}"
844-
cp "${BOARD_ROOT}/usr/share/AAVMF/AAVMF_VARS.fd" "$(_dst_dir)/${flash_rw}"
845-
truncate -s 64M "$(_dst_dir)/${flash_ro}"
846-
truncate -s 64M "$(_dst_dir)/${flash_rw}"
843+
cp "${BOARD_ROOT}/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.qcow2" "$(_dst_dir)/${flash_ro}"
844+
cp "${BOARD_ROOT}/usr/share/edk2/aarch64/vars-template-pflash.qcow2" "$(_dst_dir)/${flash_rw}"
847845
;;
848846
esac
849847

@@ -866,13 +864,13 @@ _write_qemu_uefi_conf() {
866864
}
867865

868866
_write_qemu_uefi_secure_conf() {
869-
local flash_rw="$(_dst_name "_efi_vars.fd")"
870-
local flash_ro="$(_dst_name "_efi_code.fd")"
867+
local flash_rw="$(_dst_name "_efi_vars.qcow2")"
868+
local flash_ro="$(_dst_name "_efi_code.qcow2")"
871869
local script="$(_dst_dir)/$(_dst_name ".sh")"
872870
local owner="00000000-0000-0000-0000-000000000000"
873871

874872
_write_qemu_uefi_conf
875-
cp "/usr/share/edk2-ovmf/OVMF_CODE.secboot.fd" "$(_dst_dir)/${flash_ro}"
873+
cp "/usr/share/edk2/OvmfX64/OVMF_CODE_4M.secboot.qcow2" "$(_dst_dir)/${flash_ro}"
876874

877875
virt-fw-vars \
878876
--inplace "$(_dst_dir)/${flash_rw}" \
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- The UEFI firmware has changed from raw (.fd) format to QCOW2 format. In addition, the amd64 firmware variables are now held in a 4MB image rather than a 2MB image. Note that this firmware is only intended for testing with QEMU. Do not use it in production. ([scripts#2434](https://github.com/flatcar/scripts/pull/2434))

ci-automation/ci-config.env

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ QEMU_FIRMWARE="/usr/share/qemu/bios-256k.bin"
6565

6666
# UEFI firmware filename on build cache.
6767
# Published by vms.sh as part of the qemu vendor build.
68-
QEMU_UEFI_FIRMWARE="${QEMU_UEFI_FIRMWARE:-flatcar_production_qemu_uefi_efi_code.fd}"
69-
QEMU_UEFI_SECURE_FIRMWARE="${QEMU_UEFI_SECURE_FIRMWARE:-flatcar_production_qemu_uefi_secure_efi_code.fd}"
70-
QEMU_UEFI_OVMF_VARS="${QEMU_UEFI_OVMF_VARS:-flatcar_production_qemu_uefi_efi_vars.fd}"
71-
QEMU_UEFI_SECURE_OVMF_VARS="${QEMU_UEFI_SECURE_OVMF_VARS:-flatcar_production_qemu_uefi_secure_efi_vars.fd}"
68+
QEMU_UEFI_FIRMWARE="${QEMU_UEFI_FIRMWARE:-flatcar_production_qemu_uefi_efi_code.qcow2}"
69+
QEMU_UEFI_SECURE_FIRMWARE="${QEMU_UEFI_SECURE_FIRMWARE:-flatcar_production_qemu_uefi_secure_efi_code.qcow2}"
70+
QEMU_UEFI_OVMF_VARS="${QEMU_UEFI_OVMF_VARS:-flatcar_production_qemu_uefi_efi_vars.qcow2}"
71+
QEMU_UEFI_SECURE_OVMF_VARS="${QEMU_UEFI_SECURE_OVMF_VARS:-flatcar_production_qemu_uefi_secure_efi_vars.qcow2}"
7272

7373
# Update payload for the qemu_update.sh test.
7474
# The default path set below is relative to TEST_WORK_DIR

jenkins/kola/qemu_common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if [ "${PLATFORM}" = qemu ]; then
77
BIOS="bios-256k.bin"
88
elif [ "${PLATFORM}" = qemu_uefi ]; then
99
TIMEOUT="14h"
10-
BIOS="/mnt/host/source/tmp/flatcar_production_qemu_uefi_efi_code.fd"
10+
BIOS="/mnt/host/source/tmp/flatcar_production_qemu_uefi_efi_code.qcow2"
1111
else
1212
echo "Unknown platform: \"${PLATFORM}\""
1313
fi

run_local_tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ function set_vars() {
5252
# The local directory ("pwd") will be mounted to /work/ in the container.
5353
cat > sdk_container/.env <<EOF
5454
export QEMU_IMAGE_NAME=/work/__build__/images/images/${arch@Q}-usr/latest/flatcar_production_image.bin
55-
export QEMU_UEFI_FIRMWARE=/work/__build__/images/images/${arch@Q}-usr/latest/flatcar_production_qemu_uefi_efi_code.fd
56-
export QEMU_UEFI_OVMF_VARS=/work/__build__/images/images/${arch@Q}-usr/latest/flatcar_production_qemu_uefi_efi_vars.fd
55+
export QEMU_UEFI_FIRMWARE=/work/__build__/images/images/${arch@Q}-usr/latest/flatcar_production_qemu_uefi_efi_code.qcow2
56+
export QEMU_UEFI_OVMF_VARS=/work/__build__/images/images/${arch@Q}-usr/latest/flatcar_production_qemu_uefi_efi_vars.qcow2
5757
export QEMU_UPDATE_PAYLOAD=/work/__build__/images/images/${arch@Q}-usr/latest/flatcar_test_update.gz
5858
export PARALLEL_TESTS=${parallel@Q}
5959
EOF

0 commit comments

Comments
 (0)