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

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

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

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