]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/glsdk-u-boot.git/blob - mkconfig
mkconfig: split the board make target to multiple config targets
[glsdk/glsdk-u-boot.git] / mkconfig
1 #!/bin/sh -e
3 # Script to create header files and links to configure
4 # U-Boot for a specific board.
5 #
6 # Parameters:  Target  Architecture  CPU  Board [VENDOR] [SOC]
7 #
8 # (C) 2002-2006 DENX Software Engineering, Wolfgang Denk <wd@denx.de>
9 #
11 APPEND=no       # Default: Create new config file
12 BOARD_NAME=""   # Name to print in make output
13 TARGETS=""
15 while [ $# -gt 0 ] ; do
16         case "$1" in
17         --) shift ; break ;;
18         -a) shift ; APPEND=yes ;;
19         -n) shift ; BOARD_NAME="${1%%_config}" ; shift ;;
20         -t) shift ; TARGETS="`echo $1 | sed 's:_: :g'` ${TARGETS}" ; shift ;;
21         *)  break ;;
22         esac
23 done
25 [ "${BOARD_NAME}" ] || BOARD_NAME="$1"
27 [ $# -lt 4 ] && exit 1
28 [ $# -gt 6 ] && exit 1
30 echo "Configuring for ${BOARD_NAME} board..."
32 #
33 # Create link to architecture specific headers
34 #
35 if [ "$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
47 else
48         cd ./include
49         rm -f asm
50         ln -s asm-$2 asm
51 fi
53 rm -f asm-$2/arch
55 if [ -z "$6" -o "$6" = "NULL" ] ; then
56         ln -s ${LNPREFIX}arch-$3 asm-$2/arch
57 else
58         ln -s ${LNPREFIX}arch-$6 asm-$2/arch
59 fi
61 if [ "$2" = "arm" ] ; then
62         rm -f asm-$2/proc
63         ln -s ${LNPREFIX}proc-armv asm-$2/proc
64 fi
66 #
67 # Create include file for Make
68 #
69 echo "ARCH   = $2" >  config.mk
70 echo "CPU    = $3" >> config.mk
71 echo "BOARD  = $4" >> config.mk
73 [ "$5" ] && [ "$5" != "NULL" ] && echo "VENDOR = $5" >> config.mk
75 [ "$6" ] && [ "$6" != "NULL" ] && echo "SOC    = $6" >> config.mk
77 #
78 # Create board specific header file
79 #
80 if [ "$APPEND" = "yes" ]        # Append to existing config file
81 then
82         echo >> config.h
83 else
84         > config.h              # Create new config file
85 fi
86 echo "/* Automatically generated - do not edit */" >>config.h
88 for i in ${TARGETS} ; do
89         echo "#define CONFIG_MK_${i} 1" >>config.h ;
90 done
92 echo "#include <configs/$1.h>" >>config.h
93 echo "#include <asm/config.h>" >>config.h
95 exit 0