wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 1 | #!/bin/sh -e |
| 2 | |
| 3 | # Script to create header files and links to configure |
| 4 | # U-Boot for a specific board. |
| 5 | # |
wdenk | f8e9a23 | 2004-10-09 22:21:29 +0000 | [diff] [blame] | 6 | # Parameters: Target Architecture CPU Board [VENDOR] [SOC] |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 7 | # |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 8 | # (C) 2002-2006 DENX Software Engineering, Wolfgang Denk <wd@denx.de> |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 9 | # |
| 10 | |
| 11 | APPEND=no # Default: Create new config file |
Wolfgang Denk | 9975314 | 2006-07-21 11:16:34 +0200 | [diff] [blame] | 12 | BOARD_NAME="" # Name to print in make output |
Wolfgang Denk | 61cf051 | 2009-09-15 22:12:31 +0200 | [diff] [blame] | 13 | TARGETS="" |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 14 | |
| 15 | while [ $# -gt 0 ] ; do |
| 16 | case "$1" in |
| 17 | --) shift ; break ;; |
| 18 | -a) shift ; APPEND=yes ;; |
Wolfgang Denk | 9975314 | 2006-07-21 11:16:34 +0200 | [diff] [blame] | 19 | -n) shift ; BOARD_NAME="${1%%_config}" ; shift ;; |
Wolfgang Denk | 61cf051 | 2009-09-15 22:12:31 +0200 | [diff] [blame] | 20 | -t) shift ; TARGETS="`echo $1 | sed 's:_: :g'` ${TARGETS}" ; shift ;; |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 21 | *) break ;; |
| 22 | esac |
| 23 | done |
| 24 | |
Wolfgang Denk | 9975314 | 2006-07-21 11:16:34 +0200 | [diff] [blame] | 25 | [ "${BOARD_NAME}" ] || BOARD_NAME="$1" |
| 26 | |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 27 | [ $# -lt 4 ] && exit 1 |
wdenk | f8e9a23 | 2004-10-09 22:21:29 +0000 | [diff] [blame] | 28 | [ $# -gt 6 ] && exit 1 |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 29 | |
Wolfgang Denk | 9975314 | 2006-07-21 11:16:34 +0200 | [diff] [blame] | 30 | echo "Configuring for ${BOARD_NAME} board..." |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 31 | |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 32 | # |
| 33 | # Create link to architecture specific headers |
| 34 | # |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 35 | if [ "$SRCTREE" != "$OBJTREE" ] ; then |
| 36 | mkdir -p ${OBJTREE}/include |
| 37 | mkdir -p ${OBJTREE}/include2 |
| 38 | cd ${OBJTREE}/include2 |
| 39 | rm -f asm |
| 40 | ln -s ${SRCTREE}/include/asm-$2 asm |
| 41 | LNPREFIX="../../include2/asm/" |
| 42 | cd ../include |
| 43 | rm -rf asm-$2 |
| 44 | rm -f asm |
| 45 | mkdir asm-$2 |
| 46 | ln -s asm-$2 asm |
| 47 | else |
| 48 | cd ./include |
| 49 | rm -f asm |
| 50 | ln -s asm-$2 asm |
| 51 | fi |
| 52 | |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 53 | rm -f asm-$2/arch |
wdenk | f9c57a2 | 2005-04-03 14:26:46 +0000 | [diff] [blame] | 54 | |
Wolfgang Denk | 31c939b | 2005-08-03 22:58:55 +0200 | [diff] [blame] | 55 | if [ -z "$6" -o "$6" = "NULL" ] ; then |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 56 | ln -s ${LNPREFIX}arch-$3 asm-$2/arch |
wdenk | f9c57a2 | 2005-04-03 14:26:46 +0000 | [diff] [blame] | 57 | else |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 58 | ln -s ${LNPREFIX}arch-$6 asm-$2/arch |
wdenk | f9c57a2 | 2005-04-03 14:26:46 +0000 | [diff] [blame] | 59 | fi |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 60 | |
wdenk | bb2d927 | 2003-06-25 22:26:29 +0000 | [diff] [blame] | 61 | if [ "$2" = "arm" ] ; then |
| 62 | rm -f asm-$2/proc |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 63 | ln -s ${LNPREFIX}proc-armv asm-$2/proc |
wdenk | bb2d927 | 2003-06-25 22:26:29 +0000 | [diff] [blame] | 64 | fi |
| 65 | |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 66 | # |
| 67 | # Create include file for Make |
| 68 | # |
wdenk | f8e9a23 | 2004-10-09 22:21:29 +0000 | [diff] [blame] | 69 | echo "ARCH = $2" > config.mk |
| 70 | echo "CPU = $3" >> config.mk |
| 71 | echo "BOARD = $4" >> config.mk |
| 72 | |
| 73 | [ "$5" ] && [ "$5" != "NULL" ] && echo "VENDOR = $5" >> config.mk |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 74 | |
wdenk | f8e9a23 | 2004-10-09 22:21:29 +0000 | [diff] [blame] | 75 | [ "$6" ] && [ "$6" != "NULL" ] && echo "SOC = $6" >> config.mk |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 76 | |
Stefan Roese | 995611e | 2009-10-27 11:46:23 +0100 | [diff] [blame] | 77 | # Assign board directory to BOARDIR variable |
| 78 | if [ -z "$5" -o "$5" = "NULL" ] ; then |
| 79 | BOARDDIR=$4 |
| 80 | else |
| 81 | BOARDDIR=$5/$4 |
| 82 | fi |
| 83 | |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 84 | # |
| 85 | # Create board specific header file |
| 86 | # |
| 87 | if [ "$APPEND" = "yes" ] # Append to existing config file |
| 88 | then |
| 89 | echo >> config.h |
| 90 | else |
| 91 | > config.h # Create new config file |
| 92 | fi |
| 93 | echo "/* Automatically generated - do not edit */" >>config.h |
Wolfgang Denk | 61cf051 | 2009-09-15 22:12:31 +0200 | [diff] [blame] | 94 | |
| 95 | for i in ${TARGETS} ; do |
| 96 | echo "#define CONFIG_MK_${i} 1" >>config.h ; |
| 97 | done |
| 98 | |
Stefan Roese | 995611e | 2009-10-27 11:46:23 +0100 | [diff] [blame] | 99 | echo "#define CONFIG_BOARDDIR board/$BOARDDIR" >>config.h |
| 100 | |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 101 | echo "#include <configs/$1.h>" >>config.h |
Kim Phillips | abd766c | 2009-02-18 16:14:29 -0600 | [diff] [blame] | 102 | echo "#include <asm/config.h>" >>config.h |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 103 | |
| 104 | exit 0 |