1#!/usr/bin/env bash 2 3if [ -z "$KUT_STANDALONE" ]; then 4 if [ ! -f config.mak ]; then 5 echo "run ./configure && make first. See ./configure -h" 6 exit 2 7 fi 8 source config.mak 9 source scripts/arch-run.bash 10fi 11 12# Allow user overrides of some config.mak variables 13processor=$PROCESSOR_OVERRIDE 14firmware=$FIRMWARE_OVERRIDE 15 16[ "$PROCESSOR" = "$ARCH" ] && PROCESSOR="max" 17: "${processor:=$PROCESSOR}" 18: "${firmware:=$FIRMWARE}" 19[ "$firmware" ] && firmware="-bios $firmware" 20 21set_qemu_accelerator || exit $? 22[ "$ACCEL" = "kvm" ] && QEMU_ARCH=$HOST 23acc="-accel $ACCEL$ACCEL_PROPS" 24 25qemu=$(search_qemu_binary) || exit $? 26if ! $qemu -machine '?' | grep -q 'RISC-V VirtIO board'; then 27 echo "$qemu doesn't support mach-virt ('-machine virt'). Exiting." 28 exit 2 29fi 30mach='-machine virt' 31 32command="$qemu -nodefaults -nographic -serial mon:stdio" 33command+=" $mach $acc $firmware -cpu $processor " 34command="$(migration_cmd) $(timeout_cmd) $command" 35 36if [ "$UEFI_SHELL_RUN" = "y" ]; then 37 ENVIRON_DEFAULT=n run_qemu_status $command "$@" 38else 39 # We return the exit code via stdout, not via the QEMU return code 40 run_qemu_status $command -kernel "$@" 41fi 42