Blame view
mkconfig
4.3 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}'` |
33a02da0f kbuild: allow emp... |
56 57 58 |
if [ "$6" = "<none>" ] ; then board= elif [ "$6" = "-" ] ; then |
a6862bc12 Makefile/mkconfig... |
59 60 |
board=${BOARD_NAME} else |
27af930e9 Merge and reforma... |
61 |
board="$6" |
a6862bc12 Makefile/mkconfig... |
62 |
fi |
27af930e9 Merge and reforma... |
63 64 65 |
[ "$5" != "-" ] && vendor="$5" [ "$4" != "-" ] && soc="$4" [ $# -gt 7 ] && [ "$8" != "-" ] && { |
9329cdfb3 Build: Add "board... |
66 67 68 69 70 71 |
# 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... |
72 |
tmp="${8%:*}" |
9329cdfb3 Build: Add "board... |
73 74 75 76 |
if [ "$tmp" ] ; then CONFIG_NAME="$tmp" fi # Check if we only have a colon... |
27af930e9 Merge and reforma... |
77 78 |
if [ "${tmp}" != "$8" ] ; then options=${8#*:} |
9329cdfb3 Build: Add "board... |
79 80 81 |
TARGETS="`echo ${options} | sed 's:,: :g'` ${TARGETS}" fi } |
a6862bc12 Makefile/mkconfig... |
82 83 84 |
if [ "${ARCH}" -a "${ARCH}" != "${arch}" ]; then echo "Failed: \$ARCH=${ARCH}, should be '${arch}' for ${BOARD_NAME}" 1>&2 |
a8fa379d4 mkconfig: deny me... |
85 86 |
exit 1 fi |
400a9488d arm: make 'MAKEAL... |
87 88 89 90 91 92 |
# # Test above needed aarch64, now we need arm # if [ "${arch}" = "aarch64" ]; then arch="arm" fi |
9329cdfb3 Build: Add "board... |
93 94 95 96 97 |
if [ "$options" ] ; then echo "Configuring for ${BOARD_NAME} - Board: ${CONFIG_NAME}, Options: ${options}" else echo "Configuring for ${BOARD_NAME} board..." fi |
7ebf7443a Initial revision |
98 |
|
7ebf7443a Initial revision |
99 100 101 |
# # Create link to architecture specific headers # |
f5c66bdb1 kbuild: use $(KBU... |
102 |
if [ -n "$KBUILD_SRC" ] ; then |
5ee828ca9 kbuild: rename OB... |
103 |
mkdir -p ${objtree}/include |
01286329b kbuild: rename SR... |
104 |
LNPREFIX=${srctree}/arch/${arch}/include/asm/ |
5ee828ca9 kbuild: rename OB... |
105 |
cd ${objtree}/include |
a9d8bc980 Don't add symlink... |
106 |
mkdir -p asm |
f93286397 Add support for a... |
107 |
else |
bb02c5366 Makefile: do not ... |
108 |
cd arch/${arch}/include |
f93286397 Add support for a... |
109 |
fi |
819833af3 Move architecture... |
110 |
rm -f asm/arch |
86c988820 Patch by Steven S... |
111 |
|
a6862bc12 Makefile/mkconfig... |
112 113 |
if [ -z "${soc}" ] ; then ln -s ${LNPREFIX}arch-${cpu} asm/arch |
86c988820 Patch by Steven S... |
114 |
else |
a6862bc12 Makefile/mkconfig... |
115 |
ln -s ${LNPREFIX}arch-${soc} asm/arch |
86c988820 Patch by Steven S... |
116 |
fi |
7ebf7443a Initial revision |
117 |
|
a6862bc12 Makefile/mkconfig... |
118 |
if [ "${arch}" = "arm" ] ; then |
819833af3 Move architecture... |
119 120 |
rm -f asm/proc ln -s ${LNPREFIX}proc-armv asm/proc |
b783edaee * Header file cle... |
121 |
fi |
f5c66bdb1 kbuild: use $(KBU... |
122 |
if [ -z "$KBUILD_SRC" ] ; then |
01286329b kbuild: rename SR... |
123 |
cd ${srctree}/include |
bb02c5366 Makefile: do not ... |
124 |
fi |
7ebf7443a Initial revision |
125 126 127 |
# # Create include file for Make # |
0fd37b82f mkconfig: remove ... |
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
( 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 |
143 |
|
7ec1fedda mkconfig: Create ... |
144 |
# Assign board directory to BOARDIR variable |
a6862bc12 Makefile/mkconfig... |
145 146 |
if [ -z "${vendor}" ] ; then BOARDDIR=${board} |
7ec1fedda mkconfig: Create ... |
147 |
else |
a6862bc12 Makefile/mkconfig... |
148 |
BOARDDIR=${vendor}/${board} |
7ec1fedda mkconfig: Create ... |
149 |
fi |
7ebf7443a Initial revision |
150 151 152 153 154 155 156 157 158 159 |
# # 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... |
160 161 |
for i in ${TARGETS} ; do |
2901f8891 mkconfig: also cr... |
162 |
i="`echo ${i} | sed '/=/ {s/=/ /;q; } ; { s/$/ 1/; }'`" |
d24f2d321 mkconfig: change ... |
163 |
echo "#define CONFIG_${i}" >>config.h ; |
804d83a56 mkconfig: split t... |
164 |
done |
5e724ca2b Add env vars desc... |
165 166 167 168 169 170 171 |
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... |
172 |
[ "${board}" ] && echo "#define CONFIG_BOARDDIR board/$BOARDDIR" >> config.h |
10c32ff59 config_defaults.h... |
173 |
cat << EOF >> config.h |
52f0aa835 config_cmd_defaul... |
174 |
#include <config_cmd_defaults.h> |
10c32ff59 config_defaults.h... |
175 |
#include <config_defaults.h> |
a6862bc12 Makefile/mkconfig... |
176 |
#include <configs/${CONFIG_NAME}.h> |
10c32ff59 config_defaults.h... |
177 |
#include <asm/config.h> |
26750c8ae CONFIG_SYS_BAUDRA... |
178 |
#include <config_fallbacks.h> |
7ac2fe2da OMAP: networking ... |
179 |
#include <config_uncmd_spl.h> |
10c32ff59 config_defaults.h... |
180 |
EOF |
7ebf7443a Initial revision |
181 182 |
exit 0 |