mkconfig 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. #
  64. # Create board specific header file
  65. #
  66. if [ "$APPEND" = "yes" ] # Append to existing config file
  67. then
  68. echo >> config.h
  69. else
  70. > config.h # Create new config file
  71. fi
  72. echo "/* Automatically generated - do not edit */" >>config.h
  73. for i in ${TARGETS} ; do
  74. echo "#define CONFIG_MK_${i} 1" >>config.h ;
  75. done
  76. echo "#include <configs/$1.h>" >>config.h
  77. echo "#include <asm/config.h>" >>config.h
  78. exit 0