]>
git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/blob - scripts/oe-setup-builddir
3 # OE Build Environment Setup Script
5 # Copyright (C) 2006-2011 Linux Foundation
7 # SPDX-License-Identifier: GPL-2.0-or-later
15 [ -n "$BUILDDIR" ] || die
"The build directory (BUILDDIR) must be set!"
17 if [ "$1" = '--help' ] ||
[ "$1" = '-h' ]; then
18 echo 'Usage: oe-setup-builddir'
20 echo "OpenEmbedded setup-builddir - setup build directory $BUILDDIR"
25 mkdir
-p "$BUILDDIR/conf"
27 [ -d "$BUILDDIR" ] || die
"The build directory ($BUILDDIR) does not exist!"
29 die
"Cannot write to $BUILDDIR, perhaps try sourcing with a writable path? i.e. . oe-init-build-env ~/my-build"
31 # Attempting removal of sticky,setuid bits from BUILDDIR, BUILDDIR/conf
32 chmod -st "$BUILDDIR" 2>/dev
/null ||
echo "WARNING: unable to chmod $BUILDDIR"
33 chmod -st "$BUILDDIR/conf" 2>/dev
/null ||
echo "WARNING: unable to chmod $BUILDDIR/conf"
35 cd "$BUILDDIR" || die
"Failed to change directory to $BUILDDIR!"
37 .
"$OEROOT/.templateconf"
39 # Keep the original TEMPLATECONF before possibly prefixing it with $OEROOT below.
40 ORG_TEMPLATECONF
=$TEMPLATECONF
43 # $TEMPLATECONF can point to a directory for the template local.conf & bblayers.conf
45 if [ -n "$TEMPLATECONF" ]; then
46 if [ ! -d "$TEMPLATECONF" ]; then
47 # Allow TEMPLATECONF=meta-xyz/conf as a shortcut
48 if [ -d "$OEROOT/$TEMPLATECONF" ]; then
49 TEMPLATECONF
="$OEROOT/$TEMPLATECONF"
51 [ -d "$TEMPLATECONF" ] ||
52 die
"TEMPLATECONF value points to nonexistent directory '$TEMPLATECONF'"
54 templatesdir
=$
(python3
-c "import sys; print(sys.argv[1].strip('/').split('/')[-2])" "$TEMPLATECONF")
55 if [ "$templatesdir" != templates
] ||
[ ! -f "$TEMPLATECONF/../../layer.conf" ]; then
56 die
"TEMPLATECONF value (which is $TEMPLATECONF) must point to meta-some-layer/conf/templates/template-name"
58 OECORELAYERCONF
="$TEMPLATECONF/bblayers.conf.sample"
59 OECORELOCALCONF
="$TEMPLATECONF/local.conf.sample"
60 OECORENOTESCONF
="$TEMPLATECONF/conf-notes.txt"
64 if [ -z "$OECORELOCALCONF" ]; then
65 OECORELOCALCONF
="$OEROOT/meta/conf/templates/default/local.conf.sample"
67 if [ ! -r "$BUILDDIR/conf/local.conf" ]; then
69 You had no conf/local.conf file. This configuration file has therefore been
70 created for you from $OECORELOCALCONF
71 You may wish to edit it to, for example, select a different MACHINE (target
75 cp -f "$OECORELOCALCONF" "$BUILDDIR/conf/local.conf"
79 if [ -z "$OECORELAYERCONF" ]; then
80 OECORELAYERCONF
="$OEROOT/meta/conf/templates/default/bblayers.conf.sample"
82 if [ ! -r "$BUILDDIR/conf/bblayers.conf" ]; then
84 You had no conf/bblayers.conf file. This configuration file has therefore been
85 created for you from $OECORELAYERCONF
86 To add additional metadata layers into your configuration please add entries
87 to conf/bblayers.conf.
91 # Put the absolute path to the layers in bblayers.conf so we can run
92 # bitbake without the init script after the first run.
93 # ##COREBASE## is deprecated as its meaning was inconsistent, but continue
94 # to replace it for compatibility.
95 sed -e "s|##OEROOT##|$OEROOT|g" \
96 -e "s|##COREBASE##|$OEROOT|g" \
97 "$OECORELAYERCONF" > "$BUILDDIR/conf/bblayers.conf"
101 # Prevent disturbing a new GIT clone in same console
102 unset OECORELOCALCONF
103 unset OECORELAYERCONF
105 # Ending the first-time run message. Show the YP Documentation banner.
106 if [ -n "$SHOWYPDOC" ]; then
108 The Yocto Project has extensive documentation about OE including a reference
109 manual which can be found at:
110 https://docs.yoctoproject.org
112 For more information about OpenEmbedded see the website:
113 https://www.openembedded.org/
119 if [ -z "$OECORENOTESCONF" ]; then
120 OECORENOTESCONF
="$OEROOT/meta/conf/templates/default/conf-notes.txt"
122 [ ! -r "$OECORENOTESCONF" ] ||
cat "$OECORENOTESCONF"
123 unset OECORENOTESCONF
125 if [ ! -f "$BUILDDIR/conf/templateconf.cfg" ]; then
126 echo "$ORG_TEMPLATECONF" >"$BUILDDIR/conf/templateconf.cfg"