mkconfig 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. while [ $# -gt 0 ] ; do
  12. case "$1" in
  13. --) shift ; break ;;
  14. -a) shift ; APPEND=yes ;;
  15. -n) shift ; BOARD_NAME="${1%%_config}" ; shift ;;
  16. *) break ;;
  17. esac
  18. done
  19. [ "${BOARD_NAME}" ] || BOARD_NAME="$1"
  20. [ $# -lt 4 ] && exit 1
  21. [ $# -gt 6 ] && exit 1
  22. echo "Configuring for ${BOARD_NAME} board..."
  23. #
  24. # Create link to architecture specific headers
  25. #
  26. if [ "$SRCTREE" != "$OBJTREE" ] ; then
  27. mkdir -p ${OBJTREE}/include
  28. mkdir -p ${OBJTREE}/include2
  29. cd ${OBJTREE}/include2
  30. rm -f asm
  31. ln -s ${SRCTREE}/include/asm-$2 asm
  32. LNPREFIX="../../include2/asm/"
  33. cd ../include
  34. rm -rf asm-$2
  35. rm -f asm
  36. mkdir asm-$2
  37. ln -s asm-$2 asm
  38. else
  39. cd ./include
  40. rm -f asm
  41. ln -s asm-$2 asm
  42. fi
  43. rm -f asm-$2/arch
  44. if [ -z "$6" -o "$6" = "NULL" ] ; then
  45. ln -s ${LNPREFIX}arch-$3 asm-$2/arch
  46. else
  47. ln -s ${LNPREFIX}arch-$6 asm-$2/arch
  48. fi
  49. if [ "$2" = "arm" ] ; then
  50. rm -f asm-$2/proc
  51. ln -s ${LNPREFIX}proc-armv asm-$2/proc
  52. fi
  53. #
  54. # Create include file for Make
  55. #
  56. echo "ARCH = $2" > config.mk
  57. echo "CPU = $3" >> config.mk
  58. echo "BOARD = $4" >> config.mk
  59. [ "$5" ] && [ "$5" != "NULL" ] && echo "VENDOR = $5" >> config.mk
  60. [ "$6" ] && [ "$6" != "NULL" ] && echo "SOC = $6" >> config.mk
  61. #
  62. # Create board specific header file
  63. #
  64. if [ "$APPEND" = "yes" ] # Append to existing config file
  65. then
  66. echo >> config.h
  67. else
  68. > config.h # Create new config file
  69. fi
  70. echo "/* Automatically generated - do not edit */" >>config.h
  71. echo "#include <configs/$1.h>" >>config.h
  72. echo "#include <asm/config.h>" >>config.h
  73. exit 0