summaryrefslogtreecommitdiffstats
path: root/scripts/poky-qemu
diff options
context:
space:
mode:
authorScott Garman <scott.a.garman@intel.com>2010-12-07 20:59:06 -0800
committerRichard Purdie <rpurdie@linux.intel.com>2010-12-09 15:00:45 +0000
commitba5e0b9531b9a967aa3d408a13024590d96b8391 (patch)
tree47b7536aa4da6efc78106a1a57c6ebe9a13e91d2 /scripts/poky-qemu
parent7581654a030961eda03b07de0e0f6d62a7f4055e (diff)
downloadpoky-ba5e0b9531b9a967aa3d408a13024590d96b8391.tar.gz
Make poky-qemu and related scripts work with arbitrary SDK locations
* No longer assume SDK toolchains are installed in /opt/poky * [BUGFIX #568] where specifying paths to both the kernel and fs image caused an error due to POKY_NATIVE_SYSROOT never being set, triggering failure of poky-qemu-ifup/ifdown * Cosmetic improvements to usage() functions by using basename Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Diffstat (limited to 'scripts/poky-qemu')
-rwxr-xr-xscripts/poky-qemu38
1 files changed, 22 insertions, 16 deletions
diff --git a/scripts/poky-qemu b/scripts/poky-qemu
index bc312e0fb6..67af439ea9 100755
--- a/scripts/poky-qemu
+++ b/scripts/poky-qemu
@@ -31,9 +31,9 @@ usage() {
31 echo " serial - enables a serial console on /dev/ttyS0" 31 echo " serial - enables a serial console on /dev/ttyS0"
32 echo "" 32 echo ""
33 echo "Examples:" 33 echo "Examples:"
34 echo " $0 qemuarm" 34 echo " $MYNAME qemuarm"
35 echo " $0 qemux86-64 poky-image-sato ext3" 35 echo " $MYNAME qemux86-64 poky-image-sato ext3"
36 echo " $0 path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial" 36 echo " $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial"
37 exit 1 37 exit 1
38} 38}
39 39
@@ -213,23 +213,29 @@ setup_tmpdir() {
213 echo "before running this script" >&2; 213 echo "before running this script" >&2;
214 exit 1; } 214 exit 1; }
215 215
216 # We have bitbake in PATH, get TMPDIR and BUILD_SYS 216 # We have bitbake in PATH, get TMPDIR from bitbake
217 # from the environment
218 TMPDIR=`bitbake -e | grep TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2` 217 TMPDIR=`bitbake -e | grep TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2`
219 BUILD_SYS=`bitbake -e | grep BUILD_SYS=\" | cut -d '=' -f2 | cut -d '"' -f2`
220 else 218 else
221 BUILD_ARCH=`uname -m`
222 BUILD_OS=`uname | tr '[A-Z]' '[a-z]'`
223 BUILD_SYS="$BUILD_ARCH-$BUILD_OS"
224 TMPDIR=$BUILDDIR/tmp 219 TMPDIR=$BUILDDIR/tmp
225 fi 220 fi
226 if [ -z "$POKY_NATIVE_SYSROOT" ]; then
227 POKY_NATIVE_SYSROOT=$TMPDIR/sysroots/$BUILD_SYS
228 fi
229 CROSSPATH=$POKY_NATIVE_SYSROOT/usr/bin
230 fi 221 fi
231} 222}
232 223
224setup_sysroot() {
225 # Toolchain installs set up $POKY_NATIVE_SYSROOT in their
226 # environment script. If that variable isn't set, we're
227 # either in an in-tree poky scenario or the environment
228 # script wasn't source'd.
229 if [ -z "$POKY_NATIVE_SYSROOT" ]; then
230 setup_tmpdir
231 BUILD_ARCH=`uname -m`
232 BUILD_OS=`uname | tr '[A-Z]' '[a-z]'`
233 BUILD_SYS="$BUILD_ARCH-$BUILD_OS"
234
235 POKY_NATIVE_SYSROOT=$TMPDIR/sysroots/$BUILD_SYS
236 fi
237}
238
233# Locate a rootfs image based on defaults defined above 239# Locate a rootfs image based on defaults defined above
234findimage() { 240findimage() {
235 where=$1 241 where=$1
@@ -254,8 +260,6 @@ findimage() {
254} 260}
255 261
256if [[ -e "$ROOTFS" && -z "$FSTYPE" ]]; then 262if [[ -e "$ROOTFS" && -z "$FSTYPE" ]]; then
257 setup_tmpdir
258
259 # Extract the filename extension 263 # Extract the filename extension
260 EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'` 264 EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'`
261 if [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" || 265 if [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" ||
@@ -281,7 +285,6 @@ fi
281# KERNEL is now set for all cases 285# KERNEL is now set for all cases
282 286
283if [ -z "$FSTYPE" ]; then 287if [ -z "$FSTYPE" ]; then
284 setup_tmpdir
285 eval FSTYPE=\$${machine2}_DEFAULT_FSTYPE 288 eval FSTYPE=\$${machine2}_DEFAULT_FSTYPE
286 289
287 if [ -z "$FSTYPE" ]; then 290 if [ -z "$FSTYPE" ]; then
@@ -318,6 +321,9 @@ echo "KERNEL: [$KERNEL]"
318echo "ROOTFS: [$ROOTFS]" 321echo "ROOTFS: [$ROOTFS]"
319echo "FSTYPE: [$FSTYPE]" 322echo "FSTYPE: [$FSTYPE]"
320 323
324setup_sysroot
325# POKY_NATIVE_SYSROOT is now set for all cases
326
321# We can't run without a libGL.so 327# We can't run without a libGL.so
322libgl='no' 328libgl='no'
323 329