poky-env-internal 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #!/bin/sh
  2. # Poky Build Enviroment Setup Script
  3. #
  4. # Copyright (C) 2006-2007 OpenedHand Ltd.
  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. # scripts/ is a sub-directory of OEROOT, we use readlink to get the full path
  20. SCRIPTPATH=`readlink -f "$BASH_SOURCE"`
  21. OEROOT="`dirname $SCRIPTPATH`/../"
  22. if [ "x$BDIR" = "x" ]; then
  23. if [ "x$1" = "x" ]; then
  24. BDIR="build"
  25. else
  26. BDIR=`readlink -f "$1"`
  27. fi
  28. fi
  29. if [[ "$BDIR" = /* ]] ; then
  30. BUILDDIR="$BDIR"
  31. else
  32. BUILDDIR="`pwd`/$BDIR"
  33. fi
  34. unset BDIR
  35. mkdir -p $BUILDDIR/conf
  36. if ! (test -w "$BUILDDIR"); then
  37. echo >&2 "Error: Cannot write to $BUILDDIR, perhaps try sourcing with a writable path? i.e. . poky-init-build-env ~/my-build"
  38. return
  39. fi
  40. BITBAKEDIR="$OEROOT/bitbake$BBEXTRA/"
  41. PATH="$BITBAKEDIR/bin/:$OEROOT/scripts:$PATH"
  42. # Remove any symlinks from paths
  43. BITBAKEDIR=`readlink -f "$BITBAKEDIR"`
  44. BUILDDIR=`readlink -f "$BUILDDIR"`
  45. OEROOT=`readlink -f "$OEROOT"`
  46. cd "$BUILDDIR"
  47. if ! (test -d "$BITBAKEDIR" && test -d "$BUILDDIR"); then
  48. echo >&2 "Error: Not all directories exist! Did you run this script in poky directory?"
  49. return
  50. fi
  51. if [ "x" = "x$POKYLOCALCONF" ]; then
  52. POKYLOCALCONF="$OEROOT/meta/conf/local.conf.sample"
  53. fi
  54. if ! (test -r "$BUILDDIR/conf/local.conf"); then
  55. cat <<EOM
  56. You had no conf/local.conf file. Poky has created this configuration file for
  57. you with some default values. You may wish to edit it to use a different MACHINE
  58. (target hardware) or enable parallel build options to take advantage of multiple
  59. cores for example. See the file for more information as common configuration
  60. options are commented.
  61. Also, for more information see the Poky handbook:
  62. http://pokylinux.org/doc/poky-handbook.html
  63. EOM
  64. cp -f $POKYLOCALCONF $BUILDDIR/conf/local.conf
  65. fi
  66. if [ "x" = "x$POKYLAYERCONF" ]; then
  67. POKYLAYERCONF="$OEROOT/meta/conf/bblayers.conf.sample"
  68. fi
  69. if ! (test -r "$BUILDDIR/conf/bblayers.conf"); then
  70. cat <<EOM
  71. You had no conf/bblayers.conf file. Poky has created this configuration file for
  72. you with some default values. To add additional metadata layers into your
  73. configuration please add entries to this file.
  74. For more information see the Poky handbook:
  75. http://pokylinux.org/doc/poky-handbook.html
  76. EOM
  77. # Put the abosolute path to the layers in bblayers.conf so we can run
  78. # bitbake without the init script after the first run
  79. sed "s|##POKYBASE##|$OEROOT|g" $POKYLAYERCONF > $BUILDDIR/conf/bblayers.conf
  80. fi
  81. # Prevent disturbing a new GIT clone in same console
  82. unset POKYLOCALCONF
  83. unset POKYLAYERCONF
  84. export OEROOT BUILDDIR
  85. # Kill off the TERMINFO variable, as glibc will grab its contents in its 'make
  86. # install' if set
  87. unset TERMINFO
  88. # kill this so we don't link non-arm libraries
  89. unset LD_LIBRARY_PATH
  90. # Don't export TARGET_ARCH - it *will* cause build failures
  91. export PATH LD_LIBRARY_PATH OEROOT
  92. # Stop multi byte characters breaking the patcher stuff - This is for Redhat / Fedora people really
  93. export LANG=C
  94. # Kill PYTHONPATH as otherwise the Python specified there will conflict with
  95. # python-native.
  96. unset PYTHONPATH
  97. # Don't allow custom GConf schema paths to get into the system
  98. unset GCONF_SCHEMA_INSTALL_SOURCE
  99. cat <<EOM
  100. ### Shell environment set up for Poky builds. ###
  101. You can now run 'bitbake <target>'
  102. Common targets are:
  103. poky-image-minimal
  104. poky-image-sato
  105. meta-toolchain
  106. meta-toolchain-sdk
  107. You can also run generated qemu images with a command like 'poky-qemu qemux86'
  108. EOM
  109. export BB_ENV_EXTRAWHITE="MACHINE DISTRO POKYMODE POKYLIBC OEROOT 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"