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 | 1d9f410 | 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 | f932863 | 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 | 5078cce | 2006-07-21 11:16:34 +0200 | [diff] [blame] | 12 | BOARD_NAME="" # Name to print in make output |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 13 | |
| 14 | while [ $# -gt 0 ] ; do |
| 15 | case "$1" in |
| 16 | --) shift ; break ;; |
| 17 | -a) shift ; APPEND=yes ;; |
Wolfgang Denk | 5078cce | 2006-07-21 11:16:34 +0200 | [diff] [blame] | 18 | -n) shift ; BOARD_NAME="${1%%_config}" ; shift ;; |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 19 | *) break ;; |
| 20 | esac |
| 21 | done |
| 22 | |
Wolfgang Denk | 5078cce | 2006-07-21 11:16:34 +0200 | [diff] [blame] | 23 | [ "${BOARD_NAME}" ] || BOARD_NAME="$1" |
| 24 | |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 25 | [ $# -lt 4 ] && exit 1 |
wdenk | 1d9f410 | 2004-10-09 22:21:29 +0000 | [diff] [blame] | 26 | [ $# -gt 6 ] && exit 1 |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 27 | |
Wolfgang Denk | 5078cce | 2006-07-21 11:16:34 +0200 | [diff] [blame] | 28 | echo "Configuring for ${BOARD_NAME} board..." |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 29 | |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 30 | # |
| 31 | # Create link to architecture specific headers |
| 32 | # |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 33 | if [ "$SRCTREE" != "$OBJTREE" ] ; then |
| 34 | mkdir -p ${OBJTREE}/include |
| 35 | mkdir -p ${OBJTREE}/include2 |
| 36 | cd ${OBJTREE}/include2 |
| 37 | rm -f asm |
| 38 | ln -s ${SRCTREE}/include/asm-$2 asm |
| 39 | LNPREFIX="../../include2/asm/" |
| 40 | cd ../include |
| 41 | rm -rf asm-$2 |
| 42 | rm -f asm |
| 43 | mkdir asm-$2 |
| 44 | ln -s asm-$2 asm |
| 45 | else |
| 46 | cd ./include |
| 47 | rm -f asm |
| 48 | ln -s asm-$2 asm |
| 49 | fi |
| 50 | |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 51 | rm -f asm-$2/arch |
wdenk | 86c9888 | 2005-04-03 14:26:46 +0000 | [diff] [blame] | 52 | |
Wolfgang Denk | 507d3b0 | 2005-08-03 22:58:55 +0200 | [diff] [blame] | 53 | if [ -z "$6" -o "$6" = "NULL" ] ; then |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 54 | ln -s ${LNPREFIX}arch-$3 asm-$2/arch |
wdenk | 86c9888 | 2005-04-03 14:26:46 +0000 | [diff] [blame] | 55 | else |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 56 | ln -s ${LNPREFIX}arch-$6 asm-$2/arch |
wdenk | 86c9888 | 2005-04-03 14:26:46 +0000 | [diff] [blame] | 57 | fi |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 58 | |
wdenk | b783eda | 2003-06-25 22:26:29 +0000 | [diff] [blame] | 59 | if [ "$2" = "arm" ] ; then |
| 60 | rm -f asm-$2/proc |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 61 | ln -s ${LNPREFIX}proc-armv asm-$2/proc |
wdenk | b783eda | 2003-06-25 22:26:29 +0000 | [diff] [blame] | 62 | fi |
| 63 | |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 64 | # |
| 65 | # Create include file for Make |
| 66 | # |
wdenk | 1d9f410 | 2004-10-09 22:21:29 +0000 | [diff] [blame] | 67 | echo "ARCH = $2" > config.mk |
| 68 | echo "CPU = $3" >> config.mk |
| 69 | echo "BOARD = $4" >> config.mk |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 70 | |
wdenk | 1d9f410 | 2004-10-09 22:21:29 +0000 | [diff] [blame] | 71 | [ "$5" ] && [ "$5" != "NULL" ] && echo "VENDOR = $5" >> config.mk |
| 72 | |
| 73 | [ "$6" ] && [ "$6" != "NULL" ] && echo "SOC = $6" >> config.mk |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 74 | |
| 75 | # |
| 76 | # Create board specific header file |
| 77 | # |
| 78 | if [ "$APPEND" = "yes" ] # Append to existing config file |
| 79 | then |
| 80 | echo >> config.h |
| 81 | else |
| 82 | > config.h # Create new config file |
| 83 | fi |
| 84 | echo "/* Automatically generated - do not edit */" >>config.h |
| 85 | echo "#include <configs/$1.h>" >>config.h |
| 86 | |
| 87 | exit 0 |