summaryrefslogtreecommitdiffstats
path: root/scripts/oe-setup-builddir
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/oe-setup-builddir')
-rwxr-xr-xscripts/oe-setup-builddir134
1 files changed, 134 insertions, 0 deletions
diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir
new file mode 100755
index 0000000000..c91e079512
--- /dev/null
+++ b/scripts/oe-setup-builddir
@@ -0,0 +1,134 @@
1#!/bin/sh
2
3# OE Build Environment Setup Script
4#
5# Copyright (C) 2006-2011 Linux Foundation
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
21if [ -z "$BUILDDIR" ]; then
22 echo >&2 "Error: The build directory (BUILDDIR) must be set!"
23 exit 1
24fi
25
26mkdir -p $BUILDDIR/conf
27
28if [ ! -d "$BUILDDIR" ]; then
29 echo >&2 "Error: The builddir ($BUILDDIR) does not exist!"
30 exit 1
31fi
32
33if [ ! -w "$BUILDDIR" ]; then
34 echo >&2 "Error: Cannot write to $BUILDDIR, perhaps try sourcing with a writable path? i.e. . oe-init-build-env ~/my-build"
35 exit 1
36fi
37
38cd "$BUILDDIR"
39
40if [ -f "$BUILDDIR/conf/templateconf.cfg" ]; then
41 TEMPLATECONF=$(cat $BUILDDIR/conf/templateconf.cfg)
42fi
43
44. $OEROOT/.templateconf
45
46if [ ! -f "$BUILDDIR/conf/templateconf.cfg" ]; then
47 echo "$TEMPLATECONF" >$BUILDDIR/conf/templateconf.cfg
48fi
49
50#
51# $TEMPLATECONF can point to a directory for the template local.conf & bblayers.conf
52#
53if [ -n "$TEMPLATECONF" ]; then
54 if [ ! -d "$TEMPLATECONF" ]; then
55 # Allow TEMPLATECONF=meta-xyz/conf as a shortcut
56 if [ -d "$OEROOT/$TEMPLATECONF" ]; then
57 TEMPLATECONF="$OEROOT/$TEMPLATECONF"
58 fi
59 if [ ! -d "$TEMPLATECONF" ]; then
60 echo >&2 "Error: '$TEMPLATECONF' must be a directory containing local.conf & bblayers.conf"
61 exit 1
62 fi
63 fi
64 OECORELAYERCONF="$TEMPLATECONF/bblayers.conf.sample"
65 OECORELOCALCONF="$TEMPLATECONF/local.conf.sample"
66 OECORENOTESCONF="$TEMPLATECONF/conf-notes.txt"
67fi
68
69if [ -z "$OECORELOCALCONF" ]; then
70 OECORELOCALCONF="$OEROOT/meta/conf/local.conf.sample"
71fi
72if [ ! -r "$BUILDDIR/conf/local.conf" ]; then
73cat <<EOM
74You had no conf/local.conf file. This configuration file has therefore been
75created for you with some default values. You may wish to edit it to use a
76different MACHINE (target hardware) or enable parallel build options to take
77advantage of multiple cores for example. See the file for more information as
78common configuration options are commented.
79
80The Yocto Project has extensive documentation about OE including a reference manual
81which can be found at:
82 http://yoctoproject.org/documentation
83
84For more information about OpenEmbedded see their website:
85 http://www.openembedded.org/
86
87EOM
88 cp -f $OECORELOCALCONF $BUILDDIR/conf/local.conf
89fi
90
91if [ -z "$OECORELAYERCONF" ]; then
92 OECORELAYERCONF="$OEROOT/meta/conf/bblayers.conf.sample"
93fi
94if [ ! -r "$BUILDDIR/conf/bblayers.conf" ]; then
95 cat <<EOM
96You had no conf/bblayers.conf file. The configuration file has been created for
97you with some default values. To add additional metadata layers into your
98configuration please add entries to this file.
99
100The Yocto Project has extensive documentation about OE including a reference manual
101which can be found at:
102 http://yoctoproject.org/documentation
103
104For more information about OpenEmbedded see their website:
105 http://www.openembedded.org/
106
107
108EOM
109
110 # Put the abosolute path to the layers in bblayers.conf so we can run
111 # bitbake without the init script after the first run
112 # ##COREBASE## is deprecated as it's meaning was inconsistent, but continue
113 # to replace it for compatibility.
114 sed -e "s|##OEROOT##|$OEROOT|g" \
115 -e "s|##COREBASE##|$OEROOT|g" \
116 $OECORELAYERCONF > $BUILDDIR/conf/bblayers.conf
117fi
118
119# Prevent disturbing a new GIT clone in same console
120unset OECORELOCALCONF
121unset OECORELAYERCONF
122
123cat <<EOM
124
125### Shell environment set up for builds. ###
126
127You can now run 'bitbake <target>'
128
129EOM
130if [ -z "$OECORENOTESCONF" ]; then
131 OECORENOTESCONF="$OEROOT/meta/conf/conf-notes.txt"
132fi
133[ ! -r "$OECORENOTESCONF" ] || cat $OECORENOTESCONF
134unset OECORENOTESCONF