summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2016-11-28 22:02:05 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-23 12:05:22 +0000
commit9dd223bf1853187488ce550502a003933e41ee2a (patch)
treed870058d6bcc7485f842599b57b4a583a8af1d33 /meta
parent5ea3627dbb61ab065be8737c46007d7d8d7f3501 (diff)
downloadpoky-9dd223bf1853187488ce550502a003933e41ee2a.tar.gz
runqemu: fixes for slirp, network device and hostfwd
Fixed: - Add QB_NETWORK_DEVICE to set network device, it will be used by both slirp and tap. - Set QB_NETWORK_DEVICE to "-device virtio-net-pci" in qemuboot.bbclass but runqemu will default to "-device e1000" when QB_NETWORK_DEVICE is not set, this is because oe-core's qemu targets support virtio-net-pci, but the one outside of oe-core may not, "-device e1000" is more common. - Set hostfwd by default: 2222 -> 22, 2323 -> 23, and it will choose a usable port when the one like 222 is being used. This can avoid conflicts when multilib slirp qemus are running. We can forward more ports by default if needed, and bsp.conf can custom it. - Use different mac sections for slirp and tap to fix conflicts when running both of them on the same host. [YOCTO #7887] CC: Nathan Rossi <nathan@nathanrossi.com> CC: Randy Witt <randy.e.witt@linux.intel.com> (From OE-Core rev: 7dddd090806914a62d977730440d803e48f44763) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/qemuboot.bbclass11
-rw-r--r--meta/conf/machine/include/qemuboot-x86.inc1
-rw-r--r--meta/conf/machine/qemuarm64.conf4
-rw-r--r--meta/conf/machine/qemuppc.conf2
4 files changed, 11 insertions, 7 deletions
diff --git a/meta/classes/qemuboot.bbclass b/meta/classes/qemuboot.bbclass
index a181fa2213..be5d7a4c8f 100644
--- a/meta/classes/qemuboot.bbclass
+++ b/meta/classes/qemuboot.bbclass
@@ -18,11 +18,15 @@
18# QB_AUDIO_OPT: qemu audio option, e.g., "-soundhw ac97,es1370", used 18# QB_AUDIO_OPT: qemu audio option, e.g., "-soundhw ac97,es1370", used
19# when QB_AUDIO_DRV is set. 19# when QB_AUDIO_DRV is set.
20# QB_KERNEL_ROOT: kernel's root, e.g., /dev/vda 20# QB_KERNEL_ROOT: kernel's root, e.g., /dev/vda
21# QB_NETWORK_DEVICE: network device, e.g., "-device virtio-net-pci,netdev=net0,mac=@MAC@",
22# it needs work with QB_TAP_OPT and QB_SLIRP_OPT.
23# Note, runqemu will replace @MAC@ with a predefined mac, you can set
24# a custom one, but that may cause conflicts when multiple qemus are
25# running on the same host.
21# QB_TAP_OPT: netowrk option for 'tap' mode, e.g., 26# QB_TAP_OPT: netowrk option for 'tap' mode, e.g.,
22# "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no -device virtio-net-device,netdev=net0" 27# "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no"
23# Note, runqemu will replace "@TAP@" with the one which is used, such as tap0, tap1 ... 28# Note, runqemu will replace "@TAP@" with the one which is used, such as tap0, tap1 ...
24# QB_SLIRP_OPT: network option for SLIRP mode, e.g., 29# QB_SLIRP_OPT: network option for SLIRP mode, e.g., -netdev user,id=net0"
25# "-netdev user,id=net0 -device virtio-net-device,netdev=net0"
26# QB_ROOTFS_OPT: used as rootfs, e.g., 30# QB_ROOTFS_OPT: used as rootfs, e.g.,
27# "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0" 31# "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0"
28# Note, runqemu will replace "@ROOTFS@" with the one which is used, such as core-image-minimal-qemuarm64.ext4. 32# Note, runqemu will replace "@ROOTFS@" with the one which is used, such as core-image-minimal-qemuarm64.ext4.
@@ -40,6 +44,7 @@ QB_SERIAL_OPT ?= "-serial mon:stdio -serial null"
40QB_DEFAULT_KERNEL ?= "${KERNEL_IMAGETYPE}" 44QB_DEFAULT_KERNEL ?= "${KERNEL_IMAGETYPE}"
41QB_DEFAULT_FSTYPE ?= "ext4" 45QB_DEFAULT_FSTYPE ?= "ext4"
42QB_OPT_APPEND ?= "-show-cursor" 46QB_OPT_APPEND ?= "-show-cursor"
47QB_NETWORK_DEVICE ?= "-device virtio-net-pci,netdev=net0,mac=@MAC@"
43 48
44# Create qemuboot.conf 49# Create qemuboot.conf
45addtask do_write_qemuboot_conf after do_rootfs before do_image 50addtask do_write_qemuboot_conf after do_rootfs before do_image
diff --git a/meta/conf/machine/include/qemuboot-x86.inc b/meta/conf/machine/include/qemuboot-x86.inc
index 08702948e4..06ac983d4d 100644
--- a/meta/conf/machine/include/qemuboot-x86.inc
+++ b/meta/conf/machine/include/qemuboot-x86.inc
@@ -13,4 +13,3 @@ QB_AUDIO_OPT = "-soundhw ac97,es1370"
13QB_KERNEL_CMDLINE_APPEND = "vga=0 uvesafb.mode_option=640x480-32 oprofile.timer=1 uvesafb.task_timeout=-1" 13QB_KERNEL_CMDLINE_APPEND = "vga=0 uvesafb.mode_option=640x480-32 oprofile.timer=1 uvesafb.task_timeout=-1"
14# Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy 14# Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy
15QB_OPT_APPEND = "-vga vmware -show-cursor -usb -usbdevice tablet -device virtio-rng-pci" 15QB_OPT_APPEND = "-vga vmware -show-cursor -usb -usbdevice tablet -device virtio-rng-pci"
16QB_SLIRP_OPT = "-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22"
diff --git a/meta/conf/machine/qemuarm64.conf b/meta/conf/machine/qemuarm64.conf
index e70538aac6..242889ac8a 100644
--- a/meta/conf/machine/qemuarm64.conf
+++ b/meta/conf/machine/qemuarm64.conf
@@ -17,8 +17,8 @@ QB_CPU = "-cpu cortex-a57"
17QB_KERNEL_CMDLINE_APPEND = "console=ttyAMA0,38400" 17QB_KERNEL_CMDLINE_APPEND = "console=ttyAMA0,38400"
18# Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy 18# Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy
19QB_OPT_APPEND = "-show-cursor -device virtio-rng-pci -monitor null" 19QB_OPT_APPEND = "-show-cursor -device virtio-rng-pci -monitor null"
20QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no -device virtio-net-device,netdev=net0,mac=@MAC@" 20QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no"
21QB_SLIRP_OPT = "-netdev user,id=net0 -device virtio-net-device,netdev=net0" 21QB_NETWORK_DEVICE = "-device virtio-net-device,netdev=net0,mac=@MAC@"
22QB_ROOTFS_OPT = "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0" 22QB_ROOTFS_OPT = "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0"
23QB_SERIAL_OPT = "-device virtio-serial-device -chardev null,id=virtcon -device virtconsole,chardev=virtcon" 23QB_SERIAL_OPT = "-device virtio-serial-device -chardev null,id=virtcon -device virtconsole,chardev=virtcon"
24QB_TCPSERIAL_OPT = " -device virtio-serial-device -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device virtconsole,chardev=virtcon" 24QB_TCPSERIAL_OPT = " -device virtio-serial-device -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device virtconsole,chardev=virtcon"
diff --git a/meta/conf/machine/qemuppc.conf b/meta/conf/machine/qemuppc.conf
index 9d174bc439..a9ef64b0af 100644
--- a/meta/conf/machine/qemuppc.conf
+++ b/meta/conf/machine/qemuppc.conf
@@ -18,4 +18,4 @@ QB_CPU = "-cpu G4"
18QB_KERNEL_CMDLINE_APPEND = "console=tty console=ttyS0" 18QB_KERNEL_CMDLINE_APPEND = "console=tty console=ttyS0"
19# Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy 19# Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy
20QB_OPT_APPEND = "-show-cursor -usb -usbdevice tablet -device virtio-rng-pci" 20QB_OPT_APPEND = "-show-cursor -usb -usbdevice tablet -device virtio-rng-pci"
21QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no -device virtio-net-pci,netdev=net0,mac=@MAC@" 21QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no"