diff options
author | Mark Hatle <mark.hatle@windriver.com> | 2010-11-24 16:25:28 -0600 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-12-20 23:00:25 +0000 |
commit | 86b6b093374c37aeca87cdc36fc56440919d9458 (patch) | |
tree | 5380badad53264eaa2d4ff07f178bf92c3679cb9 | |
parent | 9975c00c1a6a9ae1c39678dec0986f4c62418c96 (diff) | |
download | poky-86b6b093374c37aeca87cdc36fc56440919d9458.tar.gz |
poky-init-build-env: Breakup the environment script
Break up the scripts/poky-env-internal into two parts:
1) Chunk that is sourced and sets up the environment
2) Chunk that is executed and configures the build directory
OEROOT configuration was moved into the initial poky-init-build-env script.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-rwxr-xr-x | poky-init-build-env | 8 | ||||
-rwxr-xr-x | scripts/poky-env-internal | 102 | ||||
-rwxr-xr-x | scripts/poky-setup-builddir | 113 |
3 files changed, 129 insertions, 94 deletions
diff --git a/poky-init-build-env b/poky-init-build-env index 075070370b..7af2172a45 100755 --- a/poky-init-build-env +++ b/poky-init-build-env | |||
@@ -24,6 +24,12 @@ if [ "x$0" = "x./poky-init-build-env" ]; then | |||
24 | elif [ "x$BASH_SOURCE" = "x" ]; then | 24 | elif [ "x$BASH_SOURCE" = "x" ]; then |
25 | echo "Error: You are not running a Bash shell. Please use Bash or add support for your shell to the init scripts" | 25 | echo "Error: You are not running a Bash shell. Please use Bash or add support for your shell to the init scripts" |
26 | else | 26 | else |
27 | . `dirname $BASH_SOURCE`/scripts/poky-env-internal | 27 | OEROOT="`dirname $BASH_SOURCE`" |
28 | OEROOT=`readlink -f "$OEROOT"` | ||
29 | export OEROOT | ||
30 | . $OEROOT/scripts/poky-env-internal | ||
31 | $OEROOT/scripts/poky-setup-builddir | ||
32 | unset OEROOT | ||
33 | [ -n "$BUILDDIR" ] && cd $BUILDDIR | ||
28 | fi | 34 | fi |
29 | 35 | ||
diff --git a/scripts/poky-env-internal b/scripts/poky-env-internal index 1557f9ddbd..2ec07ed061 100755 --- a/scripts/poky-env-internal +++ b/scripts/poky-env-internal | |||
@@ -18,9 +18,11 @@ | |||
18 | # along with this program; if not, write to the Free Software | 18 | # along with this program; if not, write to the Free Software |
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 | # scripts/ is a sub-directory of OEROOT, we use readlink to get the full path | 21 | # It is assumed OEROOT is already defined when this is called |
22 | SCRIPTPATH=`readlink -f "$BASH_SOURCE"` | 22 | if [ -z "$OEROOT" ]; then |
23 | OEROOT="`dirname $SCRIPTPATH`/../" | 23 | echo >&2 "Error: OEROOT is not defined!" |
24 | return | ||
25 | fi | ||
24 | 26 | ||
25 | if [ "x$BDIR" = "x" ]; then | 27 | if [ "x$BDIR" = "x" ]; then |
26 | if [ "x$1" = "x" ]; then | 28 | if [ "x$1" = "x" ]; then |
@@ -36,109 +38,23 @@ else | |||
36 | fi | 38 | fi |
37 | unset BDIR | 39 | unset BDIR |
38 | 40 | ||
39 | mkdir -p $BUILDDIR/conf | ||
40 | if ! (test -w "$BUILDDIR"); then | ||
41 | echo >&2 "Error: Cannot write to $BUILDDIR, perhaps try sourcing with a writable path? i.e. . poky-init-build-env ~/my-build" | ||
42 | return | ||
43 | fi | ||
44 | |||
45 | BITBAKEDIR="$OEROOT/bitbake$BBEXTRA/" | 41 | BITBAKEDIR="$OEROOT/bitbake$BBEXTRA/" |
46 | 42 | ||
47 | PATH="${OEROOT}/scripts:$BITBAKEDIR/bin/:$PATH" | ||
48 | |||
49 | # Remove any symlinks from paths | ||
50 | BITBAKEDIR=`readlink -f "$BITBAKEDIR"` | 43 | BITBAKEDIR=`readlink -f "$BITBAKEDIR"` |
51 | BUILDDIR=`readlink -f "$BUILDDIR"` | 44 | BUILDDIR=`readlink -f "$BUILDDIR"` |
52 | OEROOT=`readlink -f "$OEROOT"` | ||
53 | |||
54 | cd "$BUILDDIR" | ||
55 | 45 | ||
56 | if ! (test -d "$BITBAKEDIR" && test -d "$BUILDDIR"); then | 46 | if ! (test -d "$BITBAKEDIR"); then |
57 | echo >&2 "Error: Not all directories exist! Did you run this script in poky directory?" | 47 | echo >&2 "Error: The bitbake directory ($BITBAKEDIR) does not exist! Did you source the script in the poky directory?" |
58 | return | 48 | return |
59 | fi | 49 | fi |
60 | 50 | ||
61 | # | 51 | PATH="${OEROOT}/scripts:$BITBAKEDIR/bin/:$PATH" |
62 | # $POKYCONF can point to a directory for the template local.conf & bblayers.conf | ||
63 | # | ||
64 | if [ "x" != "x$POKYCONF" ]; then | ||
65 | if ! (test -d "$POKYCONF"); then | ||
66 | # Allow POKYCONF=meta-xyz/conf as a shortcut | ||
67 | if [ -d "$OEROOT/$POKYCONF" ]; then | ||
68 | POKYCONF="$OEROOT/$POKYCONF" | ||
69 | fi | ||
70 | if ! (test -d "$POKYCONF"); then | ||
71 | echo >&2 "Error: '$POKYCONF' must be a directory containing local.conf & bblayers.conf" | ||
72 | return | ||
73 | fi | ||
74 | fi | ||
75 | POKYLAYERCONF="$POKYCONF/bblayers.conf" | ||
76 | POKYLOCALCONF="$POKYCONF/local.conf" | ||
77 | fi | ||
78 | |||
79 | if [ "x" = "x$POKYLOCALCONF" ]; then | ||
80 | POKYLOCALCONF="$OEROOT/meta/conf/local.conf.sample" | ||
81 | fi | ||
82 | if ! (test -r "$BUILDDIR/conf/local.conf"); then | ||
83 | cat <<EOM | ||
84 | You had no conf/local.conf file. Poky has created this configuration file for | ||
85 | you with some default values. You may wish to edit it to use a different MACHINE | ||
86 | (target hardware) or enable parallel build options to take advantage of multiple | ||
87 | cores for example. See the file for more information as common configuration | ||
88 | options are commented. | ||
89 | |||
90 | Also, for more information see the Poky handbook: | ||
91 | http://pokylinux.org/doc/poky-handbook.html | ||
92 | |||
93 | EOM | ||
94 | cp -f $POKYLOCALCONF $BUILDDIR/conf/local.conf | ||
95 | fi | ||
96 | |||
97 | if [ "x" = "x$POKYLAYERCONF" ]; then | ||
98 | POKYLAYERCONF="$OEROOT/meta/conf/bblayers.conf.sample" | ||
99 | fi | ||
100 | if ! (test -r "$BUILDDIR/conf/bblayers.conf"); then | ||
101 | cat <<EOM | ||
102 | You had no conf/bblayers.conf file. Poky has created this configuration file for | ||
103 | you with some default values. To add additional metadata layers into your | ||
104 | configuration please add entries to this file. | ||
105 | |||
106 | For more information see the Poky handbook: | ||
107 | http://pokylinux.org/doc/poky-handbook.html | ||
108 | |||
109 | EOM | ||
110 | |||
111 | # Put the abosolute path to the layers in bblayers.conf so we can run | ||
112 | # bitbake without the init script after the first run | ||
113 | sed "s|##POKYBASE##|$OEROOT|g" $POKYLAYERCONF > $BUILDDIR/conf/bblayers.conf | ||
114 | fi | ||
115 | |||
116 | # Prevent disturbing a new GIT clone in same console | ||
117 | unset POKYLOCALCONF | ||
118 | unset POKYLAYERCONF | ||
119 | unset BITBAKEDIR | 52 | unset BITBAKEDIR |
120 | unset OEROOT | ||
121 | 53 | ||
122 | # Used by the poky-qemu script | 54 | # Used by the poky-qemu script |
123 | export BUILDDIR | 55 | export BUILDDIR |
124 | export PATH | 56 | export PATH |
57 | |||
125 | # Stop multi byte characters breaking the patcher stuff - This is for Redhat / Fedora people really | 58 | # Stop multi byte characters breaking the patcher stuff - This is for Redhat / Fedora people really |
126 | export LANG=C | 59 | export LANG=C |
127 | export BB_ENV_EXTRAWHITE="MACHINE DISTRO POKYMODE POKYLIBC http_proxy ftp_proxy https_proxy all_proxy ALL_PROXY no_proxy SSH_AGENT_PID SSH_AUTH_SOCK BB_SRCREV_POLICY SDKMACHINE BB_NUMBER_THREADS GIT_PROXY_COMMAND PSEUDO_DISABLED" | 60 | export BB_ENV_EXTRAWHITE="MACHINE DISTRO POKYMODE POKYLIBC http_proxy ftp_proxy https_proxy all_proxy ALL_PROXY no_proxy SSH_AGENT_PID SSH_AUTH_SOCK BB_SRCREV_POLICY SDKMACHINE BB_NUMBER_THREADS GIT_PROXY_COMMAND PSEUDO_DISABLED" |
128 | |||
129 | cat <<EOM | ||
130 | |||
131 | ### Shell environment set up for Poky builds. ### | ||
132 | |||
133 | You can now run 'bitbake <target>' | ||
134 | |||
135 | Common targets are: | ||
136 | poky-image-minimal | ||
137 | poky-image-sato | ||
138 | meta-toolchain | ||
139 | meta-toolchain-sdk | ||
140 | |||
141 | You can also run generated qemu images with a command like 'poky-qemu qemux86' | ||
142 | |||
143 | EOM | ||
144 | |||
diff --git a/scripts/poky-setup-builddir b/scripts/poky-setup-builddir new file mode 100755 index 0000000000..7a1452f7ce --- /dev/null +++ b/scripts/poky-setup-builddir | |||
@@ -0,0 +1,113 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Poky Build Enviroment Setup Script | ||
4 | # | ||
5 | # Copyright (C) 2006-2007 OpenedHand Ltd. | ||
6 | # | ||
7 | # This program is free software; you can redistribute it and/or modify | ||
8 | # it under the terms of the GNU General Public License as published by | ||
9 | # the Free Software Foundation; either version 2 of the License, or | ||
10 | # (at your option) any later version. | ||
11 | # | ||
12 | # This program is distributed in the hope that it will be useful, | ||
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | # GNU General Public License for more details. | ||
16 | # | ||
17 | # You should have received a copy of the GNU General Public License | ||
18 | # along with this program; if not, write to the Free Software | ||
19 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | |||
21 | if [ -z "$BUILDDIR" ]; then | ||
22 | echo >&2 "Error: The build directory (BUILDDIR) must be set!" | ||
23 | exit 1 | ||
24 | fi | ||
25 | |||
26 | mkdir -p $BUILDDIR/conf | ||
27 | |||
28 | if ! (test -d "$BUILDDIR"); then | ||
29 | echo >&2 "Error: The builddir ($BUILDDIR) does not exist!" | ||
30 | exit 1 | ||
31 | fi | ||
32 | |||
33 | if ! (test -w "$BUILDDIR"); then | ||
34 | echo >&2 "Error: Cannot write to $BUILDDIR, perhaps try sourcing with a writable path? i.e. . poky-init-build-env ~/my-build" | ||
35 | exit 1 | ||
36 | fi | ||
37 | |||
38 | cd "$BUILDDIR" | ||
39 | |||
40 | # | ||
41 | # $POKYCONF can point to a directory for the template local.conf & bblayers.conf | ||
42 | # | ||
43 | if [ "x" != "x$POKYCONF" ]; then | ||
44 | if ! (test -d "$POKYCONF"); then | ||
45 | # Allow POKYCONF=meta-xyz/conf as a shortcut | ||
46 | if [ -d "$OEROOT/$POKYCONF" ]; then | ||
47 | POKYCONF="$OEROOT/$POKYCONF" | ||
48 | fi | ||
49 | if ! (test -d "$POKYCONF"); then | ||
50 | echo >&2 "Error: '$POKYCONF' must be a directory containing local.conf & bblayers.conf" | ||
51 | return | ||
52 | fi | ||
53 | fi | ||
54 | POKYLAYERCONF="$POKYCONF/bblayers.conf" | ||
55 | POKYLOCALCONF="$POKYCONF/local.conf" | ||
56 | fi | ||
57 | |||
58 | if [ "x" = "x$POKYLOCALCONF" ]; then | ||
59 | POKYLOCALCONF="$OEROOT/meta/conf/local.conf.sample" | ||
60 | fi | ||
61 | if ! (test -r "$BUILDDIR/conf/local.conf"); then | ||
62 | cat <<EOM | ||
63 | You had no conf/local.conf file. Poky has created this configuration file for | ||
64 | you with some default values. You may wish to edit it to use a different MACHINE | ||
65 | (target hardware) or enable parallel build options to take advantage of multiple | ||
66 | cores for example. See the file for more information as common configuration | ||
67 | options are commented. | ||
68 | |||
69 | Also, for more information see the Poky handbook: | ||
70 | http://pokylinux.org/doc/poky-handbook.html | ||
71 | |||
72 | EOM | ||
73 | cp -f $POKYLOCALCONF $BUILDDIR/conf/local.conf | ||
74 | fi | ||
75 | |||
76 | if [ "x" = "x$POKYLAYERCONF" ]; then | ||
77 | POKYLAYERCONF="$OEROOT/meta/conf/bblayers.conf.sample" | ||
78 | fi | ||
79 | if ! (test -r "$BUILDDIR/conf/bblayers.conf"); then | ||
80 | cat <<EOM | ||
81 | You had no conf/bblayers.conf file. Poky has created this configuration file for | ||
82 | you with some default values. To add additional metadata layers into your | ||
83 | configuration please add entries to this file. | ||
84 | |||
85 | For more information see the Poky handbook: | ||
86 | http://pokylinux.org/doc/poky-handbook.html | ||
87 | |||
88 | EOM | ||
89 | |||
90 | # Put the abosolute path to the layers in bblayers.conf so we can run | ||
91 | # bitbake without the init script after the first run | ||
92 | sed "s|##POKYBASE##|$OEROOT|g" $POKYLAYERCONF > $BUILDDIR/conf/bblayers.conf | ||
93 | fi | ||
94 | |||
95 | # Prevent disturbing a new GIT clone in same console | ||
96 | unset POKYLOCALCONF | ||
97 | unset POKYLAYERCONF | ||
98 | |||
99 | cat <<EOM | ||
100 | |||
101 | ### Shell environment set up for Poky builds. ### | ||
102 | |||
103 | You can now run 'bitbake <target>' | ||
104 | |||
105 | Common targets are: | ||
106 | poky-image-minimal | ||
107 | poky-image-sato | ||
108 | meta-toolchain | ||
109 | meta-toolchain-sdk | ||
110 | |||
111 | You can also run generated qemu images with a command like 'poky-qemu qemux86' | ||
112 | |||
113 | EOM | ||