54c526801c3a0a32be46fc178cd0fe4efa4ceb38
[pandora-x-loader.git] / mkconfig
1 #!/bin/sh -e
2
3 # Script to create header files and links to configure
4 # X-Loader for a specific board.
5 #
6 # Parameters:  Target  Architecture  CPU  Board
7 #
8 # (C) 2004 Texas Instruments
9 # (C) 2002 DENX Software Engineering, Wolfgang Denk <wd@denx.de>
10 #
11
12 APPEND=no       # Default: Create new config file
13
14 while [ $# -gt 0 ] ; do
15         case "$1" in
16         --) shift ; break ;;
17         -a) shift ; APPEND=yes ;;
18         *)  break ;;
19         esac
20 done
21
22 [ $# -lt 4 ] && exit 1
23 [ $# -gt 5 ] && exit 1
24
25 echo "Configuring for $1 board..."
26
27 #
28 # Create link to architecture specific headers
29 #
30 if [ "$SRCTREE" != "$OBJTREE" ] ; then
31         mkdir -p ${OBJTREE}/include
32         cd ${OBJTREE}/include
33         mkdir -p asm
34         rm -f asm/arch
35         ln -s ${SRCTREE}/include/asm/arch-$3 asm/arch
36 else
37         cd ./include
38         rm -f asm/arch
39         ln -s arch-$3 asm/arch
40 fi
41
42 #
43 # Create include file for Make
44 #
45 echo "ARCH  = $2" >  config.mk
46 echo "CPU   = $3" >> config.mk
47 echo "BOARD = $4" >> config.mk
48
49 [ "$5" ] && echo "VENDOR = $5" >> config.mk
50
51 #
52 # Create board specific header file
53 #
54 if [ "$APPEND" = "yes" ]        # Append to existing config file
55 then
56         echo >> config.h
57 else
58         > config.h              # Create new config file
59 fi
60 echo "/* Automatically generated - do not edit */" >>config.h
61 echo "#include <configs/$1.h>" >>config.h
62
63 exit 0