[OpenWrt-Devel] [PATCH 2/2] scripts/qemustart: fix network device emulation

Yousong Zhou yszhou4tech at gmail.com
Thu Apr 25 10:29:06 EDT 2019


We only enabled pcnet driver for malta machine, and x86/legacy target
was supposed to only support e1000 model

Cc: Petr Štetiar <ynezz at true.cz>
Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
 scripts/qemustart | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/scripts/qemustart b/scripts/qemustart
index f0ffc64734..64a6ebf17b 100755
--- a/scripts/qemustart
+++ b/scripts/qemustart
@@ -232,11 +232,9 @@ start_qemu_malta() {
 	# one will be actually used as the wan, lan network interface inside the
 	# guest machine
 	[ -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" \
-			"-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=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"
 		)
 	}
 
@@ -279,12 +277,20 @@ start_qemu_x86() {
 	}
 
 	[ -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" \
-			"-netdev" "bridge,id=wan,br=$BR_WAN,helper=$HELPER" "-device" \
-			    "virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN" \
-		)
+		case "${o_subtarget%-*}" in
+			legacy)
+				o_qemu_extra+=(
+					-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"
+				)
+				;;
+			generic|64)
+				o_qemu_extra+=(
+					-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"
+				)
+				;;
+		esac
 	}
 
 	case "${o_subtarget%-*}" in

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list