Blame view
mkconfig
4.2 KB
7ebf7443a Initial revision |
1 2 3 4 5 |
#!/bin/sh -e # Script to create header files and links to configure # U-Boot for a specific board. # |
1d9f41050 Patch by Steven S... |
6 |
# Parameters: Target Architecture CPU Board [VENDOR] [SOC] |
7ebf7443a Initial revision |
7 |
# |
eca3aeb35 Licenses: introdu... |
8 9 10 |
# (C) 2002-2013 DENX Software Engineering, Wolfgang Denk <wd@denx.de> # # SPDX-License-Identifier: GPL-2.0+ |
7ebf7443a Initial revision |
11 12 13 |
# APPEND=no # Default: Create new config file |
5078cce81 * Cleanup TQM5200... |
14 |
BOARD_NAME="" # Name to print in make output |
804d83a56 mkconfig: split t... |
15 |
TARGETS="" |
7ebf7443a Initial revision |
16 |
|
a6862bc12 Makefile/mkconfig... |
17 18 19 20 21 |
arch="" cpu="" board="" vendor="" soc="" |
9329cdfb3 Build: Add "board... |
22 |
options="" |
a6862bc12 Makefile/mkconfig... |
23 24 25 |
if [ \( $# -eq 2 \) -a \( "$1" = "-A" \) ] ; then # Automatic mode |
9e4140329 kbuild: change ou... |
26 |
line=`awk '($0 !~ /^#/ && $7 ~ /^'"$2"'$/) { print $1, $2, $3, $4, $5, $6, $7, $8 }' $srctree/boards.cfg` |
27af930e9 Merge and reforma... |
27 |
if [ -z "$line" ] ; then |
a6862bc12 Makefile/mkconfig... |
28 29 |
echo "make: *** No rule to make target \`$2_config'. Stop." >&2 exit 1 |
27af930e9 Merge and reforma... |
30 |
fi |
a6862bc12 Makefile/mkconfig... |
31 32 33 34 35 |
set ${line} # add default board name if needed [ $# = 3 ] && set ${line} ${1} fi |
7ebf7443a Initial revision |
36 37 38 39 |
while [ $# -gt 0 ] ; do case "$1" in --) shift ; break ;; -a) shift ; APPEND=yes ;; |
27af930e9 Merge and reforma... |
40 |
-n) shift ; BOARD_NAME="${7%_config}" ; shift ;; |
804d83a56 mkconfig: split t... |
41 |
-t) shift ; TARGETS="`echo $1 | sed 's:_: :g'` ${TARGETS}" ; shift ;; |
7ebf7443a Initial revision |
42 43 44 |
*) break ;; esac done |
27af930e9 Merge and reforma... |
45 46 |
[ $# -lt 7 ] && exit 1 [ $# -gt 8 ] && exit 1 |
7ebf7443a Initial revision |
47 |
|
9329cdfb3 Build: Add "board... |
48 |
# Strip all options and/or _config suffixes |
27af930e9 Merge and reforma... |
49 |
CONFIG_NAME="${7%_config}" |
a6862bc12 Makefile/mkconfig... |
50 |
|
27af930e9 Merge and reforma... |
51 |
[ "${BOARD_NAME}" ] || BOARD_NAME="${7%_config}" |
a6862bc12 Makefile/mkconfig... |
52 53 |
arch="$2" |
0fd37b82f mkconfig: remove ... |
54 55 |
cpu=`echo $3 | awk 'BEGIN {FS = ":"} ; {print $1}'` spl_cpu=`echo $3 | awk 'BEGIN {FS = ":"} ; {print $2}'` |
a8b0f9b68 build: define CPU... |
56 57 58 59 |
if [ "$cpu" = "-" ] ; then cpu= fi |
75e6cd279 boards.cfg: chang... |
60 |
[ "$6" != "-" ] && board="$6" |
27af930e9 Merge and reforma... |
61 62 63 |
[ "$5" != "-" ] && vendor="$5" [ "$4" != "-" ] && soc="$4" [ $# -gt 7 ] && [ "$8" != "-" ] && { |
9329cdfb3 Build: Add "board... |
64 65 66 67 68 69 |
# check if we have a board config name in the options field # the options field mave have a board config name and a list # of options, both separated by a colon (':'); the options are # separated by commas (','). # # Check for board name |
27af930e9 Merge and reforma... |
70 |
tmp="${8%:*}" |
9329cdfb3 Build: Add "board... |
71 72 73 74 |
if [ "$tmp" ] ; then CONFIG_NAME="$tmp" fi # Check if we only have a colon... |
27af930e9 Merge and reforma... |
75 76 |
if [ "${tmp}" != "$8" ] ; then options=${8#*:} |
9329cdfb3 Build: Add "board... |
77 78 79 |
TARGETS="`echo ${options} | sed 's:,: :g'` ${TARGETS}" fi } |
a6862bc12 Makefile/mkconfig... |
80 81 82 |
if [ "${ARCH}" -a "${ARCH}" != "${arch}" ]; then echo "Failed: \$ARCH=${ARCH}, should be '${arch}' for ${BOARD_NAME}" 1>&2 |
a8fa379d4 mkconfig: deny me... |
83 84 |
exit 1 fi |
400a9488d arm: make 'MAKEAL... |
85 86 87 88 89 90 |
# # Test above needed aarch64, now we need arm # if [ "${arch}" = "aarch64" ]; then arch="arm" fi |
9329cdfb3 Build: Add "board... |
91 92 93 94 95 |
if [ "$options" ] ; then echo "Configuring for ${BOARD_NAME} - Board: ${CONFIG_NAME}, Options: ${options}" else echo "Configuring for ${BOARD_NAME} board..." fi |
7ebf7443a Initial revision |
96 |
|
7ebf7443a Initial revision |
97 98 99 |
# # Create link to architecture specific headers # |
f5c66bdb1 kbuild: use $(KBU... |
100 |
if [ -n "$KBUILD_SRC" ] ; then |
5ee828ca9 kbuild: rename OB... |
101 |
mkdir -p ${objtree}/include |
01286329b kbuild: rename SR... |
102 |
LNPREFIX=${srctree}/arch/${arch}/include/asm/ |
5ee828ca9 kbuild: rename OB... |
103 |
cd ${objtree}/include |
a9d8bc980 Don't add symlink... |
104 |
mkdir -p asm |
f93286397 Add support for a... |
105 |
else |
bb02c5366 Makefile: do not ... |
106 |
cd arch/${arch}/include |
f93286397 Add support for a... |
107 |
fi |
819833af3 Move architecture... |
108 |
rm -f asm/arch |
86c988820 Patch by Steven S... |
109 |
|
a8b0f9b68 build: define CPU... |
110 |
if [ "${soc}" ] ; then |
a6862bc12 Makefile/mkconfig... |
111 |
ln -s ${LNPREFIX}arch-${soc} asm/arch |
a8b0f9b68 build: define CPU... |
112 113 |
elif [ "${cpu}" ] ; then ln -s ${LNPREFIX}arch-${cpu} asm/arch |
86c988820 Patch by Steven S... |
114 |
fi |
7ebf7443a Initial revision |
115 |
|
f5c66bdb1 kbuild: use $(KBU... |
116 |
if [ -z "$KBUILD_SRC" ] ; then |
01286329b kbuild: rename SR... |
117 |
cd ${srctree}/include |
bb02c5366 Makefile: do not ... |
118 |
fi |
7ebf7443a Initial revision |
119 120 121 |
# # Create include file for Make # |
0fd37b82f mkconfig: remove ... |
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
( echo "ARCH = ${arch}" if [ ! -z "$spl_cpu" ] ; then echo 'ifeq ($(CONFIG_SPL_BUILD),y)' echo "CPU = ${spl_cpu}" echo "else" echo "CPU = ${cpu}" echo "endif" else echo "CPU = ${cpu}" fi echo "BOARD = ${board}" [ "${vendor}" ] && echo "VENDOR = ${vendor}" [ "${soc}" ] && echo "SOC = ${soc}" exit 0 ) > config.mk |
7ebf7443a Initial revision |
137 |
|
7ec1fedda mkconfig: Create ... |
138 |
# Assign board directory to BOARDIR variable |
a6862bc12 Makefile/mkconfig... |
139 140 |
if [ -z "${vendor}" ] ; then BOARDDIR=${board} |
7ec1fedda mkconfig: Create ... |
141 |
else |
a6862bc12 Makefile/mkconfig... |
142 |
BOARDDIR=${vendor}/${board} |
7ec1fedda mkconfig: Create ... |
143 |
fi |
7ebf7443a Initial revision |
144 145 146 147 148 149 150 151 152 153 |
# # Create board specific header file # if [ "$APPEND" = "yes" ] # Append to existing config file then echo >> config.h else > config.h # Create new config file fi echo "/* Automatically generated - do not edit */" >>config.h |
804d83a56 mkconfig: split t... |
154 155 |
for i in ${TARGETS} ; do |
2901f8891 mkconfig: also cr... |
156 |
i="`echo ${i} | sed '/=/ {s/=/ /;q; } ; { s/$/ 1/; }'`" |
d24f2d321 mkconfig: change ... |
157 |
echo "#define CONFIG_${i}" >>config.h ; |
804d83a56 mkconfig: split t... |
158 |
done |
5e724ca2b Add env vars desc... |
159 160 161 162 163 164 165 |
echo "#define CONFIG_SYS_ARCH \"${arch}\"" >> config.h echo "#define CONFIG_SYS_CPU \"${cpu}\"" >> config.h echo "#define CONFIG_SYS_BOARD \"${board}\"" >> config.h [ "${vendor}" ] && echo "#define CONFIG_SYS_VENDOR \"${vendor}\"" >> config.h [ "${soc}" ] && echo "#define CONFIG_SYS_SOC \"${soc}\"" >> config.h |
33a02da0f kbuild: allow emp... |
166 |
[ "${board}" ] && echo "#define CONFIG_BOARDDIR board/$BOARDDIR" >> config.h |
10c32ff59 config_defaults.h... |
167 |
cat << EOF >> config.h |
52f0aa835 config_cmd_defaul... |
168 |
#include <config_cmd_defaults.h> |
10c32ff59 config_defaults.h... |
169 |
#include <config_defaults.h> |
a6862bc12 Makefile/mkconfig... |
170 |
#include <configs/${CONFIG_NAME}.h> |
10c32ff59 config_defaults.h... |
171 |
#include <asm/config.h> |
26750c8ae CONFIG_SYS_BAUDRA... |
172 |
#include <config_fallbacks.h> |
7ac2fe2da OMAP: networking ... |
173 |
#include <config_uncmd_spl.h> |
10c32ff59 config_defaults.h... |
174 |
EOF |
7ebf7443a Initial revision |
175 176 |
exit 0 |