Skip to contentSkip to conversation

Build: Implement sentinel to pass board options

PATCH New Marek Vasut 2 participants 2 messages Oct 3, 2010

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Build: Implement sentinel to pass board options

With this implementation, the sentinel character in TARGET name is interpreted as an option and expanded to CONFIG_MK_xxx.

---
v2: Use comma, permit assignment

 boards.cfg |    1 +
 mkconfig   |   10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)
boards.cfg +1 -0
index 62bcca8..238b811 100644
@@ -12,6 +12,7 @@
 #
 #	Lines starting with '#' are comments.
 #	Blank lines are ignored.
+#	Comma is used to specify board options.
 #
 # To keep the list sorted, use something like
 #
mkconfig +7 -3
index b661071..be8768c 100755
@@ -43,7 +43,10 @@ done
 [ $# -lt 4 ] && exit 1
 [ $# -gt 6 ] && exit 1
 
-CONFIG_NAME="${1%_config}"
+# The sentinel is used to define board options
+TARGETS="`echo $1 | sed "s/^[^,]*,//" | sed 's:,: :g'` ${TARGETS}"
+
+CONFIG_NAME="`echo ${1%_config} | sed 's/,.*$//g'`"
 
 [ "${BOARD_NAME}" ] || BOARD_NAME="${CONFIG_NAME}"
 
@@ -52,7 +55,7 @@ cpu="$3"
 if [ "$4" = "-" ] ; then
 	board=${BOARD_NAME}
 else
-	board="$4"
+	board="`echo $1 | sed 's/@.*$//g'`"
 fi
 [ $# -gt 4 ] && [ "$5" != "-" ] && vendor="$5"
 [ $# -gt 5 ] && [ "$6" != "-" ] && soc="$6"
@@ -126,7 +129,8 @@ 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
 
 cat << EOF >> config.h
Signature · 1 line
1.7.1
#1 lore raw

PATCH v2 1/1 Build: Implement sentinel to pass board options

Dear Marek Vasut,

Quoted 6 lines · In message <[email protected]> you wrote:

With this implementation, the sentinel character in TARGET name is interpreted as an option and expanded to CONFIG_MK_xxx.

---
v2: Use comma, permit assignment

Close, but no cigar.

You fail to handle the "name=value" case.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
This cultural mystique surrounding the  biological  function  --  you
realize humans are overly preoccupied with the subject.
	-- Kelinda the Kelvan, "By Any Other Name", stardate 4658.9