envsetup.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/sh
  2. function gettop
  3. {
  4. local TOPFILE=openembedded-core/envsetup.sh
  5. if [ -n "$MPSOC_TOP" -a -f "$MPSOC_TOP/$TOPFILE" ] ; then
  6. # The following circumlocution ensures we remove symlinks from TOP.
  7. (\cd $MPSOC_TOP; PWD= /bin/pwd)
  8. else
  9. if [ -f $TOPFILE ] ; then
  10. # The following circumlocution (repeated below as well) ensures
  11. # that we record the true directory name and not one that is
  12. # faked up with symlink names.
  13. PWD= /bin/pwd
  14. else
  15. local here="${PWD}"
  16. while [ "${here}" != "/" ]; do
  17. if [ -f "${here}/${TOPFILE}" ]; then
  18. (\cd ${here}; PWD= /bin/pwd)
  19. break
  20. fi
  21. here="$(dirname ${here})"
  22. done
  23. fi
  24. fi
  25. }
  26. pack_usage()
  27. {
  28. printf "Usage: pack [-cARCH] [-iIMAGE] [-h]
  29. -a ARCH (default: riscv)
  30. -h print this help message
  31. "
  32. }
  33. T=$(gettop)
  34. ARCH=riscv
  35. IMAGE_DIR=thead-build/ice-base
  36. while getopts "a:o:h" arg
  37. do
  38. case $arg in
  39. a)
  40. ARCH=${OPTARG}
  41. ;;
  42. o)
  43. IMAGE_DIR=${OPTARG}
  44. ;;
  45. h)
  46. pack_usage
  47. exit 0
  48. ;;
  49. *)
  50. #exit 0
  51. ;;
  52. esac
  53. done
  54. if [ "x$ARCH" = "x" ]; then
  55. echo "ARCH:$ARCH not support"
  56. exit 1
  57. fi
  58. #$T/scripts/pack_img.sh -c $chip -p $platform -b $board \
  59. echo "$T/openembedded-core/oe-init-build-env $IMAGE_DIR"
  60. [ -e ./openembedded-core/oe-init-build-env ] &&
  61. source ./openembedded-core/oe-init-build-env $IMAGE_DIR