This should make it easier to set up and possibly provide a "work out of
the box" experience for most test usage. Typical wan&lan networking
setup is only two characters argument away.
Cc: Petr Štetiar <ynezz@true.cz>
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Acked-by: Hans Dedecker <dedeckeh@gmail.com>
- [ -z "$o_nonetwork" ] || return 0
+ [ -n "$o_network" ] || return 0
check_setup_ || {
__errmsg "please check the script content to see the environment requirement"
return 1
check_setup_ || {
__errmsg "please check the script content to see the environment requirement"
return 1
[--kernel <kernel>]
[--rootfs <rootfs>]
[--machine <machine>]
[--kernel <kernel>]
[--rootfs <rootfs>]
[--machine <machine>]
<subtarget> will default to "generic" and must be specified if
<extra-qemu-options> are present
<subtarget> will default to "generic" and must be specified if
<extra-qemu-options> are present
o_qemu_extra=()
while [ "$#" -gt 0 ]; do
case "$1" in
o_qemu_extra=()
while [ "$#" -gt 0 ]; do
case "$1" in
- --no-network|-n) o_nonetwork=1; shift ;;
--kernel) o_kernel="$2"; shift 2 ;;
--rootfs) o_rootfs="$2"; shift 2 ;;
--machine|-machine|-M) o_mach="$2"; shift 2 ;;
--kernel) o_kernel="$2"; shift 2 ;;
--rootfs) o_rootfs="$2"; shift 2 ;;
--machine|-machine|-M) o_mach="$2"; shift 2 ;;
+ --network|-n) o_network=1; shift ;;
- [ -n "$o_nonetwork" ] || {
+ [ -z "$o_network" ] || {
o_qemu_extra+=( \
"-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
"-device" "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \
o_qemu_extra+=( \
"-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
"-device" "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \
# 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
# 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
- [ -n "$o_nonetwork" ] || {
+ [ -z "$o_network" ] || {
o_qemu_extra+=( \
"-netdev" "bridge,id=wan,br=$BR_WAN,helper=$HELPER" "-device" \
"virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN" \
o_qemu_extra+=( \
"-netdev" "bridge,id=wan,br=$BR_WAN,helper=$HELPER" "-device" \
"virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN" \
- [ -n "$o_nonetwork" ] || {
+ [ -z "$o_network" ] || {
o_qemu_extra+=( \
"-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
"-device" "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \
o_qemu_extra+=( \
"-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
"-device" "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \