Skip to contentSkip to conversation

runqemu: disable network

PATCH New Juro Bystricky 1 participant 2 messages Jan 30, 2017

lore
Share & tools
lore
#0 lore raw

v2 cover runqemu: disable network

Not all QEMU machines support network hardware emulation.
Those machines cannot be run by "runqemu", as network hardware is implicitly always assumed. Trying to run them using "runqemu" would end up in raise Exception('Failed to run %s' % cmd)

There is no way to disable network setup using qemuboot.conf nor command line argument.

The patch for runqemu contains a simple fix that can disable the network using qemuboot.conf, all that is required is to set the pre-existing variable QB_NETWORK_DEVICE to "none".

A slightly more complex patch could contain support for command line argument "nonetwork", similar to "nographic

Juro Bystricky (1):
runqemu: allow bypassing of network setup

 meta/classes/qemuboot.bbclass | 3 ++-
 scripts/runqemu               | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/1 runqemu: allow bypassing of network setup

At present it is silently assumed all QEMU machines support networking. As a consequence, one cannot run QEMUs without network emulation using "runqemu".
This patch allows bypassing any network setup providing the user specifies:

QB_NETWORK_DEVICE = "none"

[YOCTO#10661]

---
 meta/classes/qemuboot.bbclass | 3 ++-
 scripts/runqemu               | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)
meta/classes/qemuboot.bbclass +2 -1
index 3ca97ca..4deb201 100644
@@ -36,8 +36,9 @@
 #                    Note, runqemu will replace @MAC@ with a predefined mac, you can set
 #                    a custom one, but that may cause conflicts when multiple qemus are
 #                    running on the same host.
+#                    Set to "none" if qemu has no network support.
 #
-# QB_TAP_OPT: netowrk option for 'tap' mode, e.g.,
+# QB_TAP_OPT: network option for 'tap' mode, e.g.,
 #             "-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 ...
 #
scripts/runqemu +3 -0
index 3d475d3..c846727 100755
@@ -894,6 +894,9 @@ class BaseConfig(object):
         self.set('NETWORK_CMD', '%s %s' % (self.network_device.replace('@MAC@', mac), qemu_tap_opt))
 
     def setup_network(self):
+        if self.get('QB_NETWORK_DEVICE') == 'none':
+            return
+
         cmd = "stty -g"
         self.saved_stty = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8')
         self.network_device = self.get('QB_NETWORK_DEVICE') or self.network_device
Signature · 1 line
2.7.4