#!/bin/bash
# -*- shell-script -*-
# qemu-sanity-check
-# Copyright (C) 2013 Red Hat Inc.
+# Copyright (C) 2013-2020 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
timeout=10m
accel=kvm:tcg
+# Default machine type depends on arch. You can override this using
+# -m|--machine option.
+case "$canonical_arch" in
+ arm*|aarch*) machine=virt ;;
+ # On non-ARM let qemu pick the default.
+ *) machine= ;;
+esac
+
# Handle command line parsing.
function usage {
echo " --accel=[kvm|tcg] Force KVM or software emulation"
echo " -i|--initrd=initrd Set location of initramfs"
echo " -k|--kernel=vmlinuz Set location of kernel"
+ echo " -m|--machine=machine Set machine type"
echo " -q|--qemu=qemu Set location of qemu/KVM binary"
echo " -t|--timeout=timeout Set the timeout"
echo " -V|--version Display version and exit"
}
TEMP=$(getopt \
- -o i:k:q:t:V \
+ -o i:k:m:q:t:V \
--long help \
--long accel: \
--long initrd: \
--long kernel: \
+ --long machine: \
--long qemu: \
--long timeout: \
--long version \
kernel="$2"
shift 2
;;
+ -m|--machine)
+ machine="$2"
+ shift 2
+ ;;
-q|--qemu)
qemu="$2"
shift 2
argv[$((i++))]="-no-user-config"
argv[$((i++))]="-nodefaults"
argv[$((i++))]="-machine"
-argv[$((i++))]="accel=$accel"
+argv[$((i++))]="$machine${machine:+,}accel=$accel"
argv[$((i++))]="-no-reboot"
argv[$((i++))]="-serial"
argv[$((i++))]="file:$test_output"
Use the kernel image C<VMLINUZ> instead of searching for the latest
kernel installed in C</boot>.
+=item B<-m> MACHINE
+
+=item B<--machine>=MACHINE
+
+Set the qemu I<-m> (machine type) option. If not set then a suitable
+default is picked depending on the architecture. You can also use
+I<--machine=> to let qemu pick the default.
+
=item B<-q> QEMU
=item B<--qemu>=QEMU
=head1 COPYRIGHT
-(C) Copyright 2013 Red Hat Inc.
+(C) Copyright 2013-2020 Red Hat Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by