diff mbox series

[kvm-unit-tests,v2,09/10] x86 UEFI: Improve Boot Speed

Message ID 20211116204053.220523-10-zxwang42@gmail.com (mailing list archive)
State New, archived
Headers show
Series x86_64 UEFI set up process refactor and scripts fixes | expand

Commit Message

Zixuan Wang Nov. 16, 2021, 8:40 p.m. UTC
From: Zixuan Wang <zxwang42@gmail.com>

The previous runner script uses `startup.nsh` to specify the EFI
binaries. When a UEFI firmware sees this script, it waits 5 seconds for
user input before executing the script.

To remove this 5-second waiting, this commit drops the `startup.nsh`
script, and renames test case binaries as UEFI's default binary filename
`EFI/BOOT/BOOTX64.EFI`. This does not trigger the 5-second waiting.

This commit only fix the boot speed for x86/efi/run script. The
run-tests.sh will be fixed by the follow-up patch.

Signed-off-by: Zixuan Wang <zxwang42@gmail.com>
---
 x86/efi/run | 30 +++++++-----------------------
 1 file changed, 7 insertions(+), 23 deletions(-)
diff mbox series

Patch

diff --git a/x86/efi/run b/x86/efi/run
index e6486ed..a888979 100755
--- a/x86/efi/run
+++ b/x86/efi/run
@@ -30,32 +30,16 @@  fi
 shift 1
 
 # Prepare EFI boot file system
-#   - Copy .efi file to host dir $EFI_TEST/$EFI_CASE/
+#   - Copy .efi file to host dir $EFI_TEST/$EFI_CASE/EFI/BOOT/BOOTX64.EFI
 #     This host dir will be loaded by QEMU as a FAT32 image
-#   - Make UEFI startup script that runs the .efi on boot
-mkdir -p "$EFI_TEST/$EFI_CASE/"
-if [ $EFI_CASE != "_NO_FILE_4Uhere_" ]; then
-  cp "$EFI_SRC/$EFI_CASE.efi" "$EFI_TEST/$EFI_CASE/"
-else
-  touch "$EFI_TEST/$EFI_CASE/$EFI_CASE.efi"
-fi
+#   - UEFI firmware by default loads the file EFI/BOOT/BOOTX64.EFI
+: "${EFI_CASE_DIR:="$EFI_TEST/$EFI_CASE/EFI/BOOT"}"
+: "${EFI_CASE_BINARY:="$EFI_CASE_DIR/BOOTX64.EFI"}"
 
-pushd "$EFI_TEST/$EFI_CASE" || exit 2
-# 'startup.nsh' is the default script executed by UEFI on boot
-# Use this script to run the test binary automatically
-if [ $EFI_CASE != "_NO_FILE_4Uhere_" ]; then
-  cat << EOF >startup.nsh
-@echo -off
-fs0:
-"$EFI_CASE.efi"
-EOF
-else
-  cat << EOF >startup.nsh
-@echo -off
-reset -s
-EOF
+mkdir -p "$EFI_CASE_DIR"
+if [ "$EFI_CASE" != "_NO_FILE_4Uhere_" ]; then
+	cp "$EFI_SRC/$EFI_CASE.efi" "$EFI_CASE_BINARY"
 fi
-popd || exit 2
 
 # Run test case with 256MiB QEMU memory. QEMU default memory size is 128MiB.
 # After UEFI boot up and we call `LibMemoryMap()`, the largest consecutive