mkconfig 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #!/bin/sh -e
  2. # Script to create header files and links to configure
  3. # U-Boot for a specific board.
  4. #
  5. # Parameters: Target Architecture CPU Board [VENDOR] [SOC]
  6. #
  7. # (C) 2002-2006 DENX Software Engineering, Wolfgang Denk <wd@denx.de>
  8. #
  9. APPEND=no # Default: Create new config file
  10. BOARD_NAME="" # Name to print in make output
  11. TARGETS=""
  12. while [ $# -gt 0 ] ; do
  13. case "$1" in
  14. --) shift ; break ;;
  15. -a) shift ; APPEND=yes ;;
  16. -n) shift ; BOARD_NAME="${1%%_config}" ; shift ;;
  17. -t) shift ; TARGETS="`echo $1 | sed 's:_: :g'` ${TARGETS}" ; shift ;;
  18. *) break ;;
  19. esac
  20. done
  21. [ "${BOARD_NAME}" ] || BOARD_NAME="$1"
  22. [ $# -lt 4 ] && exit 1
  23. [ $# -gt 6 ] && exit 1
  24. if [ "${ARCH}" -a "${ARCH}" != "$2" ]; then
  25. echo "Failed: \$ARCH=${ARCH}, should be '$2' for ${BOARD_NAME}" 1>&2
  26. exit 1
  27. fi
  28. echo "Configuring for ${BOARD_NAME} board..."
  29. #
  30. # Create link to architecture specific headers
  31. #
  32. if [ "$SRCTREE" != "$OBJTREE" ] ; then
  33. mkdir -p ${OBJTREE}/include
  34. mkdir -p ${OBJTREE}/include2
  35. cd ${OBJTREE}/include2
  36. rm -f asm
  37. ln -s ${SRCTREE}/arch/$2/include/asm asm
  38. LNPREFIX=${SRCTREE}/arch/$2/include/asm/
  39. cd ../include
  40. rm -f asm
  41. ln -s ${SRCTREE}/arch/$2/include/asm asm
  42. else
  43. cd ./include
  44. rm -f asm
  45. ln -s ../arch/$2/include/asm asm
  46. fi
  47. rm -f asm/arch
  48. if [ -z "$6" -o "$6" = "NULL" ] ; then
  49. ln -s ${LNPREFIX}arch-$3 asm/arch
  50. else
  51. ln -s ${LNPREFIX}arch-$6 asm/arch
  52. fi
  53. if [ "$2" = "arm" ] ; then
  54. rm -f asm/proc
  55. ln -s ${LNPREFIX}proc-armv asm/proc
  56. fi
  57. #
  58. # Create include file for Make
  59. #
  60. echo "ARCH = $2" > config.mk
  61. echo "CPU = $3" >> config.mk
  62. echo "BOARD = $4" >> config.mk
  63. [ "$5" ] && [ "$5" != "NULL" ] && echo "VENDOR = $5" >> config.mk
  64. [ "$6" ] && [ "$6" != "NULL" ] && echo "SOC = $6" >> config.mk
  65. # Assign board directory to BOARDIR variable
  66. if [ -z "$5" -o "$5" = "NULL" ] ; then
  67. BOARDDIR=$4
  68. else
  69. BOARDDIR=$5/$4
  70. fi
  71. #
  72. # Create board specific header file
  73. #
  74. if [ "$APPEND" = "yes" ] # Append to existing config file
  75. then
  76. echo >> config.h
  77. else
  78. > config.h # Create new config file
  79. fi
  80. echo "/* Automatically generated - do not edit */" >>config.h
  81. for i in ${TARGETS} ; do
  82. echo "#define CONFIG_MK_${i} 1" >>config.h ;
  83. done
  84. cat << EOF >> config.h
  85. #define CONFIG_BOARDDIR board/$BOARDDIR
  86. #include <config_defaults.h>
  87. #include <configs/$1.h>
  88. #include <asm/config.h>
  89. EOF
  90. exit 0