diff options
author | Jeff Dike <jdike@x86_64.user-mode-linux.org> | 2010-07-21 11:04:59 -0400 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-08-20 16:20:09 +0100 |
commit | c791544bb02e852644c55401018bc17ec1b9b40e (patch) | |
tree | 33d510d91af137a96b1782b9fe8d901867d604f4 /scripts/poky-qemu-internal | |
parent | b5b3825ce6df45b16e1f3e15001da213bc8b0a55 (diff) | |
download | poky-c791544bb02e852644c55401018bc17ec1b9b40e.tar.gz |
qemu: Use a TAP device instead of slirp for networking
With this patch, a persistent TAP device is set up by poky-qemu-ifup,
which is now run before qemu. The qemu command line now uses the
device that was constructed (rather than the hard-coded tap0) and it
is told not to run any networking scripts.
When qemu shuts down, poky-qemu-ifdown removes the TAP device.
sudo use - sudo is used to run poky-qemu-ifup. sudo is no longer used
to run qemu, as qemu no longer needs privileges to set up networking.
poky-qemu-ifdown is run without privileges, as you can remove a TAP
device which you own.
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Diffstat (limited to 'scripts/poky-qemu-internal')
-rwxr-xr-x | scripts/poky-qemu-internal | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/scripts/poky-qemu-internal b/scripts/poky-qemu-internal index 62c64727c0..8ff3add511 100755 --- a/scripts/poky-qemu-internal +++ b/scripts/poky-qemu-internal | |||
@@ -53,8 +53,13 @@ fi | |||
53 | 53 | ||
54 | QEMUIFUP=`which poky-qemu-ifup` | 54 | QEMUIFUP=`which poky-qemu-ifup` |
55 | QEMUIFDOWN=`which poky-qemu-ifdown` | 55 | QEMUIFDOWN=`which poky-qemu-ifdown` |
56 | |||
57 | USER=`id -u` | ||
58 | echo 'Setting up tap interface under sudo' | ||
59 | TAP=`sudo $QEMUIFUP $USER` | ||
60 | |||
56 | KERNEL_NETWORK_CMD="ip=192.168.7.2::192.168.7.1:255.255.255.0" | 61 | KERNEL_NETWORK_CMD="ip=192.168.7.2::192.168.7.1:255.255.255.0" |
57 | QEMU_TAP_CMD="-net tap,vlan=0,ifname=tap0,script=$QEMUIFUP,downscript=$QEMUIFDOWN" | 62 | QEMU_TAP_CMD="-net tap,vlan=0,ifname=$TAP,script=no,downscript=no" |
58 | QEMU_NETWORK_CMD="-net nic,vlan=0 $QEMU_TAP_CMD" | 63 | QEMU_NETWORK_CMD="-net nic,vlan=0 $QEMU_TAP_CMD" |
59 | KERNCMDLINE="mem=$QEMU_MEMORY" | 64 | KERNCMDLINE="mem=$QEMU_MEMORY" |
60 | QEMU_UI_OPTIONS="-show-cursor -usb -usbdevice wacom-tablet" | 65 | QEMU_UI_OPTIONS="-show-cursor -usb -usbdevice wacom-tablet" |
@@ -298,9 +303,13 @@ else | |||
298 | echo "Warning: distccd not present, no distcc support loaded." | 303 | echo "Warning: distccd not present, no distcc support loaded." |
299 | fi | 304 | fi |
300 | 305 | ||
301 | echo "Running $QEMU using sudo..." | 306 | |
307 | |||
308 | echo "Running $QEMU..." | ||
302 | echo $QEMUBIN -kernel $ZIMAGE $QEMUOPTIONS $SERIALOPTS $* --append "$KERNCMDLINE" | 309 | echo $QEMUBIN -kernel $ZIMAGE $QEMUOPTIONS $SERIALOPTS $* --append "$KERNCMDLINE" |
303 | sudo $QEMUBIN -kernel $ZIMAGE $QEMUOPTIONS $SERIALOPTS $* --append "$KERNCMDLINE" || /bin/true | 310 | $QEMUBIN -kernel $ZIMAGE $QEMUOPTIONS $SERIALOPTS $* --append "$KERNCMDLINE" || /bin/true |
311 | |||
312 | $QEMUIFDOWN $TAP | ||
304 | 313 | ||
305 | trap - INT TERM QUIT | 314 | trap - INT TERM QUIT |
306 | return | 315 | return |