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 | a97b6ab | 2010-05-27 23:18: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 | a97b6ab | 2010-05-27 23:18:34 +0200 | [diff] [blame] | 25 | [ "${BOARD_NAME}" ] || BOARD_NAME="${1%_config}" |
Wolfgang Denk | 9975314 | 2006-07-21 11:16:34 +0200 | [diff] [blame] | 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 | |
Nishanth Menon | e83cc36 | 2009-11-02 09:40:18 -0600 | [diff] [blame] | 30 | if [ "${ARCH}" -a "${ARCH}" != "$2" ]; then |
| 31 | echo "Failed: \$ARCH=${ARCH}, should be '$2' for ${BOARD_NAME}" 1>&2 |
| 32 | exit 1 |
| 33 | fi |
| 34 | |
Wolfgang Denk | 9975314 | 2006-07-21 11:16:34 +0200 | [diff] [blame] | 35 | echo "Configuring for ${BOARD_NAME} board..." |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 36 | |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 37 | # |
| 38 | # Create link to architecture specific headers |
| 39 | # |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 40 | if [ "$SRCTREE" != "$OBJTREE" ] ; then |
| 41 | mkdir -p ${OBJTREE}/include |
| 42 | mkdir -p ${OBJTREE}/include2 |
| 43 | cd ${OBJTREE}/include2 |
| 44 | rm -f asm |
Peter Tyser | 3cba3c1 | 2010-04-12 22:28:08 -0500 | [diff] [blame] | 45 | ln -s ${SRCTREE}/arch/$2/include/asm asm |
| 46 | LNPREFIX=${SRCTREE}/arch/$2/include/asm/ |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 47 | cd ../include |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 48 | rm -f asm |
Peter Tyser | 3cba3c1 | 2010-04-12 22:28:08 -0500 | [diff] [blame] | 49 | ln -s ${SRCTREE}/arch/$2/include/asm asm |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 50 | else |
| 51 | cd ./include |
| 52 | rm -f asm |
Peter Tyser | 3cba3c1 | 2010-04-12 22:28:08 -0500 | [diff] [blame] | 53 | ln -s ../arch/$2/include/asm asm |
Marian Balakowicz | d62379d | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 54 | fi |
| 55 | |
Peter Tyser | 3cba3c1 | 2010-04-12 22:28:08 -0500 | [diff] [blame] | 56 | rm -f asm/arch |
wdenk | f9c57a2 | 2005-04-03 14:26:46 +0000 | [diff] [blame] | 57 | |
Wolfgang Denk | 31c939b | 2005-08-03 22:58:55 +0200 | [diff] [blame] | 58 | if [ -z "$6" -o "$6" = "NULL" ] ; then |
Peter Tyser | 3cba3c1 | 2010-04-12 22:28:08 -0500 | [diff] [blame] | 59 | ln -s ${LNPREFIX}arch-$3 asm/arch |
wdenk | f9c57a2 | 2005-04-03 14:26:46 +0000 | [diff] [blame] | 60 | else |
Peter Tyser | 3cba3c1 | 2010-04-12 22:28:08 -0500 | [diff] [blame] | 61 | ln -s ${LNPREFIX}arch-$6 asm/arch |
wdenk | f9c57a2 | 2005-04-03 14:26:46 +0000 | [diff] [blame] | 62 | fi |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 63 | |
wdenk | bb2d927 | 2003-06-25 22:26:29 +0000 | [diff] [blame] | 64 | if [ "$2" = "arm" ] ; then |
Peter Tyser | 3cba3c1 | 2010-04-12 22:28:08 -0500 | [diff] [blame] | 65 | rm -f asm/proc |
| 66 | ln -s ${LNPREFIX}proc-armv asm/proc |
wdenk | bb2d927 | 2003-06-25 22:26:29 +0000 | [diff] [blame] | 67 | fi |
| 68 | |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 69 | # |
| 70 | # Create include file for Make |
| 71 | # |
wdenk | f8e9a23 | 2004-10-09 22:21:29 +0000 | [diff] [blame] | 72 | echo "ARCH = $2" > config.mk |
| 73 | echo "CPU = $3" >> config.mk |
| 74 | echo "BOARD = $4" >> config.mk |
| 75 | |
| 76 | [ "$5" ] && [ "$5" != "NULL" ] && echo "VENDOR = $5" >> config.mk |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 77 | |
wdenk | f8e9a23 | 2004-10-09 22:21:29 +0000 | [diff] [blame] | 78 | [ "$6" ] && [ "$6" != "NULL" ] && echo "SOC = $6" >> config.mk |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 79 | |
Stefan Roese | 995611e | 2009-10-27 11:46:23 +0100 | [diff] [blame] | 80 | # Assign board directory to BOARDIR variable |
| 81 | if [ -z "$5" -o "$5" = "NULL" ] ; then |
| 82 | BOARDDIR=$4 |
| 83 | else |
| 84 | BOARDDIR=$5/$4 |
| 85 | fi |
| 86 | |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 87 | # |
| 88 | # Create board specific header file |
| 89 | # |
| 90 | if [ "$APPEND" = "yes" ] # Append to existing config file |
| 91 | then |
| 92 | echo >> config.h |
| 93 | else |
| 94 | > config.h # Create new config file |
| 95 | fi |
| 96 | echo "/* Automatically generated - do not edit */" >>config.h |
Wolfgang Denk | 61cf051 | 2009-09-15 22:12:31 +0200 | [diff] [blame] | 97 | |
| 98 | for i in ${TARGETS} ; do |
| 99 | echo "#define CONFIG_MK_${i} 1" >>config.h ; |
| 100 | done |
| 101 | |
Mike Frysinger | d595458 | 2009-12-02 21:15:03 -0500 | [diff] [blame] | 102 | cat << EOF >> config.h |
| 103 | #define CONFIG_BOARDDIR board/$BOARDDIR |
| 104 | #include <config_defaults.h> |
Wolfgang Denk | a97b6ab | 2010-05-27 23:18:34 +0200 | [diff] [blame] | 105 | #include <configs/${BOARDNAME}.h> |
Mike Frysinger | d595458 | 2009-12-02 21:15:03 -0500 | [diff] [blame] | 106 | #include <asm/config.h> |
| 107 | EOF |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 108 | |
| 109 | exit 0 |