[kvm-unit-tests PATCH v3 03/16] configure: Export TARGET unconditionally
Alexandru Elisei
alexandru.elisei at arm.com
Thu May 8 01:12:43 AEST 2025
Only arm and arm64 are allowed to set --target to kvmtool; the rest of the
architectures can only set --target to 'qemu', which is also the default.
Needed to make the changes necessary to add support for kvmtool to the test
runner.
kvmtool also supports running the riscv tests, so it's not outside of the
realm of the possibily for the riscv tests to get support for kvmtool.
Signed-off-by: Alexandru Elisei <alexandru.elisei at arm.com>
---
configure | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/configure b/configure
index 20bf5042cb9e..8c4400db42bc 100755
--- a/configure
+++ b/configure
@@ -38,6 +38,21 @@ function get_default_qemu_cpu()
esac
}
+# Return the targets that the architecture supports
+function get_supported_targets()
+{
+ local arch=$1
+
+ case "$arch" in
+ "arm" | "arm64" | "aarch64")
+ echo "qemu kvmtool"
+ ;;
+ *)
+ echo "qemu"
+ ;;
+ esac
+}
+
srcdir=$(cd "$(dirname "$0")"; pwd)
prefix=/usr/local
cc=gcc
@@ -79,6 +94,7 @@ fi
usage() {
[ "$arch" = "aarch64" ] && arch="arm64"
[ -z "$processor" ] && processor=$(get_default_processor $arch)
+ [ -z $target ] && target=qemu
cat <<-EOF
Usage: $0 [options]
@@ -89,8 +105,8 @@ usage() {
--target-cpu=CPU the CPU model to run on. If left unset, the run script
selects the best value based on the host system and the
test configuration.
- --target=TARGET target platform that the tests will be running on (qemu or
- kvmtool, default is qemu) (arm/arm64 only)
+ --target=TARGET target platform that the tests will be running on ($target).
+ Supported targets: $(get_supported_targets $arch)
--cross-prefix=PREFIX cross compiler prefix
--cc=CC c compiler to use ($cc)
--cflags=FLAGS extra options to be passed to the c compiler
@@ -281,13 +297,11 @@ if [ "$arch" = "riscv" ]; then
exit 1
fi
-if [ -z "$target" ]; then
- target="qemu"
-else
- if [ "$arch" != "arm64" ] && [ "$arch" != "arm" ]; then
- echo "--target is not supported for $arch"
- usage
- fi
+if [ -z $target ]; then
+ target=qemu
+elif ! grep -Fq " $target " <<< " $(get_supported_targets $arch) "; then
+ echo "Target $target is not supported for $arch"
+ usage
fi
if [ "$efi" ] && [ "$arch" != "x86_64" ] &&
@@ -519,10 +533,8 @@ CONFIG_EFI=$efi
EFI_DIRECT=$efi_direct
CONFIG_WERROR=$werror
GEN_SE_HEADER=$gen_se_header
+TARGET=$target
EOF
-if [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
- echo "TARGET=$target" >> config.mak
-fi
cat <<EOF > lib/config.h
#ifndef _CONFIG_H_
--
2.49.0
More information about the Linuxppc-dev
mailing list