diff options
author | Adrian Freihofer <adrian.freihofer@siemens.com> | 2020-03-17 16:26:50 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-03-21 22:39:00 +0000 |
commit | 2f6a47c4d4dc24135b69ed01e193740c24f269e8 (patch) | |
tree | 713860175fe4e0bf660aacd816d68cc15d36422c /meta/classes | |
parent | 8afdc80989e19c17c43959ecbeb5a59b85a0bc1f (diff) | |
download | poky-2f6a47c4d4dc24135b69ed01e193740c24f269e8.tar.gz |
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>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/qemuboot.bbclass | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/meta/classes/qemuboot.bbclass b/meta/classes/qemuboot.bbclass index 15a9e63f2b..54044c38da 100644 --- a/meta/classes/qemuboot.bbclass +++ b/meta/classes/qemuboot.bbclass | |||
@@ -36,6 +36,9 @@ | |||
36 | # Note, runqemu will replace @MAC@ with a predefined mac, you can set | 36 | # Note, runqemu will replace @MAC@ with a predefined mac, you can set |
37 | # a custom one, but that may cause conflicts when multiple qemus are | 37 | # a custom one, but that may cause conflicts when multiple qemus are |
38 | # running on the same host. | 38 | # running on the same host. |
39 | # Note: If more than one interface of type -device virtio-net-device gets added, | ||
40 | # QB_NETWORK_DEVICE_prepend might be used, since Qemu enumerates the eth* | ||
41 | # devices in reverse order to -device arguments. | ||
39 | # | 42 | # |
40 | # QB_TAP_OPT: netowrk option for 'tap' mode, e.g., | 43 | # QB_TAP_OPT: netowrk option for 'tap' mode, e.g., |
41 | # "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no" | 44 | # "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no" |
@@ -43,6 +46,15 @@ | |||
43 | # | 46 | # |
44 | # QB_SLIRP_OPT: network option for SLIRP mode, e.g., -netdev user,id=net0" | 47 | # QB_SLIRP_OPT: network option for SLIRP mode, e.g., -netdev user,id=net0" |
45 | # | 48 | # |
49 | # QB_CMDLINE_IP_SLIRP: If QB_NETWORK_DEVICE adds more than one network interface to qemu, usually the | ||
50 | # ip= kernel comand line argument needs to be changed accordingly. Details are documented | ||
51 | # in the kernel docuemntation https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt | ||
52 | # Example to configure only the first interface: "ip=eth0:dhcp" | ||
53 | # QB_CMDLINE_IP_TAP: This parameter is similar to the QB_CMDLINE_IP_SLIRP parameter. Since the tap interface requires | ||
54 | # static IP configuration @CLIENT@ and @GATEWAY@ place holders are replaced by the IP and the gateway | ||
55 | # address of the qemu guest by runqemu. | ||
56 | # Example: "ip=192.168.7.@CLIENT@::192.168.7.@GATEWAY@:255.255.255.0::eth0" | ||
57 | # | ||
46 | # QB_ROOTFS_OPT: used as rootfs, e.g., | 58 | # QB_ROOTFS_OPT: used as rootfs, e.g., |
47 | # "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0" | 59 | # "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0" |
48 | # Note, runqemu will replace "@ROOTFS@" with the one which is used, such as core-image-minimal-qemuarm64.ext4. | 60 | # Note, runqemu will replace "@ROOTFS@" with the one which is used, such as core-image-minimal-qemuarm64.ext4. |
@@ -63,6 +75,8 @@ QB_DEFAULT_KERNEL ?= "${KERNEL_IMAGETYPE}" | |||
63 | QB_DEFAULT_FSTYPE ?= "ext4" | 75 | QB_DEFAULT_FSTYPE ?= "ext4" |
64 | QB_OPT_APPEND ?= "-show-cursor" | 76 | QB_OPT_APPEND ?= "-show-cursor" |
65 | QB_NETWORK_DEVICE ?= "-device virtio-net-pci,netdev=net0,mac=@MAC@" | 77 | QB_NETWORK_DEVICE ?= "-device virtio-net-pci,netdev=net0,mac=@MAC@" |
78 | QB_CMDLINE_IP_SLIRP ?= "ip=dhcp" | ||
79 | QB_CMDLINE_IP_TAP ?= "ip=192.168.7.@CLIENT@::192.168.7.@GATEWAY@:255.255.255.0" | ||
66 | 80 | ||
67 | # This should be kept align with ROOT_VM | 81 | # This should be kept align with ROOT_VM |
68 | QB_DRIVE_TYPE ?= "/dev/sd" | 82 | QB_DRIVE_TYPE ?= "/dev/sd" |