summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-05-03 19:12:34 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-06 09:55:48 +0100
commitc048ff9f9dbd6a00eb9d39dad2098e473db94a0d (patch)
tree57444468586e2e6eed5412b58ac7aa7dc7676448 /scripts
parent56f243e4ce3082aed3be19a20f5a8d48dc386a9e (diff)
downloadpoky-c048ff9f9dbd6a00eb9d39dad2098e473db94a0d.tar.gz
runqemu: be sh neutral
Now runs with dash and busybox' ash as well as with bash (From OE-Core rev: 2b93ed90736ed08c25561e24343a5ef2b8f7dbef) Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/runqemu13
-rwxr-xr-xscripts/runqemu-internal16
2 files changed, 16 insertions, 13 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index 000d93a160..305e46aebf 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -91,10 +91,9 @@ process_filename() {
91# Parse command line args without requiring specific ordering. It's a 91# Parse command line args without requiring specific ordering. It's a
92# bit more complex, but offers a great user experience. 92# bit more complex, but offers a great user experience.
93KVM_ENABLED="no" 93KVM_ENABLED="no"
94i=1 94while true; do
95while [ $i -le $# ]; do 95 arg=${1}
96 arg=${!i} 96 case "$arg" in
97 case $arg in
98 "qemux86" | "qemux86-64" | "qemuarm" | "qemumips" | "qemuppc") 97 "qemux86" | "qemux86-64" | "qemuarm" | "qemumips" | "qemuppc")
99 [ -z "$MACHINE" ] && MACHINE=$arg || \ 98 [ -z "$MACHINE" ] && MACHINE=$arg || \
100 error "conflicting MACHINE types [$MACHINE] and [$arg]" 99 error "conflicting MACHINE types [$MACHINE] and [$arg]"
@@ -152,6 +151,7 @@ while [ $i -le $# ]; do
152 KVM_ENABLED="yes" 151 KVM_ENABLED="yes"
153 KVM_CAPABLE=`grep -q 'vmx\|smx' /proc/cpuinfo && echo 1` 152 KVM_CAPABLE=`grep -q 'vmx\|smx' /proc/cpuinfo && echo 1`
154 ;; 153 ;;
154 "") break ;;
155 *) 155 *)
156 # A directory name is an nfs rootfs 156 # A directory name is an nfs rootfs
157 if [ -d "$arg" ]; then 157 if [ -d "$arg" ]; then
@@ -174,7 +174,7 @@ while [ $i -le $# ]; do
174 fi 174 fi
175 ;; 175 ;;
176 esac 176 esac
177 i=$((i + 1)) 177 shift
178done 178done
179 179
180if [ ! -c /dev/net/tun ] ; then 180if [ ! -c /dev/net/tun ] ; then
@@ -391,6 +391,9 @@ if [ "$libgl" != 'yes' ]; then
391 exit 1; 391 exit 1;
392fi 392fi
393 393
394INTERNAL_SCRIPT="$0-internal"
395if [ ! -f "$INTERNAL_SCRIPT" -o ! -r "$INTERNAL_SCRIPT" ]; then
394INTERNAL_SCRIPT=`which runqemu-internal` 396INTERNAL_SCRIPT=`which runqemu-internal`
397fi
395 398
396. $INTERNAL_SCRIPT 399. $INTERNAL_SCRIPT
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal
index fb0d80660f..fe2974ba48 100755
--- a/scripts/runqemu-internal
+++ b/scripts/runqemu-internal
@@ -69,7 +69,7 @@ QEMU_MEMORY="$mem_size"M
69 69
70# Bug 433: qemuarm cannot use > 256 MB RAM 70# Bug 433: qemuarm cannot use > 256 MB RAM
71if [ "$MACHINE" = "qemuarm" ]; then 71if [ "$MACHINE" = "qemuarm" ]; then
72 if [[ -z "$mem_size" || $mem_size -gt 256 ]]; then 72 if [ -z "$mem_size" -o $mem_size -gt 256 ]; then
73 echo "WARNING: qemuarm does not support > 256M of RAM." 73 echo "WARNING: qemuarm does not support > 256M of RAM."
74 echo "Changing QEMU_MEMORY to default of 256M." 74 echo "Changing QEMU_MEMORY to default of 256M."
75 QEMU_MEMORY="256M" 75 QEMU_MEMORY="256M"
@@ -111,7 +111,7 @@ acquire_lock() {
111 111
112 if [ -e "$lockfile.lock" ]; then 112 if [ -e "$lockfile.lock" ]; then
113 # Check that the lockfile is not stale 113 # Check that the lockfile is not stale
114 ps=`ps -ewwo pid | grep $(cat $lockfile.lock)` 114 ps=`ps -eo pid | grep $(cat $lockfile.lock)`
115 if [ -z "$ps" ]; then 115 if [ -z "$ps" ]; then
116 echo "WARNING: Stale lock file detected, deleting $lockfile.lock." 116 echo "WARNING: Stale lock file detected, deleting $lockfile.lock."
117 rm -f $lockfile.lock 117 rm -f $lockfile.lock
@@ -212,8 +212,9 @@ cleanup() {
212 stty sane 212 stty sane
213} 213}
214 214
215n1=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] 215n0=$(echo $TAP | sed 's/tap//')
216n2=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ] 216n1=$(($n0 * 2 + 1))
217n2=$(($n1 + 1))
217 218
218KERNEL_NETWORK_CMD="ip=192.168.7.$n2::192.168.7.$n1:255.255.255.0" 219KERNEL_NETWORK_CMD="ip=192.168.7.$n2::192.168.7.$n1:255.255.255.0"
219QEMU_TAP_CMD="-net tap,vlan=0,ifname=$TAP,script=no,downscript=no" 220QEMU_TAP_CMD="-net tap,vlan=0,ifname=$TAP,script=no,downscript=no"
@@ -437,7 +438,7 @@ if [ ! -x "$QEMUBIN" ]; then
437 return 438 return
438fi 439fi
439 440
440function _quit() { 441do_quit() {
441 if [ -n "$PIDFILE" ]; then 442 if [ -n "$PIDFILE" ]; then
442 #echo kill `cat $PIDFILE` 443 #echo kill `cat $PIDFILE`
443 kill `cat $PIDFILE` 444 kill `cat $PIDFILE`
@@ -449,7 +450,7 @@ function _quit() {
449DISTCCD=`which distccd 2> /dev/null` 450DISTCCD=`which distccd 2> /dev/null`
450PIDFILE="" 451PIDFILE=""
451 452
452trap _quit INT TERM QUIT 453trap do_quit INT TERM QUIT
453 454
454if [ -x "$DISTCCD" ]; then 455if [ -x "$DISTCCD" ]; then
455 echo "Starting distccd..." 456 echo "Starting distccd..."
@@ -476,7 +477,7 @@ if grep -i ubuntu /etc/lsb-release &> /dev/null
476then 477then
477 # precede nvidia's driver on Ubuntu 10 478 # precede nvidia's driver on Ubuntu 10
478 UBUNTU_MAIN_VERSION=`cat /etc/lsb-release |grep DISTRIB_RELEASE |cut -d= -f 2| cut -d. -f 1` 479 UBUNTU_MAIN_VERSION=`cat /etc/lsb-release |grep DISTRIB_RELEASE |cut -d= -f 2| cut -d. -f 1`
479 if [ $UBUNTU_MAIN_VERSION -eq 10 ]; 480 if [ "$UBUNTU_MAIN_VERSION" = "10" ];
480 then 481 then
481 GL_PATH="" 482 GL_PATH=""
482 if test -e /usr/lib/libGL.so 483 if test -e /usr/lib/libGL.so
@@ -502,4 +503,3 @@ LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -n
502cleanup 503cleanup
503 504
504trap - INT TERM QUIT 505trap - INT TERM QUIT
505return