x86-run 943 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/bash

qemukvm="${QEMU:-qemu-kvm}"
qemusystem="${QEMU:-qemu-system-x86_64}"
if
	${qemukvm} -device '?' 2>&1 | fgrep -e \"testdev\" -e \"pc-testdev\" > /dev/null;
then
	qemu="${qemukvm}"
else
	if
11
		${qemusystem} -device '?' 2>&1 | fgrep -e \"testdev\" -e \"pc-testdev\" > /dev/null;
12
13
14
15
	then
		qemu="${qemusystem}"
	else
		echo QEMU binary ${QEMU} has no support for test device. Exiting.
Kevin Wolf's avatar
Kevin Wolf committed
16
		exit 2
17
18
19
	fi
fi

20
21
22
23
24
25
26
if ${qemu} -device '?' 2>&1 | fgrep pci-testdev > /dev/null;
then
	pci_testdev="-device pci-testdev"
else
	pci_testdev=""
fi

27
28
29
if
	${qemu} -device '?' 2>&1 | fgrep "pc-testdev" > /dev/null;
then
30
	pc_testdev="-device pc-testdev -device isa-debug-exit,iobase=0xf4,iosize=0x4"
31
else
32
	pc_testdev="-device testdev,chardev=testlog -chardev file,id=testlog,path=msr.out"
33
fi
Kevin Wolf's avatar
Kevin Wolf committed
34

35
command="${qemu} -enable-kvm $pc_testdev -serial stdio $pci_testdev -kernel"
Kevin Wolf's avatar
Kevin Wolf committed
36
37
38
39
40
echo ${command} "$@"
${command} "$@"
ret=$?
echo Return value from qemu: $ret
exit $ret