oe-setup-builddir 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #!/bin/sh
  2. # OE Build Environment Setup Script
  3. #
  4. # Copyright (C) 2006-2011 Linux Foundation
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. if [ -z "$BUILDDIR" ]; then
  20. echo >&2 "Error: The build directory (BUILDDIR) must be set!"
  21. exit 1
  22. fi
  23. mkdir -p $BUILDDIR/conf
  24. if ! (test -d "$BUILDDIR"); then
  25. echo >&2 "Error: The builddir ($BUILDDIR) does not exist!"
  26. exit 1
  27. fi
  28. if ! (test -w "$BUILDDIR"); then
  29. echo >&2 "Error: Cannot write to $BUILDDIR, perhaps try sourcing with a writable path? i.e. . oe-init-build-env ~/my-build"
  30. exit 1
  31. fi
  32. cd "$BUILDDIR"
  33. TEMPLATECONF=${TEMPLATECONF:-meta-yocto/conf}
  34. #
  35. # $TEMPLATECONF can point to a directory for the template local.conf & bblayers.conf
  36. #
  37. if [ "x" != "x$TEMPLATECONF" ]; then
  38. if ! (test -d "$TEMPLATECONF"); then
  39. # Allow TEMPLATECONF=meta-xyz/conf as a shortcut
  40. if [ -d "$OEROOT/$TEMPLATECONF" ]; then
  41. TEMPLATECONF="$OEROOT/$TEMPLATECONF"
  42. fi
  43. if ! (test -d "$TEMPLATECONF"); then
  44. echo >&2 "Error: '$TEMPLATECONF' must be a directory containing local.conf & bblayers.conf"
  45. return
  46. fi
  47. fi
  48. OECORELAYERCONF="$TEMPLATECONF/bblayers.conf.sample"
  49. OECORELOCALCONF="$TEMPLATECONF/local.conf.sample"
  50. OECORENOTESCONF="$TEMPLATECONF/conf-notes.txt"
  51. fi
  52. if [ "x" = "x$OECORELOCALCONF" ]; then
  53. OECORELOCALCONF="$OEROOT/meta/conf/local.conf.sample"
  54. fi
  55. if ! (test -r "$BUILDDIR/conf/local.conf"); then
  56. cat <<EOM
  57. You had no conf/local.conf file. This configuration file has therefore been
  58. created for you with some default values. You may wish to edit it to use a
  59. different MACHINE (target hardware) or enable parallel build options to take
  60. advantage of multiple cores for example. See the file for more information as
  61. common configuration options are commented.
  62. The Yocto Project has extensive documentation about OE including a reference manual
  63. which can be found at:
  64. http://yoctoproject.org/documentation
  65. For more information about OpenEmbedded see their website:
  66. http://www.openembedded.org/
  67. EOM
  68. cp -f $OECORELOCALCONF $BUILDDIR/conf/local.conf
  69. fi
  70. if [ "x" = "x$OECORELAYERCONF" ]; then
  71. OECORELAYERCONF="$OEROOT/meta/conf/bblayers.conf.sample"
  72. fi
  73. if ! (test -r "$BUILDDIR/conf/bblayers.conf"); then
  74. cat <<EOM
  75. You had no conf/bblayers.conf file. The configuration file has been created for
  76. you with some default values. To add additional metadata layers into your
  77. configuration please add entries to this file.
  78. The Yocto Project has extensive documentation about OE including a reference manual
  79. which can be found at:
  80. http://yoctoproject.org/documentation
  81. For more information about OpenEmbedded see their website:
  82. http://www.openembedded.org/
  83. EOM
  84. # Put the abosolute path to the layers in bblayers.conf so we can run
  85. # bitbake without the init script after the first run
  86. sed "s|##COREBASE##|$OEROOT|g" $OECORELAYERCONF > $BUILDDIR/conf/bblayers.conf
  87. fi
  88. # Prevent disturbing a new GIT clone in same console
  89. unset OECORELOCALCONF
  90. unset OECORELAYERCONF
  91. cat <<EOM
  92. ### Shell environment set up for builds. ###
  93. You can now run 'bitbake <target>'
  94. EOM
  95. if [ "x" = "x$OECORENOTESCONF" ]; then
  96. OECORENOTESCONF="$OEROOT/meta/conf/conf-notes.txt"
  97. fi
  98. [ ! -r "$OECORENOTESCONF" ] || cat $OECORENOTESCONF
  99. unset OECORENOTESCONF