mkconfig 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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}/include/asm-$2 asm
  38. LNPREFIX="../../include2/asm/"
  39. cd ../include
  40. rm -rf asm-$2
  41. rm -f asm
  42. mkdir asm-$2
  43. ln -s asm-$2 asm
  44. else
  45. cd ./include
  46. rm -f asm
  47. ln -s asm-$2 asm
  48. fi
  49. rm -f asm-$2/arch
  50. if [ -z "$6" -o "$6" = "NULL" ] ; then
  51. ln -s ${LNPREFIX}arch-$3 asm-$2/arch
  52. else
  53. ln -s ${LNPREFIX}arch-$6 asm-$2/arch
  54. fi
  55. if [ "$2" = "arm" ] ; then
  56. rm -f asm-$2/proc
  57. ln -s ${LNPREFIX}proc-armv asm-$2/proc
  58. fi
  59. #
  60. # Create include file for Make
  61. #
  62. echo "ARCH = $2" > config.mk
  63. echo "CPU = $3" >> config.mk
  64. echo "BOARD = $4" >> config.mk
  65. [ "$5" ] && [ "$5" != "NULL" ] && echo "VENDOR = $5" >> config.mk
  66. [ "$6" ] && [ "$6" != "NULL" ] && echo "SOC = $6" >> config.mk
  67. # Assign board directory to BOARDIR variable
  68. if [ -z "$5" -o "$5" = "NULL" ] ; then
  69. BOARDDIR=$4
  70. else
  71. BOARDDIR=$5/$4
  72. fi
  73. #
  74. # Create board specific header file
  75. #
  76. if [ "$APPEND" = "yes" ] # Append to existing config file
  77. then
  78. echo >> config.h
  79. else
  80. > config.h # Create new config file
  81. fi
  82. echo "/* Automatically generated - do not edit */" >>config.h
  83. for i in ${TARGETS} ; do
  84. echo "#define CONFIG_MK_${i} 1" >>config.h ;
  85. done
  86. cat << EOF >> config.h
  87. #define CONFIG_BOARDDIR board/$BOARDDIR
  88. #include <config_defaults.h>
  89. #include <configs/$1.h>
  90. #include <asm/config.h>
  91. EOF
  92. exit 0