summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/poky-qemu-internal32
1 files changed, 28 insertions, 4 deletions
diff --git a/scripts/poky-qemu-internal b/scripts/poky-qemu-internal
index acb6ff50ff..3d718391f7 100755
--- a/scripts/poky-qemu-internal
+++ b/scripts/poky-qemu-internal
@@ -54,9 +54,28 @@ fi
54QEMUIFUP=`which poky-qemu-ifup` 54QEMUIFUP=`which poky-qemu-ifup`
55QEMUIFDOWN=`which poky-qemu-ifdown` 55QEMUIFDOWN=`which poky-qemu-ifdown`
56 56
57USER=`id -u` 57LOCKDIR="/tmp/qemu-tap-locks"
58echo 'Setting up tap interface under sudo' 58[ ! -d "$LOCKDIR" ] && mkdir $LOCKDIR
59TAP=`sudo $QEMUIFUP $USER` 59
60POSSIBLE=`ifconfig -a | grep '^tap' | awk '{print $1}'`
61TAP=""
62LOCKFILE=""
63for tap in $POSSIBLE; do
64 LOCKFILE="$LOCKDIR/$tap"
65 if lockfile $LOCKFILE; then
66 TAP=$tap
67 break;
68 fi
69done
70
71if [ "$TAP" = "" ]; then
72 USER=`id -u`
73 echo 'Setting up tap interface under sudo'
74 TAP=`sudo $QEMUIFUP $USER`
75 LOCKFILE=""
76else
77 echo "Using preconfigured tap device '$TAP'"
78fi
60 79
61KERNEL_NETWORK_CMD="ip=192.168.7.2::192.168.7.1:255.255.255.0" 80KERNEL_NETWORK_CMD="ip=192.168.7.2::192.168.7.1:255.255.255.0"
62QEMU_TAP_CMD="-net tap,vlan=0,ifname=$TAP,script=no,downscript=no" 81QEMU_TAP_CMD="-net tap,vlan=0,ifname=$TAP,script=no,downscript=no"
@@ -313,7 +332,12 @@ echo "Running $QEMU..."
313echo $QEMUBIN -kernel $ZIMAGE $QEMUOPTIONS $SERIALOPTS $* --append "$KERNCMDLINE" 332echo $QEMUBIN -kernel $ZIMAGE $QEMUOPTIONS $SERIALOPTS $* --append "$KERNCMDLINE"
314$QEMUBIN -kernel $ZIMAGE $QEMUOPTIONS $SERIALOPTS $* --append "$KERNCMDLINE" || /bin/true 333$QEMUBIN -kernel $ZIMAGE $QEMUOPTIONS $SERIALOPTS $* --append "$KERNCMDLINE" || /bin/true
315 334
316$QEMUIFDOWN $TAP 335if [ "$LOCKFILE" = "" ]; then
336 $QEMUIFDOWN $TAP
337else
338 echo "Releasing preconfigured tap device '$TAP'"
339 rm -f $LOCKFILE
340fi
317 341
318trap - INT TERM QUIT 342trap - INT TERM QUIT
319return 343return