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 |
Wolfgang Denk | 804d83a | 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 | 5078cce | 2006-07-21 11:16:34 +0200 | [diff] [blame] | 19 | -n) shift ; BOARD_NAME="${1%%_config}" ; shift ;; |
Wolfgang Denk | 804d83a | 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 | 5078cce | 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 | 1d9f410 | 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 | a8fa379 | 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 | 5078cce | 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 | f932863 | 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 |
| 45 | ln -s ${SRCTREE}/include/asm-$2 asm |
| 46 | LNPREFIX="../../include2/asm/" |
| 47 | cd ../include |
| 48 | rm -rf asm-$2 |
| 49 | rm -f asm |
| 50 | mkdir asm-$2 |
| 51 | ln -s asm-$2 asm |
| 52 | else |
| 53 | cd ./include |
| 54 | rm -f asm |
| 55 | ln -s asm-$2 asm |
| 56 | fi |
| 57 | |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 58 | rm -f asm-$2/arch |
wdenk | 86c9888 | 2005-04-03 14:26:46 +0000 | [diff] [blame] | 59 | |
Wolfgang Denk | 507d3b0 | 2005-08-03 22:58:55 +0200 | [diff] [blame] | 60 | if [ -z "$6" -o "$6" = "NULL" ] ; then |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 61 | ln -s ${LNPREFIX}arch-$3 asm-$2/arch |
wdenk | 86c9888 | 2005-04-03 14:26:46 +0000 | [diff] [blame] | 62 | else |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 63 | ln -s ${LNPREFIX}arch-$6 asm-$2/arch |
wdenk | 86c9888 | 2005-04-03 14:26:46 +0000 | [diff] [blame] | 64 | fi |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 65 | |
wdenk | b783eda | 2003-06-25 22:26:29 +0000 | [diff] [blame] | 66 | if [ "$2" = "arm" ] ; then |
| 67 | rm -f asm-$2/proc |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 68 | ln -s ${LNPREFIX}proc-armv asm-$2/proc |
wdenk | b783eda | 2003-06-25 22:26:29 +0000 | [diff] [blame] | 69 | fi |
| 70 | |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 71 | # |
| 72 | # Create include file for Make |
| 73 | # |
wdenk | 1d9f410 | 2004-10-09 22:21:29 +0000 | [diff] [blame] | 74 | echo "ARCH = $2" > config.mk |
| 75 | echo "CPU = $3" >> config.mk |
| 76 | echo "BOARD = $4" >> config.mk |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 77 | |
wdenk | 1d9f410 | 2004-10-09 22:21:29 +0000 | [diff] [blame] | 78 | [ "$5" ] && [ "$5" != "NULL" ] && echo "VENDOR = $5" >> config.mk |
| 79 | |
| 80 | [ "$6" ] && [ "$6" != "NULL" ] && echo "SOC = $6" >> config.mk |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 81 | |
Stefan Roese | 7ec1fed | 2009-10-27 11:46:23 +0100 | [diff] [blame] | 82 | # Assign board directory to BOARDIR variable |
| 83 | if [ -z "$5" -o "$5" = "NULL" ] ; then |
| 84 | BOARDDIR=$4 |
| 85 | else |
| 86 | BOARDDIR=$5/$4 |
| 87 | fi |
| 88 | |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 89 | # |
| 90 | # Create board specific header file |
| 91 | # |
| 92 | if [ "$APPEND" = "yes" ] # Append to existing config file |
| 93 | then |
| 94 | echo >> config.h |
| 95 | else |
| 96 | > config.h # Create new config file |
| 97 | fi |
| 98 | echo "/* Automatically generated - do not edit */" >>config.h |
Wolfgang Denk | 804d83a | 2009-09-15 22:12:31 +0200 | [diff] [blame] | 99 | |
| 100 | for i in ${TARGETS} ; do |
| 101 | echo "#define CONFIG_MK_${i} 1" >>config.h ; |
| 102 | done |
| 103 | |
Mike Frysinger | 10c32ff | 2009-12-02 21:15:03 -0500 | [diff] [blame^] | 104 | cat << EOF >> config.h |
| 105 | #define CONFIG_BOARDDIR board/$BOARDDIR |
| 106 | #include <config_defaults.h> |
| 107 | #include <configs/$1.h> |
| 108 | #include <asm/config.h> |
| 109 | EOF |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 110 | |
| 111 | exit 0 |