poky-setup-builddir 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. 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. #
  34. # $POKYCONF can point to a directory for the template local.conf & bblayers.conf
  35. #
  36. if [ "x" != "x$POKYCONF" ]; then
  37. if ! (test -d "$POKYCONF"); then
  38. # Allow POKYCONF=meta-xyz/conf as a shortcut
  39. if [ -d "$OEROOT/$POKYCONF" ]; then
  40. POKYCONF="$OEROOT/$POKYCONF"
  41. fi
  42. if ! (test -d "$POKYCONF"); then
  43. echo >&2 "Error: '$POKYCONF' must be a directory containing local.conf & bblayers.conf"
  44. return
  45. fi
  46. fi
  47. POKYLAYERCONF="$POKYCONF/bblayers.conf"
  48. POKYLOCALCONF="$POKYCONF/local.conf"
  49. fi
  50. if [ "x" = "x$POKYLOCALCONF" ]; then
  51. POKYLOCALCONF="$OEROOT/meta/conf/local.conf.sample"
  52. fi
  53. if ! (test -r "$BUILDDIR/conf/local.conf"); then
  54. cat <<EOM
  55. You had no conf/local.conf file. Poky has created this configuration file for
  56. you with some default values. You may wish to edit it to use a different MACHINE
  57. (target hardware) or enable parallel build options to take advantage of multiple
  58. cores for example. See the file for more information as common configuration
  59. options are commented.
  60. Also, for more information see the Poky Reference Manual:
  61. http://yoctoproject.org/community/documentation
  62. EOM
  63. cp -f $POKYLOCALCONF $BUILDDIR/conf/local.conf
  64. fi
  65. if [ "x" = "x$POKYLAYERCONF" ]; then
  66. POKYLAYERCONF="$OEROOT/meta/conf/bblayers.conf.sample"
  67. fi
  68. if ! (test -r "$BUILDDIR/conf/bblayers.conf"); then
  69. cat <<EOM
  70. You had no conf/bblayers.conf file. Poky has created this configuration file for
  71. you with some default values. To add additional metadata layers into your
  72. configuration please add entries to this file.
  73. For more information see the Poky Reference Manual:
  74. http://yoctoproject.org/community/documentation
  75. EOM
  76. # Put the abosolute path to the layers in bblayers.conf so we can run
  77. # bitbake without the init script after the first run
  78. sed "s|##POKYBASE##|$OEROOT|g" $POKYLAYERCONF > $BUILDDIR/conf/bblayers.conf
  79. fi
  80. # Prevent disturbing a new GIT clone in same console
  81. unset POKYLOCALCONF
  82. unset POKYLAYERCONF
  83. cat <<EOM
  84. ### Shell environment set up for Poky builds. ###
  85. You can now run 'bitbake <target>'
  86. Common targets are:
  87. poky-image-minimal
  88. poky-image-sato
  89. meta-toolchain
  90. meta-toolchain-sdk
  91. You can also run generated qemu images with a command like 'poky-qemu qemux86'
  92. EOM