summaryrefslogtreecommitdiffstats
path: root/scripts/runqemu-gen-tapdevs
AgeCommit message (Collapse)Author
2023-06-24runqemu-gen-tapdevs: remove only our tapsAdrian Freihofer
Ignore itnerfaces with other names than what the runqemu scripts created. Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-06-24runqemu-gen-tapdevs: configurable tap namesAdrian Freihofer
Feature: Hard-coding the interface names to tap* is not always a good idea. Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-06-24runqemu-gen-tapdevs: remove uid parameterAdrian Freihofer
The uid parameter is no longer needed since ip tuntap is used internally. Remove it. Backward compatibility to 3 or 4 parameters is still supported. Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-06-24runqemu-gen-tapdevs: remove staging dir parameterAdrian Freihofer
The parameter staging_bindir_native is no longer used. Remove it. For now the script is backward compatible. With 4 parameters it logs an error message but still works. Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-06-19runqemu-gen-tapdevs: fix missing variable quoteTrevor Gamblin
Commit d43c41fcaf061eaf8bff7bc03de19cdc80226796 refactors the script but there's a missing '"' in one line, leading to the following message: poky/scripts/runqemu-gen-tapdevs: command substitution: line 62: unexpected EOF while looking for matching `"' Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-06-16runqemu/qemu-helper: Drop tunctlRichard Purdie
ip tuntap provides the functionality that we obtained from tunctl. We only needed tunctl when ifconfig was more available than ip. That isn't the case now so we can drop tunctl and all the hoops we need to jump through to build and provide it. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-06-13runqemu-ifupdown/get-tapdevs: Add support for ip tuntapJörg Sommer
The *ip* command supports the creation and destruction of TAP devices since 2009 and might be more likely installed on systems then *tunctl*. Therefore it should be tried to setup or teardown the TAP interface with *ip* before falling back to *tunctl*. https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=580fbd88f75cc9eea0d28a48c025b090eb9419a7 Signed-off-by: Jörg Sommer <joerg.sommer@navimatix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-06-13runqemu-gen-tapdevs: RefactoringJörg Sommer
The changes are mostly about early exit which causes indentation changes; check with `git diff -w`. Another change is the check for ip by simply calling it and deciding upon the exit code, if it's fine or not. Signed-off-by: Jörg Sommer <joerg.sommer@navimatix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-05-09meta/lib+scripts: Convert to SPDX license headersRichard Purdie
This adds SPDX license headers in place of the wide assortment of things currently in our script headers. We default to GPL-2.0-only except for the oeqa code where it was clearly submitted and marked as MIT on the most part or some scripts which had the "or later" GPL versioning. The patch also drops other obsolete bits of file headers where they were encoountered such as editor modelines, obsolete maintainer information or the phrase "All rights reserved" which is now obsolete and not required in copyright headers (in this case its actually confusing for licensing as all rights were not reserved). More work is needed for OE-Core but this takes care of the bulk of the scripts and meta/lib directories. The top level LICENSE files are tweaked to match the new structure and the SPDX naming. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-01-03runqemu-gen-tapdevs: Allow run --help without sudoRobert Yang
Then we can get user's UID and GID rather than hardcode to 1000, e.g.: - Without sudo $ runqemu-gen-tapdevs --help [snip] $ sudo ../poky/scripts/runqemu-gen-tapdevs 15220 100 4 tmp/sysroots-components/x86_64/qemu-helper-native/usr/bin [snip] - With sudo $ sudo ../poky/scripts/runqemu-gen-tapdevs --help [snip] $ sudo ../poky/scripts/runqemu-gen-tapdevs 15220 100 4 tmp/sysroots-components/x86_64/qemu-helper-native/usr/bin [snip] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-28runqemu-gen-tapdevs: fix runqemu-ifup script callMartin Jansa
The tunctl binary is here: OE @ /OE/openembedded-core # find /OE/build/oe-core/tmp-glibc/sysroots-components/x86_64/qemu-helper-native/ /OE/build/oe-core/tmp-glibc/sysroots-components/x86_64/qemu-helper-native/ /OE/build/oe-core/tmp-glibc/sysroots-components/x86_64/qemu-helper-native/sysroot-providers /OE/build/oe-core/tmp-glibc/sysroots-components/x86_64/qemu-helper-native/sysroot-providers/qemu-helper-native /OE/build/oe-core/tmp-glibc/sysroots-components/x86_64/qemu-helper-native/usr /OE/build/oe-core/tmp-glibc/sysroots-components/x86_64/qemu-helper-native/usr/bin /OE/build/oe-core/tmp-glibc/sysroots-components/x86_64/qemu-helper-native/usr/bin/tunctl But the script still complains that it cannot find tunctl: OE @ /OE/openembedded-core # ./scripts/runqemu-gen-tapdevs 1026 1026 4 /OE/build/oe-core/tmp-glibc/sysroots-components/x86_64/qemu-helper-native/ Note: Destroying pre-existing tap interface tap0... TUNSETIFF: Device or resource busy Creating 4 tap devices for UID: 1026 GID: 1026... Creating tap0 Error running tunctl: Error: Unable to find tunctl binary in '/OE/build/oe-core/tmp-glibc/sysroots-components/x86_64/qemu-helper-native/', please bitbake qemu-helper-native The message is actually from runqemu-ifup, which is called from runqemu-gen-tapdevs as: ++ ./scripts/runqemu-ifup 1026 1026 /OE/build/oe-core/tmp-glibc/sysroots-components/x86_64/qemu-helper-native/ But runqemu-ifup expects 3rd parameter to be STAGING_BINDIR_NATIVE directly not just SYSROOT dir STAGING_BINDIR_NATIVE=$3 because tunctl is then used as: TUNCTL=$STAGING_BINDIR_NATIVE/tunctl It looks like it got broken by: commit cc5513bf7a6114e14bb307acb88a44e9cf0aed8a Author: Ed Bartosh <ed.bartosh@linux.intel.com> Date: Wed Apr 12 23:40:59 2017 +0300 runqemu: use bindir_native property to run ifup/down scripts Used self.bindir_native to point out to the native sysroot when running runqemu-ifup and runqemu-ifdown scripts. [YOCTO #11266] [YOCTO #11193] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Seemingly obvious fix would be to call runqemu-gen-tapdevs with path to STAGING_BINDIR_NATIVE in 4th parameter as well, but that won't work, because runqemu-gen-tapdevs checks for TUNCTL=$SYSROOT/usr/bin/tunctl OE @ /OE/openembedded-core # ./scripts/runqemu-gen-tapdevs 1026 1026 4 /OE/build/oe-core/tmp-glibc/sysroots-components/x86_64/qemu-helper-native/usr/bin/ Error: /OE/build/oe-core/tmp-glibc/sysroots-components/x86_64/qemu-helper-native/usr/bin//usr/bin/tunctl is not an executable I've tested that with this change it can call tunctl: OE @ /OE/openembedded-core # ./scripts/runqemu-gen-tapdevs 1026 1026 4 /OE/build/oe-core/tmp-glibc/sysroots-components/x86_64/qemu-helper-native/usr/bin Note: Destroying pre-existing tap interface tap0... TUNSETIFF: Device or resource busy Creating 4 tap devices for UID: 1026 GID: 1026... Creating tap0 Creating tap1 Creating tap2 Creating tap3 Note: For systems running NetworkManager, it's recommended Note: that the tap devices be set as unmanaged in the Note: NetworkManager.conf file. Add the following lines to Note: /etc/NetworkManager/NetworkManager.conf [keyfile] unmanaged-devices=interface-name:tap* but runqemu itself still doesn't work for me: OE qemux86@ ~/build/oe-core $ runqemu runqemu - INFO - Running MACHINE=qemux86 bitbake -e... runqemu - INFO - Running ls -t /OE/build/oe-core/tmp-glibc/deploy/images/qemux86/*.qemuboot.conf... runqemu - INFO - CONFFILE: /OE/build/oe-core/tmp-glibc/deploy/images/qemux86/core-image-sato-qemux86-20170427174052.qemuboot.conf runqemu - INFO - Overriding conf file setting of STAGING_DIR_NATIVE to /OE/build/oe-core/tmp-glibc/work/i586-oe-linux/defaultpkgname/1.0-r0/recipe-sysroot-native from Bitbake environment runqemu - INFO - Continuing with the following parameters: KERNEL: [tmp-glibc/deploy/images/qemux86/bzImage--4.10.9+git0+ad2e885015_fe0fb8da3d-r0.2-qemux86-20170427085800.bin] MACHINE: [qemux86] FSTYPE: [ext4] ROOTFS: [tmp-glibc/deploy/images/qemux86/core-image-sato-qemux86-20170427174052.rootfs.ext4] CONFFILE: [/OE/build/oe-core/tmp-glibc/deploy/images/qemux86/core-image-sato-qemux86-20170427174052.qemuboot.conf] runqemu - INFO - Running /bin/ip link... runqemu - INFO - Acquiring lockfile /tmp/qemu-tap-locks/tap0.lock... runqemu - INFO - Using preconfigured tap device tap0 runqemu - INFO - If this is not intended, touch /tmp/qemu-tap-locks/tap0.skip to make runqemu skip tap0. runqemu - INFO - Network configuration: 192.168.7.2::192.168.7.1:255.255.255.0 runqemu - INFO - Running ldd tmp-glibc/work/x86_64-linux/qemu-helper-native/1.0-r1/recipe-sysroot-native/usr/bin//qemu-system-i386... runqemu - INFO - Running tmp-glibc/work/x86_64-linux/qemu-helper-native/1.0-r1/recipe-sysroot-native/usr/bin//qemu-system-i386 -device virtio-net-pci,netdev=net0,mac=52:54:00:12:34:02 -netdev tap,id=net0,ifname=tap0,script=no,downscript=no -drive file=tmp-glibc/deploy/images/qemux86/core-image-sato-qemux86-20170427174052.rootfs.ext4,if=virtio,format=raw -vga vmware -show-cursor -usb -usbdevice tablet -device virtio-rng-pci -cpu qemu32 -m 256 -serial mon:vc -serial null -kernel tmp-glibc/deploy/images/qemux86/bzImage--4.10.9+git0+ad2e885015_fe0fb8da3d-r0.2-qemux86-20170427085800.bin -append 'root=/dev/vda rw highres=off mem=256M ip=192.168.7.2::192.168.7.1:255.255.255.0 vga=0 uvesafb.mode_option=640x480-32 oprofile.timer=1 uvesafb.task_timeout=-1 ' qemu-system-i386: -netdev tap,id=net0,ifname=tap0,script=no,downscript=no: could not configure /dev/net/tun (tap0): Device or resource busy runqemu - INFO - Releasing lockfile for tap device 'tap0' Traceback (most recent call last): File "/OE/build/oe-core/openembedded-core/scripts/runqemu", line 1235, in <module> ret = main() File "/OE/build/oe-core/openembedded-core/scripts/runqemu", line 1228, in main config.start_qemu() File "/OE/build/oe-core/openembedded-core/scripts/runqemu", line 1139, in start_qemu raise Exception('Failed to run %s' % cmd) Exception: Failed to run tmp-glibc/work/x86_64-linux/qemu-helper-native/1.0-r1/recipe-sysroot-native/usr/bin//qemu-system-i386 -device virtio-net-pci,netdev=net0,mac=52:54:00:12:34:02 -netdev tap,id=net0,ifname=tap0,script=no,downscript=no -drive file=tmp-glibc/deploy/images/qemux86/core-image-sato-qemux86-20170427174052.rootfs.ext4,if=virtio,format=raw -vga vmware -show-cursor -usb -usbdevice tablet -device virtio-rng-pci -cpu qemu32 -m 256 -serial mon:vc -serial null -kernel tmp-glibc/deploy/images/qemux86/bzImage--4.10.9+git0+ad2e885015_fe0fb8da3d-r0.2-qemux86-20170427085800.bin -append 'root=/dev/vda rw highres=off mem=256M ip=192.168.7.2::192.168.7.1:255.255.255.0 vga=0 uvesafb.mode_option=640x480-32 oprofile.timer=1 uvesafb.task_timeout=-1 ' Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-23runqemu-gen-tapdevs: fix file path in exampleChen Qi
Fix the path in example so that '/usr/bin/tunctl' could be found under this path. Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-03-10runqemu-gen-tapdevs: Improve help text with an exampleRichard Purdie
Figuring how the correct commandline isn't trivial, improve the help text with RSS in mind. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-20runqemu-gen-tapdevs: remove /etc/runqemu-nosudo when remove tapsRobert Yang
It creats /etc/runqemu-nosudo when creats taps, so should remove it when remove taps. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-04-06runqemu-gen-tapdevs: Add note about NetworkManager & tap devicesSaul Wold
NetworkManager can clobber tap devices if left alone, this gives a note about how to set tap* as unmanaged [YOCTO #8587] Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-16runqemu: Replace use of ifconfig with ipKhem Raj
ifconfig and its ilk (net-tools package) is deprecated in favour of iproute2 package and is now removed by many distro's e.g. Archlinux. So we replace ifconfig with ip utility Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2012-09-24runqemu: work with tap device names that end with a colonScott Garman
On Fedora systems (and likely others), ifconfig returns interface names that end with a colon. Make sure we strip the colon off the tap device name before using it. This fixes [YOCTO #3028] Signed-off-by: Scott Garman <scott.a.garman@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-02runqemu-gen-tapdevs: add UID to CL optionsElizabeth Flanagan
runqemu-if* now requires UID as a command line option which means runqemu-gen-tapdevs needs to take it as an option. Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-09-02scripts: Show sensible warning messages if expected binaries don't existRichard Purdie
[YOCTO #1438] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-09-01scripts: Don't show errors from which ifconfig failingRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-04-21Further cleanup of various poky referencesRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-04-20POKY_QEMU_IFUP -> RUNQEMU_IFUPRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-04-20Rename the remaining poky-* scripts to oe-* or runqemu-*Richard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>