diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/poky-qemu-ifdown | 10 | ||||
-rwxr-xr-x | scripts/poky-qemu-ifup | 10 | ||||
-rwxr-xr-x | scripts/poky-qemu-internal | 15 |
3 files changed, 25 insertions, 10 deletions
diff --git a/scripts/poky-qemu-ifdown b/scripts/poky-qemu-ifdown index 2212353118..d9e9e95861 100755 --- a/scripts/poky-qemu-ifdown +++ b/scripts/poky-qemu-ifdown | |||
@@ -17,11 +17,9 @@ | |||
17 | # with this program; if not, write to the Free Software Foundation, Inc., | 17 | # with this program; if not, write to the Free Software Foundation, Inc., |
18 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 18 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
19 | 19 | ||
20 | TAP=$1 | ||
20 | 21 | ||
21 | IFCONFIG=`which ifconfig` | 22 | TUNCTL=`which tunctl` |
22 | if [ "x$IFCONFIG" = "x" ]; then | 23 | [ "$TUNCTL" = "" ] && TUNCTL=/usr/sbin/tunctl |
23 | # better than nothing... | ||
24 | IFCONFIG=/sbin/ifconfig | ||
25 | fi | ||
26 | 24 | ||
27 | $IFCONFIG tap0 down | 25 | $TUNCTL -d $TAP |
diff --git a/scripts/poky-qemu-ifup b/scripts/poky-qemu-ifup index cb1891e271..e7f689d251 100755 --- a/scripts/poky-qemu-ifup +++ b/scripts/poky-qemu-ifup | |||
@@ -17,6 +17,12 @@ | |||
17 | # with this program; if not, write to the Free Software Foundation, Inc., | 17 | # with this program; if not, write to the Free Software Foundation, Inc., |
18 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 18 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
19 | 19 | ||
20 | USER=$1 | ||
21 | |||
22 | TUNCTL=`which tunctl` | ||
23 | [ "$TUNCTL" = "" ] && TUNCTL=/usr/sbin/tunctl | ||
24 | |||
25 | TAP=`$TUNCTL -b -u $USER` | ||
20 | 26 | ||
21 | IFCONFIG=`which ifconfig` | 27 | IFCONFIG=`which ifconfig` |
22 | if [ "x$IFCONFIG" = "x" ]; then | 28 | if [ "x$IFCONFIG" = "x" ]; then |
@@ -24,7 +30,7 @@ if [ "x$IFCONFIG" = "x" ]; then | |||
24 | IFCONFIG=/sbin/ifconfig | 30 | IFCONFIG=/sbin/ifconfig |
25 | fi | 31 | fi |
26 | 32 | ||
27 | $IFCONFIG tap0 192.168.7.1 | 33 | $IFCONFIG $TAP 192.168.7.1 |
28 | 34 | ||
29 | # setup NAT for tap0 interface to have internet access in QEMU | 35 | # setup NAT for tap0 interface to have internet access in QEMU |
30 | IPTABLES=`which iptables` | 36 | IPTABLES=`which iptables` |
@@ -35,3 +41,5 @@ fi | |||
35 | $IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.0/24 | 41 | $IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.0/24 |
36 | echo 1 > /proc/sys/net/ipv4/ip_forward | 42 | echo 1 > /proc/sys/net/ipv4/ip_forward |
37 | $IPTABLES -P FORWARD ACCEPT | 43 | $IPTABLES -P FORWARD ACCEPT |
44 | |||
45 | echo $TAP | ||
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 |