Use u-boot.bin at crosvm tests
Exercise u-boot, at host VM load time for now, to make sure it's
working.
Test: make test passes on test-crosvm-pkvm-helloworld, other tests
aren't broken either.
Fixes: 181212750
Change-Id: I8facf2367768bad9fefca19921bc14dc98548e6e
diff --git a/Makefile b/Makefile
index 0d05b19..f9895ad 100644
--- a/Makefile
+++ b/Makefile
@@ -56,7 +56,7 @@
ifdef KERNEL_IMAGE
CUSTOM_KERNEL_IMAGE = 1
else
-KERNEL_IMAGE := $(LINUX_OUT)/arch/arm64/boot/Image.gz
+KERNEL_IMAGE := $(LINUX_OUT)/arch/arm64/boot/Image
endif
##
@@ -296,6 +296,7 @@
O=$(UBOOT_OUT)
UBOOT_CONFIG := $(UBOOT_OUT)/.config
+UBOOT_BIN := $(UBOOT_OUT)/u-boot.bin
.PHONY: u-boot_defconfig
u-boot_defconfig $(UBOOT_CONFIG):
@@ -306,7 +307,7 @@
+ $(UBOOT_MAKE) menuconfig
.PHONY: u-boot
-u-boot: $(UBOOT_CONFIG)
+u-boot $(UBOOT_BIN): $(UBOOT_CONFIG)
+ $(UBOOT_MAKE)
.PHONY: u-boot_clean
@@ -406,6 +407,7 @@
define gen_crosvm_helloworld_test
$(KUT_RUN_TEST) -d $(1) $(2) -t 300s \
-k $(KERNEL_IMAGE) \
+ -F $(UBOOT_BIN) \
-o $(CROSVM_HELLOWORLD_LOG_DIR)/$(1).log \
$(CROSVM_HELLOWORLD_SCRIPT_DIR)/host.sh -- \
-R $(CROSVM_HELLOWORLD_SCRIPT_DIR)/guest.sh \
@@ -425,13 +427,13 @@
@ for x in $(CROSVM_HELLOWORLD_TESTS); do echo $x; done
.PHONY: test-crosvm-vhe-helloworld
-test-crosvm-vhe-helloworld: $(KERNEL_IMAGE)
+test-crosvm-vhe-helloworld: $(KERNEL_IMAGE) $(UBOOT_BIN)
@ $(call gen_crosvm_helloworld_test,$@,-V)
.PHONY: test-crosvm-nvhe-helloworld
-test-crosvm-nvhe-helloworld: $(KERNEL_IMAGE)
+test-crosvm-nvhe-helloworld: $(KERNEL_IMAGE) $(UBOOT_BIN)
@ $(call gen_crosvm_helloworld_test,$@,-N)
.PHONY: test-crosvm-pkvm-helloworld
-test-crosvm-pkvm-helloworld: $(KERNEL_IMAGE)
+test-crosvm-pkvm-helloworld: $(KERNEL_IMAGE) $(UBOOT_BIN)
@ $(call gen_crosvm_helloworld_test,$@,)
diff --git a/kvm-unit-tests/run_test.sh b/kvm-unit-tests/run_test.sh
index 1e224f1..0cff0eb 100755
--- a/kvm-unit-tests/run_test.sh
+++ b/kvm-unit-tests/run_test.sh
@@ -22,6 +22,7 @@
default_var GDB 0
default_var KVM_PROTECTED 1
default_var KERNEL ""
+default_var FIRMWARE ""
default_var TEST_PATH ""
default_var DISPLAY_NAME ""
default_var OUTPUT ""
@@ -39,7 +40,7 @@
cat <<EOF
Usage: $0 [-h] [-v] [-q] [-G] [-V]
- [-k KERNEL] [-d DISPLAY_NAME] [-o OUTPUT] [-t TIMEOUT]
+ [-k KERNEL] [-F firmware] [-d DISPLAY_NAME] [-o OUTPUT] [-t TIMEOUT]
PATH [-- RUN_QEMU_ARGS]
PATH Path to test binary. Basenames are resolved in the default output folder.
@@ -47,6 +48,7 @@
-v Print invoked command
-q Print only the result of the test
-k Kernel image
+ -F Firmware
-d Override test name displayed in result
-o Redirect stdout/stderr output to given file (implies -q)
-t kill test after given number of seconds
@@ -56,9 +58,10 @@
EOF
}
-while getopts ":k:d:o:t:vVNGqh" OPT; do
+while getopts ":k:F:d:o:t:vVNGqh" OPT; do
case "${OPT}" in
k) KERNEL="${OPTARG}" ;;
+ F) FIRMWARE="${OPTARG}" ;;
d) DISPLAY_NAME="${OPTARG}" ;;
t) TIMEOUT="${OPTARG}" ;;
v) VERBOSE=1 ;;
@@ -123,6 +126,10 @@
CMD+=(-k "${KERNEL}")
fi
+if [ -n "${FIRMWARE}" ]; then
+ CMD+=(-F "${FIRMWARE}")
+fi
+
if [ "${GDB}" -eq 1 ]; then
CMD+=(-G)
# Disable timeout unless overridden by user.