diff mbox series

[3/3] runqemu: Add QB_KERNEL_NO_NETWORK_CONFIG variable

Message ID 20190628033830.27713-3-anibal.limon@linaro.org
State Superseded
Headers show
Series [1/3] runqemu: Allow to store more than one lock for network interfaces | expand

Commit Message

Anibal Limon June 28, 2019, 3:38 a.m. UTC
To let user choice if wants to have network configured via Kernel
cmdline.

Signed-off-by: Aníbal Limón <anibal.limon@linaro.org>
---
 meta/classes/qemuboot.bbclass |  3 +++
 scripts/runqemu               | 10 ++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes/qemuboot.bbclass b/meta/classes/qemuboot.bbclass
index 15a9e63f2b..5df63a6a61 100644
--- a/meta/classes/qemuboot.bbclass
+++ b/meta/classes/qemuboot.bbclass
@@ -41,6 +41,8 @@ 
 #             "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no"
 #              Note, runqemu will replace "@TAP@" with the one which is used, such as tap0, tap1 ...
 #
+# QB_KERNEL_NO_NETWORK_CONFIG: disable auto network configuration via kernel cmdline possible values 'True' and 'False'
+#
 # QB_SLIRP_OPT: network option for SLIRP mode, e.g., -netdev user,id=net0"
 #
 # QB_ROOTFS_OPT: used as rootfs, e.g.,
@@ -63,6 +65,7 @@  QB_DEFAULT_KERNEL ?= "${KERNEL_IMAGETYPE}"
 QB_DEFAULT_FSTYPE ?= "ext4"
 QB_OPT_APPEND ?= "-show-cursor"
 QB_NETWORK_DEVICE ?= "-device virtio-net-pci,netdev=net0,mac=@MAC@"
+QB_KERNEL_NO_NETWORK_CONFIG ?= "False"
 
 # This should be kept align with ROOT_VM
 QB_DRIVE_TYPE ?= "/dev/sd"
diff --git a/scripts/runqemu b/scripts/runqemu
index e1a78c8910..5d6804233f 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -1067,10 +1067,12 @@  class BaseConfig(object):
             gateway = tapnum * 2 + 1
             client = gateway + 1
 
-            if tap_idx == 0:
-                netconf = "192.168.7.%s::192.168.7.%s:255.255.255.0::eth%d" % (client, gateway, tap_idx)
-                logger.info("Network configuration: %s", netconf)
-                self.kernel_cmdline_script += " ip=%s" % netconf
+            no_network = self.get('QB_KERNEL_NO_NETWORK_CONFIG')
+            if no_network and not no_network.lower() == 'true':
+                if tap_idx == 0:
+                    netconf = "192.168.7.%s::192.168.7.%s:255.255.255.0::eth%d" % (client, gateway, tap_idx)
+                    logger.info("Network configuration: %s", netconf)
+                    self.kernel_cmdline_script += " ip=%s" % netconf
 
             mac = "%s%02x" % (self.mac_tap, client)
             qemu_tap_opt = qemu_tap_opt.replace('@TAP@', tap, 1)