Blame view
mkconfig
4.24 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}'` |
27af930e9 Merge and reforma... |
56 |
if [ "$6" = "-" ] ; then |
a6862bc12 Makefile/mkconfig... |
57 58 |
board=${BOARD_NAME} else |
27af930e9 Merge and reforma... |
59 |
board="$6" |
a6862bc12 Makefile/mkconfig... |
60 |
fi |
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 # |
f93286397 Add support for a... |
100 101 |
if [ "$SRCTREE" != "$OBJTREE" ] ; then mkdir -p ${OBJTREE}/include |
a6862bc12 Makefile/mkconfig... |
102 |
LNPREFIX=${SRCTREE}/arch/${arch}/include/asm/ |
bb02c5366 Makefile: do not ... |
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 |
|
a6862bc12 Makefile/mkconfig... |
110 111 |
if [ -z "${soc}" ] ; then ln -s ${LNPREFIX}arch-${cpu} asm/arch |
86c988820 Patch by Steven S... |
112 |
else |
a6862bc12 Makefile/mkconfig... |
113 |
ln -s ${LNPREFIX}arch-${soc} asm/arch |
86c988820 Patch by Steven S... |
114 |
fi |
7ebf7443a Initial revision |
115 |
|
a6862bc12 Makefile/mkconfig... |
116 |
if [ "${arch}" = "arm" ] ; then |
819833af3 Move architecture... |
117 118 |
rm -f asm/proc ln -s ${LNPREFIX}proc-armv asm/proc |
b783edaee * Header file cle... |
119 |
fi |
bb02c5366 Makefile: do not ... |
120 121 122 |
if [ "$SRCTREE" = "$OBJTREE" ] ; then cd ${SRCTREE}/include fi |
7ebf7443a Initial revision |
123 124 125 |
# # Create include file for Make # |
0fd37b82f mkconfig: remove ... |
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
( 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 |
141 |
|
7ec1fedda mkconfig: Create ... |
142 |
# Assign board directory to BOARDIR variable |
a6862bc12 Makefile/mkconfig... |
143 144 |
if [ -z "${vendor}" ] ; then BOARDDIR=${board} |
7ec1fedda mkconfig: Create ... |
145 |
else |
a6862bc12 Makefile/mkconfig... |
146 |
BOARDDIR=${vendor}/${board} |
7ec1fedda mkconfig: Create ... |
147 |
fi |
7ebf7443a Initial revision |
148 149 150 151 152 153 154 155 156 157 |
# # 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... |
158 159 |
for i in ${TARGETS} ; do |
2901f8891 mkconfig: also cr... |
160 |
i="`echo ${i} | sed '/=/ {s/=/ /;q; } ; { s/$/ 1/; }'`" |
d24f2d321 mkconfig: change ... |
161 |
echo "#define CONFIG_${i}" >>config.h ; |
804d83a56 mkconfig: split t... |
162 |
done |
5e724ca2b Add env vars desc... |
163 164 165 166 167 168 169 |
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 |
10c32ff59 config_defaults.h... |
170 171 |
cat << EOF >> config.h #define CONFIG_BOARDDIR board/$BOARDDIR |
52f0aa835 config_cmd_defaul... |
172 |
#include <config_cmd_defaults.h> |
10c32ff59 config_defaults.h... |
173 |
#include <config_defaults.h> |
a6862bc12 Makefile/mkconfig... |
174 |
#include <configs/${CONFIG_NAME}.h> |
10c32ff59 config_defaults.h... |
175 |
#include <asm/config.h> |
26750c8ae CONFIG_SYS_BAUDRA... |
176 |
#include <config_fallbacks.h> |
7ac2fe2da OMAP: networking ... |
177 |
#include <config_uncmd_spl.h> |
10c32ff59 config_defaults.h... |
178 |
EOF |
7ebf7443a Initial revision |
179 180 |
exit 0 |