summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2010-07-21 14:55:39 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-07-21 15:39:53 +0100
commit971907567cff64e74f21d349d6751dadc8c09827 (patch)
treee0cfd7ee0ba3091272eca5c5f1b90edffc3653aa /scripts
parent50629b3746c149b22bdd8664842a4c69abb2b989 (diff)
downloadopenembedded-core-971907567cff64e74f21d349d6751dadc8c09827.tar.gz
openembedded-core-971907567cff64e74f21d349d6751dadc8c09827.tar.bz2
openembedded-core-971907567cff64e74f21d349d6751dadc8c09827.tar.xz
openembedded-core-971907567cff64e74f21d349d6751dadc8c09827.zip
Enable build dir outside of the poky directory
You need to first set up the build directory by sourcing the poky build script, after that builds can be run in that directory so long as bitbake is in $PATH removing the need to source the init script for each build. i.e: $ . poky-init-build-env ~/my-build $ bitbake some-image <<later, in a different shell>> $ cd ~/my-build $ export PATH=/path/to/bitbake/bin:$PATH $ bitbake an-image This patch also removes use of OEROOT in recipes, etc. Signed-off-by: Joshua Lock <josh@linux.intel.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/poky-env-internal49
-rwxr-xr-xscripts/pstage-scanner19
-rwxr-xr-xscripts/qemuimage-tests/sanity/boot3
-rwxr-xr-xscripts/qemuimage-tests/sanity/ssh2
-rwxr-xr-xscripts/runqemu50
5 files changed, 78 insertions, 45 deletions
diff --git a/scripts/poky-env-internal b/scripts/poky-env-internal
index 54b6ee896..862ce7aec 100755
--- a/scripts/poky-env-internal
+++ b/scripts/poky-env-internal
@@ -19,19 +19,30 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-# Change this to the location of this file.
-# Also update the locations at the top of conf/local.conf
+# scripts/ is a sub-directory of OEROOT, we use readlink to get the full path
+SCRIPTPATH=`readlink -f "$BASH_SOURCE"`
+OEROOT="`dirname $SCRIPTPATH`/../"
-OEROOT=`pwd`
if [ "x$BDIR" = "x" ]; then
- if [ "x$1" = "x" ]; then
- BDIR="build"
- else
- BDIR="$1"
- fi
+ if [ "x$1" = "x" ]; then
+ BDIR="build"
+ else
+ BDIR=`readlink -f "$1"`
+ fi
+fi
+if [[ "$BDIR" = /* ]] ; then
+ BUILDDIR="$BDIR"
+else
+ BUILDDIR="`pwd`/$BDIR"
fi
-BUILDDIR="$OEROOT/$BDIR/"
unset BDIR
+
+mkdir -p $BUILDDIR/conf
+if ! (test -w "$BUILDDIR"); then
+ echo >&2 "Error: Cannot write to $BUILDDIR, perhaps try sourcing with a writable path? i.e. . poky-init-build-env ~/my-build"
+ return
+fi
+
BITBAKEDIR="$OEROOT/bitbake$BBEXTRA/"
PKGDIR="$OEROOT/meta/"
BBPATH="$BITBAKEDIR $PKGDIR"
@@ -51,9 +62,8 @@ do
continue
fi
if [ -e $OEROOT/$repo/poky-extra-environment ]; then
- . $OEROOT/$repo/poky-extra-environment
+ . $OEROOT/$repo/poky-extra-environment
fi
- BBPATH=" $BBPATH $OEROOT/$repo"
done
BBPATH="$BBPATH $HOME/.oe $HOME/.poky $BUILDDIR"
@@ -78,12 +88,13 @@ BUILD_SYS="$BUILD_ARCH-$BUILD_OS"
PATH="$BITBAKEDIR/bin/:$OEROOT/scripts:$PATH"
-cd "$BUILDDIR"
-
# Remove any symlinks from paths
BITBAKEDIR=`readlink -f "$BITBAKEDIR"`
PKGDIR=`readlink -f "$PKGDIR"`
BUILDDIR=`readlink -f "$BUILDDIR"`
+OEROOT=`readlink -f "$OEROOT"`
+
+cd "$BUILDDIR"
if ! (test -d "$BITBAKEDIR" && test -d "$PKGDIR" && test -d "$BUILDDIR"); then
echo >&2 "Error: Not all directories exist! Did you run this script in poky directory?"
@@ -91,7 +102,7 @@ if ! (test -d "$BITBAKEDIR" && test -d "$PKGDIR" && test -d "$BUILDDIR"); then
fi
if [ "x" = "x$POKYLOCALCONF" ]; then
- POKYLOCALCONF="$BUILDDIR/conf/local.conf.sample"
+ POKYLOCALCONF="$OEROOT/build/conf/local.conf.sample"
fi
if ! (test -r "$BUILDDIR/conf/local.conf"); then
echo "You had no conf/local.conf file. Poky has created this configuration file for you"
@@ -105,17 +116,19 @@ if ! (test -r "$BUILDDIR/conf/local.conf"); then
fi
if [ "x" = "x$POKYLAYERCONF" ]; then
- POKYLAYERCONF="$BUILDDIR/conf/bblayers.conf.sample"
+ POKYLAYERCONF="$OEROOT/build/conf/bblayers.conf.sample"
fi
if ! (test -r "$BUILDDIR/conf/bblayers.conf"); then
- cp -f $POKYLAYERCONF $BUILDDIR/conf/bblayers.conf
+ # Put the abosolute path to the layers in bblayers.conf so we can run
+ # bitbake without the init script after the first run
+ sed "s|##POKYBASE##|$OEROOT|g" $POKYLAYERCONF > $BUILDDIR/conf/bblayers.conf
fi
# Prevent disturbing a new GIT clone in same console
unset POKYLOCALCONF
unset POKYLAYERCONF
-export BBPATH OEROOT BUILD_SYS BUILDDIR
+export BBPATH BUILD_SYS BUILDDIR
# Kill off the TERMINFO variable, as glibc will grab its contents in its 'make
# install' if set
@@ -141,4 +154,4 @@ echo "Common targets are poky-image-minimal, poky-image-sato, meta-toolchain or
echo
echo "You can also run generated qemu images with a command like 'runqemu qemux86'"
-export BB_ENV_EXTRAWHITE="MACHINE DISTRO POKYMODE POKYLIBC OEROOT http_proxy ftp_proxy SSH_AGENT_PID SSH_AUTH_SOCK BB_SRCREV_POLICY SDKMACHINE BB_NUMBER_THREADS"
+export BB_ENV_EXTRAWHITE="MACHINE DISTRO POKYMODE POKYLIBC http_proxy ftp_proxy SSH_AGENT_PID SSH_AUTH_SOCK BB_SRCREV_POLICY SDKMACHINE BB_NUMBER_THREADS"
diff --git a/scripts/pstage-scanner b/scripts/pstage-scanner
index 923491258..4a27aa5d2 100755
--- a/scripts/pstage-scanner
+++ b/scripts/pstage-scanner
@@ -1,7 +1,7 @@
#!/usr/bin/env python
##
-## This script will scan all of the packages in ${OEROOT}/pstage (or argv[1])
+## This script will scan all of the packages in PSTAGE_DIR (or argv[1])
## in search of packages which install files outside of their native sysroot
##
@@ -16,15 +16,24 @@ def main():
"""Generate a list of pstage packages and scan them for badness"""
package_list = []
- ## First we walk the pstage directory, let's assume we're running from
- ## a sibling of pstage (i.e. scripts) if no path defined
try:
path = sysv.arg[1]
except:
- path = os.path.join(os.environ.get("OEROOT"), "pstage")
+ # Assume pstage is a child of tmp, Poky's default
+ tmpdir = None
+ sub.Popen(["bitbake", "-e"], stdout=sub.PIPE,stderr=sub.PIPE)
+ err, out = p.communicate()
+ if (!out):
+ print("bitbake not in your environment, try pstage-scanner /some/path/to/pstage")
+ exit
+ for line in out:
+ if line.find("PSTAGE_DIR=") != -1:
+ tmpdir = line.partition("=")[2].strip("\"")
+ break
if len(path) < 1 or not os.path.exists(path):
- path = os.path.join(os.environ.get("OEROOT"), "pstage")
+ print ("No path defined and bitbake not in your environment, try pstage-scanner /some/path/to/pstage")
+ exit
global logf
try:
diff --git a/scripts/qemuimage-tests/sanity/boot b/scripts/qemuimage-tests/sanity/boot
index b4c0094f2..57b204b17 100755
--- a/scripts/qemuimage-tests/sanity/boot
+++ b/scripts/qemuimage-tests/sanity/boot
@@ -9,8 +9,7 @@
# This file is licensed under the GNU General Public License,
# Version 2.
#
-
-. $OEROOT/scripts/qemuimage-testlib
+. $POKYBASE/scripts/qemuimage-testlib
TIMEOUT=120
QEMU_IPADDR="192.168.7.2"
diff --git a/scripts/qemuimage-tests/sanity/ssh b/scripts/qemuimage-tests/sanity/ssh
index 7dd895951..3c7638cc2 100755
--- a/scripts/qemuimage-tests/sanity/ssh
+++ b/scripts/qemuimage-tests/sanity/ssh
@@ -9,7 +9,7 @@
# Version 2.
#
-. $OEROOT/scripts/qemuimage-testlib
+. $POKYBASE/scripts/qemuimage-testlib
TIMEOUT=360
QEMU_IPADDR="192.168.7.2"
diff --git a/scripts/runqemu b/scripts/runqemu
index c7c51ec77..bb26f8b63 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -19,11 +19,23 @@
if [ "x$BUILDDIR" = "x" ]; then
- echo "You need to source poky-init-build-env before running this script"
- exit 1
+ # BUILDDIR unset, try and get TMPDIR from bitbake
+ type -P bitbake &>/dev/null || {
+ echo "You either need bitbake in your PATH or to source poky-init-build-env before running this script" >&2; exit 1; }
+
+ # we have bitbake in PATH, get TMPDIR from the environment
+ TMPDIR=`bitbake -e | grep TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2`
+else
+ TMPDIR=$BUILDDIR/tmp
+fi
+
+if ! (test -d "$TMPDIR"); then
+ echo >&2 "Error: no $TMPDIR directory, please re-run the script from the Poky build directory."
+ return
fi
-INTERNAL_SCRIPT=`which poky-qemu-internal`
+SCRIPTSDIR=`dirname "$0"`
+INTERNAL_SCRIPT=SCRIPTSDIR/poky-qemu-internal`
if [ "x$1" = "x" ]; then
echo
@@ -67,9 +79,9 @@ fi
if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "spitz" -o "$MACHINE" = "borzoi" -o "$MACHINE" = "akita" -o "$MACHINE" = "nokia800" ]; then
if [ "x$ZIMAGE" = "x" ]; then
- ZIMAGE=$BUILDDIR/tmp/deploy/images/zImage-$MACHINE.bin
+ ZIMAGE=$TMPDIR/deploy/images/zImage-$MACHINE.bin
fi
- CROSSPATH=$BUILDDIR/sysroots/$BUILD_SYS/arm-poky-linux-gnueabi/bin
+ CROSSPATH=$TMPDIR/sysroots/$BUILD_SYS/arm-poky-linux-gnueabi/bin
fi
function findimage {
@@ -96,7 +108,7 @@ function findimage {
if [ "$MACHINE" = "qemuarm" ]; then
if [ "$TYPE" = "ext3" ]; then
if [ "x$HDIMAGE" = "x" ]; then
- T=$BUILDDIR/tmp/deploy/images
+ T=$TMPDIR/deploy/images
findimage $T qemuarm ext3 "poky-image-sdk poky-image-sato poky-image-minimal"
fi
fi
@@ -104,34 +116,34 @@ fi
if [ "$MACHINE" = "qemumips" ]; then
if [ "x$ZIMAGE" = "x" ]; then
- ZIMAGE=$BUILDDIR/tmp/deploy/images/vmlinux-$MACHINE.bin
+ ZIMAGE=$TMPDIR/tmp/deploy/images/vmlinux-$MACHINE.bin
fi
if [ "$TYPE" = "ext3" ]; then
if [ "x$HDIMAGE" = "x" ]; then
- T=$BUILDDIR/tmp/deploy/images
+ T=$TMPDIR/tmp/deploy/images
findimage $T $MACHINE ext3 "poky-image-sdk poky-image-sato poky-image-minimal"
fi
fi
- CROSSPATH=$BUILDDIR/tmp/sysroots/$BUILD_SYS/usr
+ CROSSPATH=$TMPDIR/tmp/sysroots/$BUILD_SYS/usr
fi
if [ "$MACHINE" = "qemuppc" ]; then
if [ "x$ZIMAGE" = "x" ]; then
- ZIMAGE=$BUILDDIR/tmp/deploy/images/zImage-$MACHINE.bin
+ ZIMAGE=$TMPDIR/tmp/deploy/images/zImage-$MACHINE.bin
fi
if [ "$TYPE" = "ext3" ]; then
if [ "x$HDIMAGE" = "x" ]; then
- T=$BUILDDIR/tmp/deploy/images
+ T=$TMPDIR/tmp/deploy/images
findimage $T $MACHINE ext3 "poky-image-sdk poky-image-sato poky-image-minimal"
fi
fi
- CROSSPATH=$BUILDDIR/tmp/sysroots/$BUILD_SYS/usr
+ CROSSPATH=$TMPDIR/tmp/sysroots/$BUILD_SYS/usr
fi
if [ "$MACHINE" = "spitz" ]; then
if [ "$TYPE" = "ext3" ]; then
if [ "x$HDIMAGE" = "x" ]; then
- HDIMAGE=$BUILDDIR/tmp/deploy/images/poky-image-sato-spitz.ext3
+ HDIMAGE=$TMPDIR/tmp/deploy/images/poky-image-sato-spitz.ext3
fi
fi
fi
@@ -139,7 +151,7 @@ fi
if [ "$MACHINE" = "akita" ]; then
if [ "$TYPE" = "jffs2" ]; then
if [ "x$HDIMAGE" = "x" ]; then
- HDIMAGE=$BUILDDIR/tmp/deploy/images/poky-image-sato-akita.jffs2
+ HDIMAGE=$TMPDIR/tmp/deploy/images/poky-image-sato-akita.jffs2
fi
fi
fi
@@ -147,7 +159,7 @@ fi
if [ "$MACHINE" = "nokia800" ]; then
if [ "$TYPE" = "jffs2" ]; then
if [ "x$HDIMAGE" = "x" ]; then
- HDIMAGE=$BUILDDIR/tmp/deploy/images/poky-image-sato-nokia800.jffs2
+ HDIMAGE=$TMPDIR/tmp/deploy/images/poky-image-sato-nokia800.jffs2
fi
fi
fi
@@ -155,15 +167,15 @@ fi
if [ "$MACHINE" = "qemux86" ]; then
if [ "x$ZIMAGE" = "x" ]; then
- ZIMAGE=$BUILDDIR/tmp/deploy/images/bzImage-$MACHINE.bin
+ ZIMAGE=$TMPDIR/tmp/deploy/images/bzImage-$MACHINE.bin
fi
if [ "$TYPE" = "ext3" ]; then
if [ "x$HDIMAGE" = "x" ]; then
- T=$BUILDDIR/tmp/deploy/images
+ T=$TMPDIR/tmp/deploy/images
findimage $T qemux86 ext3 "moblin-image-sdk moblin-image-netbook poky-image-sdk poky-image-sato poky-image-minimal"
fi
fi
- CROSSPATH=$BUILDDIR/tmp/sysroots/$BUILD_SYS/usr
+ CROSSPATH=$TMPDIR/tmp/sysroots/$BUILD_SYS/usr
fi
if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "spitz" -o "$MACHINE" = "borzoi" -o "$MACHINE" = "akita" -o "$MACHINE" = "nokia800" ]; then
@@ -182,6 +194,6 @@ if [ ! -e $CROSSPATH/$TARGET_SYS/bin/gcc ]; then
ln -s $CROSSPATH/bin/$TARGET_SYS-gcc $CROSSPATH/$TARGET_SYS/bin/gcc
fi
-CROSSPATH=$BUILDDIR/tmp/sysroots/$BUILD_SYS/usr/bin:$CROSSPATH:$BUILDDIR/tmp/cross/bin
+CROSSPATH=$TMPDIR/tmp/sysroots/$BUILD_SYS/usr/bin:$CROSSPATH:$TMPDIR/tmp/cross/bin
. $INTERNAL_SCRIPT