[U-Boot] [PATCH v2] Build: Add "board options" column to boards.cfg

Marek Vasut marek.vasut at gmail.com
Mon Oct 4 00:34:17 CEST 2010


There are some boards where it's not currently possible to detect all board
information at runtime, therefore I introduced a new column called "options" to
boards.cfg .

This column can contain multiple options, separated by comma [,] . In case
there's a simple options like 256M_U_BOOT, it's plain expanded to "#define
CONFIG_MK_256M_U_BOOT" in config.h . In case there's an assignment, like
"RAM=8192", it's expanded to "#define CONFIG_MK_RAM 8192" in
config.h . There can also be multiple such options, then each is expanded to
separate "#define CONFIG_MK_xyz" statement.

I also added fallback logic, in case the include/configs/Target.h config file
doesn't exist, include/configs/BOARD NAME.h is used.

Signed-off-by: Marek Vasut <marek.vasut at gmail.com>
---
NOTE: This is another version which adds "Options column". The previous patch
was: 0001-Build-Implement-sentinel-to-pass-board-options.patch

 boards.cfg |    4 ++--
 mkconfig   |   20 ++++++++++++++++++--
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/boards.cfg b/boards.cfg
index 62bcca8..765fe9a 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -17,8 +17,8 @@
 #
 #	:.,$! sort -f -k2,2 -k3,3 -k6,6 -k5,5 -k1,1
 #
-# Target	ARCH	CPU		Board name	Vendor		SoC
-###########################################################################
+# Target	ARCH	CPU		Board name	Vendor		SoC		Options
+###############################################################################################
 
 qong		arm	arm1136		-		davedenx	mx31
 mx31ads		arm	arm1136		-		freescale	mx31
diff --git a/mkconfig b/mkconfig
index b661071..dba1e42 100755
--- a/mkconfig
+++ b/mkconfig
@@ -17,6 +17,7 @@ cpu=""
 board=""
 vendor=""
 soc=""
+options=""
 
 if [ \( $# -eq 2 \) -a \( "$1" = "-A" \) ] ; then
 	# Automatic mode
@@ -41,7 +42,10 @@ while [ $# -gt 0 ] ; do
 done
 
 [ $# -lt 4 ] && exit 1
-[ $# -gt 6 ] && exit 1
+[ $# -gt 7 ] && exit 1
+
+# Chew options into TARGETS
+TARGETS="`echo $7 | sed "s/^[^,]*,//" | sed 's:,: :g'` ${TARGETS}"
 
 CONFIG_NAME="${1%_config}"
 
@@ -56,6 +60,7 @@ else
 fi
 [ $# -gt 4 ] && [ "$5" != "-" ] && vendor="$5"
 [ $# -gt 5 ] && [ "$6" != "-" ] && soc="$6"
+[ $# -gt 6 ] && [ "$7" != "-" ] && options="$7"
 
 if [ "${ARCH}" -a "${ARCH}" != "${arch}" ]; then
 	echo "Failed: \$ARCH=${ARCH}, should be '${arch}' for ${BOARD_NAME}" 1>&2
@@ -126,9 +131,20 @@ fi
 echo "/* Automatically generated - do not edit */" >>config.h
 
 for i in ${TARGETS} ; do
-	echo "#define CONFIG_MK_${i} 1" >>config.h ;
+	i="`echo ${i} | sed '/=/ {s/=/\t/;q } ; { s/$/\t1/ }'`"
+	echo "#define CONFIG_MK_${i}" >>config.h ;
 done
 
+# If there's no config file for the configuration, try config file for the
+# board instead.
+if [ ! -e configs/${CONFIG_NAME}.h ] ; then
+	if [ -e configs/${board}.h ] ; then
+		CONFIG_NAME=${board} ;
+	else
+		exit 1 ;
+	fi;
+fi
+
 cat << EOF >> config.h
 #define CONFIG_BOARDDIR board/$BOARDDIR
 #include <config_defaults.h>
-- 
1.7.1



More information about the U-Boot mailing list