[<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
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
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
start_qemu_armvirt() {
local kernel="$o_kernel"
local rootfs="$o_rootfs"
+ local mach="${o_mach:-virt}"
local cpu
local qemu_exe
)
}
- "$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" \
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)"
# 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" \
start_qemu_x86() {
local rootfs="$o_rootfs"
+ local mach="${o_mach:-pc}"
local qemu_exe
[ -n "$rootfs" ] || {
# 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"
# -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 \
"${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" \