mirror of
https://git.yoctoproject.org/poky
synced 2026-05-01 06:32:11 +02:00
runqemu: support multiple NICs
Emulating more than one network interface with runqemu is a bit tricky,
but possible. For example, the following leads to an emulated device with
eth0 and eth1:
QB_NETWORK_DEVICE_prepend = " \
-device virtio-net-device,mac=52:54:00:12:34:03 \
"
or
QB_NETWORK_DEVICE_append = " \
-device virtio-net-pci,mac=52:54:00:12:34:03 \
"
When booting Qemu with two NICs, the kernel does not know which
interface the specified ip=192.168.7.... command line argument
should be applied. This delays the boot process for a very long
time and a guest wihtout IP configuration.
This add two new configuraton parameters to runqemu:
QB_CMDLINE_IP_SLIRP and QB_CMDLINE_IP_TAP to explicitely specify the ip=
kernel command line arguments for tap and slirp mode.
Note: Simply adding "::eth0" broke some builds on the Yocto autobuilder.
(From OE-Core rev: 59bfdc331c1494c05ab38804b281878a1f571f6d)
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
8afdc80989
commit
2f6a47c4d4
@@ -185,6 +185,8 @@ class BaseConfig(object):
|
||||
self.vmtypes = ('hddimg', 'iso')
|
||||
self.fsinfo = {}
|
||||
self.network_device = "-device e1000,netdev=net0,mac=@MAC@"
|
||||
self.cmdline_ip_slirp = "ip=dhcp"
|
||||
self.cmdline_ip_tap = "ip=192.168.7.@CLIENT@::192.168.7.@GATEWAY@:255.255.255.0"
|
||||
# Use different mac section for tap and slirp to avoid
|
||||
# conflicts, e.g., when one is running with tap, the other is
|
||||
# running with slirp.
|
||||
@@ -1032,7 +1034,9 @@ class BaseConfig(object):
|
||||
|
||||
if self.fstype == 'nfs':
|
||||
self.setup_nfs()
|
||||
self.kernel_cmdline_script += ' ip=dhcp'
|
||||
netconf = " " + self.cmdline_ip_slirp
|
||||
logger.info("Network configuration:%s", netconf)
|
||||
self.kernel_cmdline_script += netconf
|
||||
# Port mapping
|
||||
hostfwd = ",hostfwd=tcp::2222-:22,hostfwd=tcp::2323-:23"
|
||||
qb_slirp_opt_default = "-netdev user,id=net0%s,tftp=%s" % (hostfwd, self.get('DEPLOY_DIR_IMAGE'))
|
||||
@@ -1147,9 +1151,11 @@ class BaseConfig(object):
|
||||
client = gateway + 1
|
||||
if self.fstype == 'nfs':
|
||||
self.setup_nfs()
|
||||
netconf = "192.168.7.%s::192.168.7.%s:255.255.255.0" % (client, gateway)
|
||||
logger.info("Network configuration: %s", netconf)
|
||||
self.kernel_cmdline_script += " ip=%s" % netconf
|
||||
netconf = " " + self.cmdline_ip_tap
|
||||
netconf = netconf.replace('@CLIENT@', str(client))
|
||||
netconf = netconf.replace('@GATEWAY@', str(gateway))
|
||||
logger.info("Network configuration:%s", netconf)
|
||||
self.kernel_cmdline_script += netconf
|
||||
mac = "%s%02x" % (self.mac_tap, client)
|
||||
qb_tap_opt = self.get('QB_TAP_OPT')
|
||||
if qb_tap_opt:
|
||||
@@ -1171,8 +1177,10 @@ class BaseConfig(object):
|
||||
if self.net_bridge:
|
||||
self.setup_net_bridge()
|
||||
elif self.slirp_enabled:
|
||||
self.cmdline_ip_slirp = self.get('QB_CMDLINE_IP_SLIRP') or self.cmdline_ip_slirp
|
||||
self.setup_slirp()
|
||||
else:
|
||||
self.cmdline_ip_tap = self.get('QB_CMDLINE_IP_TAP') or self.cmdline_ip_tap
|
||||
self.setup_tap()
|
||||
|
||||
def setup_rootfs(self):
|
||||
|
||||
Reference in New Issue
Block a user