qemu: add option to enable SLiRP user networking
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
[Rebase on top of master]
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
diff --git a/common.mk b/common.mk
index 48cd45b..6478d8b 100644
--- a/common.mk
+++ b/common.mk
@@ -29,6 +29,8 @@
QEMU_VIRTFS_ENABLE ?= n
QEMU_VIRTFS_HOST_DIR ?= $(ROOT)
+# Enable SLiRP user networking
+QEMU_USERNET_ENABLE ?= n
################################################################################
# Check coherency of compilation mode
################################################################################
@@ -196,6 +198,11 @@
-fsdev local,id=fsdev0,path=$(QEMU_VIRTFS_HOST_DIR),security_model=none \
-device virtio-9p-device,fsdev=fsdev0,mount_tag=host
endif
+
+ifeq ($(QEMU_USERNET_ENABLE),y)
+QEMU_EXTRA_ARGS +=\
+ -netdev user,id=vmnic -device virtio-net-device,netdev=vmnic
+endif
################################################################################
# OP-TEE
################################################################################
@@ -301,6 +308,10 @@
"$(HELLOWORLD_PATH)/ta/8aaaf200-2450-11e4-abe2-0002a5d5c51b.ta" \
"444 0 0" >> $(fl); \
fi
+ @if [ "$(QEMU_USERNET_ENABLE)" = "y" ]; then \
+ echo "slink /etc/rc.d/S02_udhcp_networking /etc/init.d/udhcpc 755 0 0" \
+ >> $(fl); \
+ fi
@echo "# Secure storage dir" >> $(fl)
@echo "dir /data 755 0 0" >> $(fl)
@echo "dir /data/tee 755 0 0" >> $(fl)