summaryrefslogtreecommitdiffstats
path: root/scripts/poky-env-internal
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/poky-env-internal
parent50629b3746c149b22bdd8664842a4c69abb2b989 (diff)
downloadpoky-971907567cff64e74f21d349d6751dadc8c09827.tar.gz
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/poky-env-internal')
-rwxr-xr-xscripts/poky-env-internal49
1 files changed, 31 insertions, 18 deletions
diff --git a/scripts/poky-env-internal b/scripts/poky-env-internal
index 54b6ee8964..862ce7aec2 100755
--- a/scripts/poky-env-internal
+++ b/scripts/poky-env-internal
@@ -19,19 +19,30 @@
19# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 20
21 21
22# Change this to the location of this file. 22# scripts/ is a sub-directory of OEROOT, we use readlink to get the full path
23# Also update the locations at the top of conf/local.conf 23SCRIPTPATH=`readlink -f "$BASH_SOURCE"`
24OEROOT="`dirname $SCRIPTPATH`/../"
24 25
25OEROOT=`pwd`
26if [ "x$BDIR" = "x" ]; then 26if [ "x$BDIR" = "x" ]; then
27 if [ "x$1" = "x" ]; then 27 if [ "x$1" = "x" ]; then
28 BDIR="build" 28 BDIR="build"
29 else 29 else
30 BDIR="$1" 30 BDIR=`readlink -f "$1"`
31 fi 31 fi
32fi
33if [[ "$BDIR" = /* ]] ; then
34 BUILDDIR="$BDIR"
35else
36 BUILDDIR="`pwd`/$BDIR"
32fi 37fi
33BUILDDIR="$OEROOT/$BDIR/"
34unset BDIR 38unset BDIR
39
40mkdir -p $BUILDDIR/conf
41if ! (test -w "$BUILDDIR"); then
42 echo >&2 "Error: Cannot write to $BUILDDIR, perhaps try sourcing with a writable path? i.e. . poky-init-build-env ~/my-build"
43 return
44fi
45
35BITBAKEDIR="$OEROOT/bitbake$BBEXTRA/" 46BITBAKEDIR="$OEROOT/bitbake$BBEXTRA/"
36PKGDIR="$OEROOT/meta/" 47PKGDIR="$OEROOT/meta/"
37BBPATH="$BITBAKEDIR $PKGDIR" 48BBPATH="$BITBAKEDIR $PKGDIR"
@@ -51,9 +62,8 @@ do
51 continue 62 continue
52 fi 63 fi
53 if [ -e $OEROOT/$repo/poky-extra-environment ]; then 64 if [ -e $OEROOT/$repo/poky-extra-environment ]; then
54 . $OEROOT/$repo/poky-extra-environment 65 . $OEROOT/$repo/poky-extra-environment
55 fi 66 fi
56 BBPATH=" $BBPATH $OEROOT/$repo"
57done 67done
58 68
59BBPATH="$BBPATH $HOME/.oe $HOME/.poky $BUILDDIR" 69BBPATH="$BBPATH $HOME/.oe $HOME/.poky $BUILDDIR"
@@ -78,12 +88,13 @@ BUILD_SYS="$BUILD_ARCH-$BUILD_OS"
78 88
79PATH="$BITBAKEDIR/bin/:$OEROOT/scripts:$PATH" 89PATH="$BITBAKEDIR/bin/:$OEROOT/scripts:$PATH"
80 90
81cd "$BUILDDIR"
82
83# Remove any symlinks from paths 91# Remove any symlinks from paths
84BITBAKEDIR=`readlink -f "$BITBAKEDIR"` 92BITBAKEDIR=`readlink -f "$BITBAKEDIR"`
85PKGDIR=`readlink -f "$PKGDIR"` 93PKGDIR=`readlink -f "$PKGDIR"`
86BUILDDIR=`readlink -f "$BUILDDIR"` 94BUILDDIR=`readlink -f "$BUILDDIR"`
95OEROOT=`readlink -f "$OEROOT"`
96
97cd "$BUILDDIR"
87 98
88if ! (test -d "$BITBAKEDIR" && test -d "$PKGDIR" && test -d "$BUILDDIR"); then 99if ! (test -d "$BITBAKEDIR" && test -d "$PKGDIR" && test -d "$BUILDDIR"); then
89 echo >&2 "Error: Not all directories exist! Did you run this script in poky directory?" 100 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
91fi 102fi
92 103
93if [ "x" = "x$POKYLOCALCONF" ]; then 104if [ "x" = "x$POKYLOCALCONF" ]; then
94 POKYLOCALCONF="$BUILDDIR/conf/local.conf.sample" 105 POKYLOCALCONF="$OEROOT/build/conf/local.conf.sample"
95fi 106fi
96if ! (test -r "$BUILDDIR/conf/local.conf"); then 107if ! (test -r "$BUILDDIR/conf/local.conf"); then
97 echo "You had no conf/local.conf file. Poky has created this configuration file for you" 108 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
105fi 116fi
106 117
107if [ "x" = "x$POKYLAYERCONF" ]; then 118if [ "x" = "x$POKYLAYERCONF" ]; then
108 POKYLAYERCONF="$BUILDDIR/conf/bblayers.conf.sample" 119 POKYLAYERCONF="$OEROOT/build/conf/bblayers.conf.sample"
109fi 120fi
110if ! (test -r "$BUILDDIR/conf/bblayers.conf"); then 121if ! (test -r "$BUILDDIR/conf/bblayers.conf"); then
111 cp -f $POKYLAYERCONF $BUILDDIR/conf/bblayers.conf 122 # Put the abosolute path to the layers in bblayers.conf so we can run
123 # bitbake without the init script after the first run
124 sed "s|##POKYBASE##|$OEROOT|g" $POKYLAYERCONF > $BUILDDIR/conf/bblayers.conf
112fi 125fi
113 126
114# Prevent disturbing a new GIT clone in same console 127# Prevent disturbing a new GIT clone in same console
115unset POKYLOCALCONF 128unset POKYLOCALCONF
116unset POKYLAYERCONF 129unset POKYLAYERCONF
117 130
118export BBPATH OEROOT BUILD_SYS BUILDDIR 131export BBPATH BUILD_SYS BUILDDIR
119 132
120# Kill off the TERMINFO variable, as glibc will grab its contents in its 'make 133# Kill off the TERMINFO variable, as glibc will grab its contents in its 'make
121# install' if set 134# install' if set
@@ -141,4 +154,4 @@ echo "Common targets are poky-image-minimal, poky-image-sato, meta-toolchain or
141echo 154echo
142echo "You can also run generated qemu images with a command like 'runqemu qemux86'" 155echo "You can also run generated qemu images with a command like 'runqemu qemux86'"
143 156
144export 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" 157export BB_ENV_EXTRAWHITE="MACHINE DISTRO POKYMODE POKYLIBC http_proxy ftp_proxy SSH_AGENT_PID SSH_AUTH_SOCK BB_SRCREV_POLICY SDKMACHINE BB_NUMBER_THREADS"