blob: bdc9d91d17198cd3e2d5252a8bdae902ff14bff2 [file] [log] [blame]
wdenk7ebf7442002-11-02 23:17:16 +00001#!/bin/sh -e
2
3# Script to create header files and links to configure
4# U-Boot for a specific board.
5#
wdenkf8e9a232004-10-09 22:21:29 +00006# Parameters: Target Architecture CPU Board [VENDOR] [SOC]
wdenk7ebf7442002-11-02 23:17:16 +00007#
Marian Balakowiczd62379d2006-09-01 19:49:50 +02008# (C) 2002-2006 DENX Software Engineering, Wolfgang Denk <wd@denx.de>
wdenk7ebf7442002-11-02 23:17:16 +00009#
10
11APPEND=no # Default: Create new config file
Wolfgang Denk99753142006-07-21 11:16:34 +020012BOARD_NAME="" # Name to print in make output
Wolfgang Denk61cf0512009-09-15 22:12:31 +020013TARGETS=""
wdenk7ebf7442002-11-02 23:17:16 +000014
15while [ $# -gt 0 ] ; do
16 case "$1" in
17 --) shift ; break ;;
18 -a) shift ; APPEND=yes ;;
Wolfgang Denk99753142006-07-21 11:16:34 +020019 -n) shift ; BOARD_NAME="${1%%_config}" ; shift ;;
Wolfgang Denk61cf0512009-09-15 22:12:31 +020020 -t) shift ; TARGETS="`echo $1 | sed 's:_: :g'` ${TARGETS}" ; shift ;;
wdenk7ebf7442002-11-02 23:17:16 +000021 *) break ;;
22 esac
23done
24
Wolfgang Denk99753142006-07-21 11:16:34 +020025[ "${BOARD_NAME}" ] || BOARD_NAME="$1"
26
wdenk7ebf7442002-11-02 23:17:16 +000027[ $# -lt 4 ] && exit 1
wdenkf8e9a232004-10-09 22:21:29 +000028[ $# -gt 6 ] && exit 1
wdenk7ebf7442002-11-02 23:17:16 +000029
Wolfgang Denk99753142006-07-21 11:16:34 +020030echo "Configuring for ${BOARD_NAME} board..."
wdenk7ebf7442002-11-02 23:17:16 +000031
wdenk7ebf7442002-11-02 23:17:16 +000032#
33# Create link to architecture specific headers
34#
Marian Balakowiczd62379d2006-09-01 19:49:50 +020035if [ "$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
47else
48 cd ./include
49 rm -f asm
50 ln -s asm-$2 asm
51fi
52
wdenk7ebf7442002-11-02 23:17:16 +000053rm -f asm-$2/arch
wdenkf9c57a22005-04-03 14:26:46 +000054
Wolfgang Denk31c939b2005-08-03 22:58:55 +020055if [ -z "$6" -o "$6" = "NULL" ] ; then
Marian Balakowiczd62379d2006-09-01 19:49:50 +020056 ln -s ${LNPREFIX}arch-$3 asm-$2/arch
wdenkf9c57a22005-04-03 14:26:46 +000057else
Marian Balakowiczd62379d2006-09-01 19:49:50 +020058 ln -s ${LNPREFIX}arch-$6 asm-$2/arch
wdenkf9c57a22005-04-03 14:26:46 +000059fi
wdenk7ebf7442002-11-02 23:17:16 +000060
wdenkbb2d9272003-06-25 22:26:29 +000061if [ "$2" = "arm" ] ; then
62 rm -f asm-$2/proc
Marian Balakowiczd62379d2006-09-01 19:49:50 +020063 ln -s ${LNPREFIX}proc-armv asm-$2/proc
wdenkbb2d9272003-06-25 22:26:29 +000064fi
65
wdenk7ebf7442002-11-02 23:17:16 +000066#
67# Create include file for Make
68#
wdenkf8e9a232004-10-09 22:21:29 +000069echo "ARCH = $2" > config.mk
70echo "CPU = $3" >> config.mk
71echo "BOARD = $4" >> config.mk
72
73[ "$5" ] && [ "$5" != "NULL" ] && echo "VENDOR = $5" >> config.mk
wdenk7ebf7442002-11-02 23:17:16 +000074
wdenkf8e9a232004-10-09 22:21:29 +000075[ "$6" ] && [ "$6" != "NULL" ] && echo "SOC = $6" >> config.mk
wdenk7ebf7442002-11-02 23:17:16 +000076
Stefan Roese995611e2009-10-27 11:46:23 +010077# Assign board directory to BOARDIR variable
78if [ -z "$5" -o "$5" = "NULL" ] ; then
79 BOARDDIR=$4
80else
81 BOARDDIR=$5/$4
82fi
83
wdenk7ebf7442002-11-02 23:17:16 +000084#
85# Create board specific header file
86#
87if [ "$APPEND" = "yes" ] # Append to existing config file
88then
89 echo >> config.h
90else
91 > config.h # Create new config file
92fi
93echo "/* Automatically generated - do not edit */" >>config.h
Wolfgang Denk61cf0512009-09-15 22:12:31 +020094
95for i in ${TARGETS} ; do
96 echo "#define CONFIG_MK_${i} 1" >>config.h ;
97done
98
Stefan Roese995611e2009-10-27 11:46:23 +010099echo "#define CONFIG_BOARDDIR board/$BOARDDIR" >>config.h
100
wdenk7ebf7442002-11-02 23:17:16 +0000101echo "#include <configs/$1.h>" >>config.h
Kim Phillipsabd766c2009-02-18 16:14:29 -0600102echo "#include <asm/config.h>" >>config.h
wdenk7ebf7442002-11-02 23:17:16 +0000103
104exit 0