3 # Script to create header files and links to configure
4 # U-Boot for a specific board.
6 # Parameters: Target Architecture CPU Board [VENDOR] [SOC]
8 # (C) 2002-2006 DENX Software Engineering, Wolfgang Denk <wd@denx.de>
11 APPEND=no # Default: Create new config file
12 BOARD_NAME="" # Name to print in make output
21 if [ \( $# -eq 2 \) -a \( "$1" = "-A" \) ] ; then
23 line=`egrep -i "^[[:space:]]*${2}[[:space:]]" boards.cfg` || {
24 echo "make: *** No rule to make target \`$2_config'. Stop." >&2
29 # add default board name if needed
30 [ $# = 3 ] && set ${line} ${1}
33 while [ $# -gt 0 ] ; do
36 -a) shift ; APPEND=yes ;;
37 -n) shift ; BOARD_NAME="${1%_config}" ; shift ;;
38 -t) shift ; TARGETS="`echo $1 | sed 's:_: :g'` ${TARGETS}" ; shift ;;
43 [ $# -lt 4 ] && exit 1
44 [ $# -gt 6 ] && exit 1
46 CONFIG_NAME="${1%_config}"
48 [ "${BOARD_NAME}" ] || BOARD_NAME="${CONFIG_NAME}"
52 if [ "$4" = "-" ] ; then
57 [ $# -gt 4 ] && [ "$5" != "-" ] && vendor="$5"
58 [ $# -gt 5 ] && [ "$6" != "-" ] && soc="$6"
60 if [ "${ARCH}" -a "${ARCH}" != "${arch}" ]; then
61 echo "Failed: \$ARCH=${ARCH}, should be '${arch}' for ${BOARD_NAME}" 1>&2
65 echo "Configuring for ${BOARD_NAME} board..."
68 # Create link to architecture specific headers
70 if [ "$SRCTREE" != "$OBJTREE" ] ; then
71 mkdir -p ${OBJTREE}/include
72 mkdir -p ${OBJTREE}/include2
73 cd ${OBJTREE}/include2
75 ln -s ${SRCTREE}/arch/${arch}/include/asm asm
76 LNPREFIX=${SRCTREE}/arch/${arch}/include/asm/
79 ln -s ${SRCTREE}/arch/${arch}/include/asm asm
83 ln -s ../arch/${arch}/include/asm asm
88 if [ -z "${soc}" ] ; then
89 ln -s ${LNPREFIX}arch-${cpu} asm/arch
91 ln -s ${LNPREFIX}arch-${soc} asm/arch
94 if [ "${arch}" = "arm" ] ; then
96 ln -s ${LNPREFIX}proc-armv asm/proc
100 # Create include file for Make
102 echo "ARCH = ${arch}" > config.mk
103 echo "CPU = ${cpu}" >> config.mk
104 echo "BOARD = ${board}" >> config.mk
106 [ "${vendor}" ] && echo "VENDOR = ${vendor}" >> config.mk
108 [ "${soc}" ] && echo "SOC = ${soc}" >> config.mk
110 # Assign board directory to BOARDIR variable
111 if [ -z "${vendor}" ] ; then
114 BOARDDIR=${vendor}/${board}
118 # Create board specific header file
120 if [ "$APPEND" = "yes" ] # Append to existing config file
124 > config.h # Create new config file
126 echo "/* Automatically generated - do not edit */" >>config.h
128 for i in ${TARGETS} ; do
129 echo "#define CONFIG_MK_${i} 1" >>config.h ;
132 cat << EOF >> config.h
133 #define CONFIG_BOARDDIR board/$BOARDDIR
134 #include <config_defaults.h>
135 #include <configs/${CONFIG_NAME}.h>
136 #include <asm/config.h>