[yocto] [PATCH 1/1] runqemu: add user mode (SLIRP) support to x86 QEMU targets

Mark Hatle mark.hatle at windriver.com
Mon Oct 24 16:15:57 PDT 2016


On 10/24/16 5:19 PM, Todor Minchev wrote:
> Using 'slirp' as a command line option to runqemu will start QEMU
> with user mode networking instead of creating tun/tap devices.
> SLIRP does not require root access. By default port 2222 on the
> host will be mapped to port 22 in the guest. The default port
> mapping can be overwritten with the QB_SLIRP_OPT variable e.g.
> 
> QB_SLIRP_OPT = "-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22"

In the past patches like this have been rejected for performance and other
reasons.  While I don't particularly like requiring sudo access for runqemu,
adding the 'slirp' option will allow someone w/o root/sudo to be able to run it.

Otherwise, if there is something you can do to make slirp work better (when
enabled), that is more likely to be accepted.

--Mark

> Signed-off-by: Todor Minchev <todor.minchev at linux.intel.com>
> ---
>  meta/conf/machine/include/qemuboot-x86.inc | 1 +
>  scripts/runqemu                            | 3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/conf/machine/include/qemuboot-x86.inc b/meta/conf/machine/include/qemuboot-x86.inc
> index 06ac983..0870294 100644
> --- a/meta/conf/machine/include/qemuboot-x86.inc
> +++ b/meta/conf/machine/include/qemuboot-x86.inc
> @@ -13,3 +13,4 @@ QB_AUDIO_OPT = "-soundhw ac97,es1370"
>  QB_KERNEL_CMDLINE_APPEND = "vga=0 uvesafb.mode_option=640x480-32 oprofile.timer=1 uvesafb.task_timeout=-1"
>  # Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy
>  QB_OPT_APPEND = "-vga vmware -show-cursor -usb -usbdevice tablet -device virtio-rng-pci"
> +QB_SLIRP_OPT = "-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22"
> diff --git a/scripts/runqemu b/scripts/runqemu
> index dbe17ab..6952f32 100755
> --- a/scripts/runqemu
> +++ b/scripts/runqemu
> @@ -542,7 +542,8 @@ class BaseConfig(object):
>      def check_and_set(self):
>          """Check configs sanity and set when needed"""
>          self.validate_paths()
> -        check_tun()
> +        if not self.slirp_enabled:
> +            check_tun()
>          # Check audio
>          if self.audio_enabled:
>              if not self.get('QB_AUDIO_DRV'):
> 




More information about the yocto mailing list