diff options
author | Scott Garman <scott.a.garman@intel.com> | 2010-12-07 20:59:06 -0800 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-12-09 15:00:45 +0000 |
commit | ba5e0b9531b9a967aa3d408a13024590d96b8391 (patch) | |
tree | 47b7536aa4da6efc78106a1a57c6ebe9a13e91d2 /scripts/poky-qemu | |
parent | 7581654a030961eda03b07de0e0f6d62a7f4055e (diff) | |
download | poky-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-x | scripts/poky-qemu | 38 |
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 | ||
224 | setup_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 |
234 | findimage() { | 240 | findimage() { |
235 | where=$1 | 241 | where=$1 |
@@ -254,8 +260,6 @@ findimage() { | |||
254 | } | 260 | } |
255 | 261 | ||
256 | if [[ -e "$ROOTFS" && -z "$FSTYPE" ]]; then | 262 | if [[ -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 | ||
283 | if [ -z "$FSTYPE" ]; then | 287 | if [ -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]" | |||
318 | echo "ROOTFS: [$ROOTFS]" | 321 | echo "ROOTFS: [$ROOTFS]" |
319 | echo "FSTYPE: [$FSTYPE]" | 322 | echo "FSTYPE: [$FSTYPE]" |
320 | 323 | ||
324 | setup_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 |
322 | libgl='no' | 328 | libgl='no' |
323 | 329 | ||