mkconfig 2.1 KB

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