aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/qemustart
diff options
context:
space:
mode:
authorYousong Zhou <yszhou4tech@gmail.com>2019-02-19 06:31:54 +0000
committerYousong Zhou <yszhou4tech@gmail.com>2019-02-22 01:35:05 +0000
commit73c60ef239619784964e9a88c7a361ebd0c425c6 (patch)
treee74e5ef5b19252840e9886273e4f130c26920a1b /scripts/qemustart
parent2d139450a3be401e11c2a2b6f817bdf6c421d6db (diff)
downloadupstream-73c60ef239619784964e9a88c7a361ebd0c425c6.tar.gz
upstream-73c60ef239619784964e9a88c7a361ebd0c425c6.tar.bz2
upstream-73c60ef239619784964e9a88c7a361ebd0c425c6.zip
scripts/qemustart: allow machine selection with new option --machine
This can be used to set machine options like highmem=off for running old armvirt/32 kernel lacking LPAE support with QEMU version 3.0 or later [1] Armv7 guest fails to boot with qemu-3.0.0-1, https://bugzilla.redhat.com/show_bug.cgi?id=1633328#c5 Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Diffstat (limited to 'scripts/qemustart')
-rwxr-xr-xscripts/qemustart18
1 files changed, 12 insertions, 6 deletions
diff --git a/scripts/qemustart b/scripts/qemustart
index 5bb8ca5f3a..b68e8bb011 100755
--- a/scripts/qemustart
+++ b/scripts/qemustart
@@ -88,6 +88,7 @@ Usage: $SELF [-h|--help]
[<subtarget> [<extra-qemu-options>]]
[--kernel <kernel>]
[--rootfs <rootfs>]
+ [--machine <machine>]
<subtarget> will default to "generic" and must be specified if
<extra-qemu-options> are present
@@ -100,13 +101,14 @@ the actual <target> in use. They will default to files under bin/targets/
Examples
$SELF x86 64
- $SELF x86 64 -enable-kvm -device virtio-balloon-pci
+ $SELF x86 64 --machine q35,accel=kvm -device virtio-balloon-pci
$SELF x86 64 -incoming tcp:0:4444
$SELF x86 64-glibc
$SELF malta be -m 64
$SELF malta le64
$SELF malta be-glibc
$SELF armvirt 32 \\
+ --machine virt,highmem=off \\
--kernel bin/targets/armvirt/32/openwrt-armvirt-32-zImage \\
--rootfs bin/targets/armvirt/32/openwrt-armvirt-32-root.ext4
EOF
@@ -122,6 +124,7 @@ parse_args() {
case "$1" in
--kernel) o_kernel="$2"; shift 2 ;;
--rootfs) o_rootfs="$2"; shift 2 ;;
+ --machine|-machine|-M) o_mach="$2"; shift 2 ;;
--help|-h)
usage
exit 0
@@ -152,6 +155,7 @@ parse_args() {
start_qemu_armvirt() {
local kernel="$o_kernel"
local rootfs="$o_rootfs"
+ local mach="${o_mach:-virt}"
local cpu
local qemu_exe
@@ -181,7 +185,7 @@ start_qemu_armvirt() {
)
}
- "$qemu_exe" -machine virt -cpu "$cpu" -nographic \
+ "$qemu_exe" -machine "$mach" -cpu "$cpu" -nographic \
-netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device virtio-net-pci,id=devlan,netdev=lan,mac="$MAC_LAN" \
-netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device virtio-net-pci,id=devwan,netdev=wan,mac="$MAC_WAN" \
-kernel "$kernel" \
@@ -193,6 +197,7 @@ start_qemu_malta() {
local isel
local qemu_exe
local kernel="$o_kernel"
+ local mach="${o_mach:-malta}"
# o_subtarget can be le, be, le64, be64, le-glibc, le64-glibc, etc..
is64="$(echo $o_subtarget | grep -o 64)"
@@ -204,7 +209,7 @@ start_qemu_malta() {
# NOTE: order of wan, lan -device arguments matters as it will affect which
# one will be actually used as the wan, lan network interface inside the
# guest machine
- "$qemu_exe" -machine malta -nographic \
+ "$qemu_exe" -machine "$mach" -nographic \
-netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device pcnet,netdev=wan,mac="$MAC_WAN" \
-netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device pcnet,netdev=lan,mac="$MAC_LAN" \
-kernel "$kernel" \
@@ -213,6 +218,7 @@ start_qemu_malta() {
start_qemu_x86() {
local rootfs="$o_rootfs"
+ local mach="${o_mach:-pc}"
local qemu_exe
[ -n "$rootfs" ] || {
@@ -227,7 +233,7 @@ start_qemu_x86() {
# 64: 64-bit, kvm guest, virtio
#
case "${o_subtarget%-*}" in
- legacy) qemu_exe="qemu-system-i386" ;;
+ legacy) qemu_exe="qemu-system-i386" ;;
generic|64) qemu_exe="qemu-system-x86_64" ;;
*)
__errmsg "target $o_target: unknown subtarget $o_subtarget"
@@ -247,7 +253,7 @@ start_qemu_x86() {
# -drive "file=$rootfs,format=raw,id=drv0,if=none" \
#
# [1] https://dev.openwrt.org/ticket/17947
- "$qemu_exe" -nographic \
+ "$qemu_exe" -machine "$mach" -nographic \
-netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device e1000,id=devlan,netdev=lan,mac="$MAC_LAN" \
-netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device e1000,id=devwan,netdev=wan,mac="$MAC_WAN" \
-device ide-drive,drive=drv0 \
@@ -255,7 +261,7 @@ start_qemu_x86() {
"${o_qemu_extra[@]}"
;;
generic|64)
- "$qemu_exe" -nographic \
+ "$qemu_exe" -machine "$mach" -nographic \
-netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device virtio-net-pci,id=devlan,netdev=lan,mac="$MAC_LAN" \
-netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device virtio-net-pci,id=devwan,netdev=wan,mac="$MAC_WAN" \
-drive "file=$rootfs,format=raw,if=virtio" \