Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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 | |
| 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 [ ! -d "$BUILDDIR" ]; then |
| 29 | echo >&2 "Error: The builddir ($BUILDDIR) does not exist!" |
| 30 | exit 1 |
| 31 | fi |
| 32 | |
| 33 | if [ ! -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 |
| 36 | fi |
| 37 | |
| 38 | # Attempting removal of sticky,setuid bits from BUILDDIR, BUILDDIR/conf |
| 39 | chmod -st "$BUILDDIR" 2>/dev/null || echo "WARNING: unable to chmod $BUILDDIR" |
| 40 | chmod -st "$BUILDDIR/conf" 2>/dev/null || echo "WARNING: unable to chmod $BUILDDIR/conf" |
| 41 | |
| 42 | cd "$BUILDDIR" |
| 43 | |
| 44 | if [ -f "$BUILDDIR/conf/templateconf.cfg" ]; then |
| 45 | TEMPLATECONF=$(cat "$BUILDDIR/conf/templateconf.cfg") |
| 46 | fi |
| 47 | |
| 48 | . $OEROOT/.templateconf |
| 49 | |
| 50 | if [ ! -f "$BUILDDIR/conf/templateconf.cfg" ]; then |
| 51 | echo "$TEMPLATECONF" >"$BUILDDIR/conf/templateconf.cfg" |
| 52 | fi |
| 53 | |
| 54 | # |
| 55 | # $TEMPLATECONF can point to a directory for the template local.conf & bblayers.conf |
| 56 | # |
| 57 | if [ -n "$TEMPLATECONF" ]; then |
| 58 | if [ ! -d "$TEMPLATECONF" ]; then |
| 59 | # Allow TEMPLATECONF=meta-xyz/conf as a shortcut |
| 60 | if [ -d "$OEROOT/$TEMPLATECONF" ]; then |
| 61 | TEMPLATECONF="$OEROOT/$TEMPLATECONF" |
| 62 | fi |
| 63 | if [ ! -d "$TEMPLATECONF" ]; then |
| 64 | echo >&2 "Error: '$TEMPLATECONF' must be a directory containing local.conf & bblayers.conf" |
| 65 | exit 1 |
| 66 | fi |
| 67 | fi |
| 68 | OECORELAYERCONF="$TEMPLATECONF/bblayers.conf.sample" |
| 69 | OECORELOCALCONF="$TEMPLATECONF/local.conf.sample" |
| 70 | OECORENOTESCONF="$TEMPLATECONF/conf-notes.txt" |
| 71 | fi |
| 72 | |
| 73 | unset SHOWYPDOC |
| 74 | if [ -z "$OECORELOCALCONF" ]; then |
| 75 | OECORELOCALCONF="$OEROOT/meta/conf/local.conf.sample" |
| 76 | fi |
| 77 | if [ ! -r "$BUILDDIR/conf/local.conf" ]; then |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame^] | 78 | cat <<EOM |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 79 | You had no conf/local.conf file. This configuration file has therefore been |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame^] | 80 | created for you with some default values. You may wish to edit it to, for |
| 81 | example, select a different MACHINE (target hardware). See conf/local.conf |
| 82 | for more information as common configuration options are commented. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 83 | |
| 84 | EOM |
| 85 | cp -f $OECORELOCALCONF "$BUILDDIR/conf/local.conf" |
| 86 | SHOWYPDOC=yes |
| 87 | fi |
| 88 | |
| 89 | if [ -z "$OECORELAYERCONF" ]; then |
| 90 | OECORELAYERCONF="$OEROOT/meta/conf/bblayers.conf.sample" |
| 91 | fi |
| 92 | if [ ! -r "$BUILDDIR/conf/bblayers.conf" ]; then |
| 93 | cat <<EOM |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame^] | 94 | You had no conf/bblayers.conf file. This configuration file has therefore been |
| 95 | created for you with some default values. To add additional metadata layers |
| 96 | into your configuration please add entries to conf/bblayers.conf. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 97 | |
| 98 | EOM |
| 99 | |
| 100 | # Put the abosolute path to the layers in bblayers.conf so we can run |
| 101 | # bitbake without the init script after the first run |
| 102 | # ##COREBASE## is deprecated as it's meaning was inconsistent, but continue |
| 103 | # to replace it for compatibility. |
| 104 | sed -e "s|##OEROOT##|$OEROOT|g" \ |
| 105 | -e "s|##COREBASE##|$OEROOT|g" \ |
| 106 | $OECORELAYERCONF > "$BUILDDIR/conf/bblayers.conf" |
| 107 | SHOWYPDOC=yes |
| 108 | fi |
| 109 | |
| 110 | # Prevent disturbing a new GIT clone in same console |
| 111 | unset OECORELOCALCONF |
| 112 | unset OECORELAYERCONF |
| 113 | |
| 114 | # Ending the first-time run message. Show the YP Documentation banner. |
| 115 | if [ ! -z "$SHOWYPDOC" ]; then |
| 116 | cat <<EOM |
| 117 | The Yocto Project has extensive documentation about OE including a reference |
| 118 | manual which can be found at: |
| 119 | http://yoctoproject.org/documentation |
| 120 | |
| 121 | For more information about OpenEmbedded see their website: |
| 122 | http://www.openembedded.org/ |
| 123 | |
| 124 | EOM |
| 125 | # unset SHOWYPDOC |
| 126 | fi |
| 127 | |
| 128 | cat <<EOM |
| 129 | |
| 130 | ### Shell environment set up for builds. ### |
| 131 | |
| 132 | You can now run 'bitbake <target>' |
| 133 | |
| 134 | EOM |
| 135 | if [ -z "$OECORENOTESCONF" ]; then |
| 136 | OECORENOTESCONF="$OEROOT/meta/conf/conf-notes.txt" |
| 137 | fi |
| 138 | [ ! -r "$OECORENOTESCONF" ] || cat $OECORENOTESCONF |
| 139 | unset OECORENOTESCONF |