]> Git Repo - J-u-boot.git/blame_incremental - mkconfig
nand commands: make only "dump" repeatable.
[J-u-boot.git] / mkconfig
... / ...
CommitLineData
1#!/bin/sh -e
2
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 <[email protected]>
9#
10
11APPEND=no # Default: Create new config file
12BOARD_NAME="" # Name to print in make output
13TARGETS=""
14
15arch=""
16cpu=""
17board=""
18vendor=""
19soc=""
20
21if [ \( $# -eq 2 \) -a \( "$1" = "-A" \) ] ; then
22 # Automatic mode
23 line=`egrep -i "^[[:space:]]*${2}[[:space:]]" boards.cfg` || {
24 echo "make: *** No rule to make target \`$2_config'. Stop." >&2
25 exit 1
26 }
27
28 set ${line}
29 # add default board name if needed
30 [ $# = 3 ] && set ${line} ${1}
31fi
32
33while [ $# -gt 0 ] ; do
34 case "$1" in
35 --) shift ; break ;;
36 -a) shift ; APPEND=yes ;;
37 -n) shift ; BOARD_NAME="${1%_config}" ; shift ;;
38 -t) shift ; TARGETS="`echo $1 | sed 's:_: :g'` ${TARGETS}" ; shift ;;
39 *) break ;;
40 esac
41done
42
43[ $# -lt 4 ] && exit 1
44[ $# -gt 6 ] && exit 1
45
46CONFIG_NAME="${1%_config}"
47
48[ "${BOARD_NAME}" ] || BOARD_NAME="${CONFIG_NAME}"
49
50arch="$2"
51cpu="$3"
52if [ "$4" = "-" ] ; then
53 board=${BOARD_NAME}
54else
55 board="$4"
56fi
57[ $# -gt 4 ] && [ "$5" != "-" ] && vendor="$5"
58[ $# -gt 5 ] && [ "$6" != "-" ] && soc="$6"
59
60if [ "${ARCH}" -a "${ARCH}" != "${arch}" ]; then
61 echo "Failed: \$ARCH=${ARCH}, should be '${arch}' for ${BOARD_NAME}" 1>&2
62 exit 1
63fi
64
65echo "Configuring for ${BOARD_NAME} board..."
66
67#
68# Create link to architecture specific headers
69#
70if [ "$SRCTREE" != "$OBJTREE" ] ; then
71 mkdir -p ${OBJTREE}/include
72 mkdir -p ${OBJTREE}/include2
73 cd ${OBJTREE}/include2
74 rm -f asm
75 ln -s ${SRCTREE}/arch/${arch}/include/asm asm
76 LNPREFIX=${SRCTREE}/arch/${arch}/include/asm/
77 cd ../include
78 rm -f asm
79 ln -s ${SRCTREE}/arch/${arch}/include/asm asm
80else
81 cd ./include
82 rm -f asm
83 ln -s ../arch/${arch}/include/asm asm
84fi
85
86rm -f asm/arch
87
88if [ -z "${soc}" ] ; then
89 ln -s ${LNPREFIX}arch-${cpu} asm/arch
90else
91 ln -s ${LNPREFIX}arch-${soc} asm/arch
92fi
93
94if [ "${arch}" = "arm" ] ; then
95 rm -f asm/proc
96 ln -s ${LNPREFIX}proc-armv asm/proc
97fi
98
99#
100# Create include file for Make
101#
102echo "ARCH = ${arch}" > config.mk
103echo "CPU = ${cpu}" >> config.mk
104echo "BOARD = ${board}" >> config.mk
105
106[ "${vendor}" ] && echo "VENDOR = ${vendor}" >> config.mk
107
108[ "${soc}" ] && echo "SOC = ${soc}" >> config.mk
109
110# Assign board directory to BOARDIR variable
111if [ -z "${vendor}" ] ; then
112 BOARDDIR=${board}
113else
114 BOARDDIR=${vendor}/${board}
115fi
116
117#
118# Create board specific header file
119#
120if [ "$APPEND" = "yes" ] # Append to existing config file
121then
122 echo >> config.h
123else
124 > config.h # Create new config file
125fi
126echo "/* Automatically generated - do not edit */" >>config.h
127
128for i in ${TARGETS} ; do
129 echo "#define CONFIG_MK_${i} 1" >>config.h ;
130done
131
132cat << 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>
137EOF
138
139exit 0
This page took 0.024919 seconds and 4 git commands to generate.