[U-Boot] [PATCH v2] 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.
Signed-off-by: Marek Vasut marek.vasut@gmail.com --- v2: Use comma, permit assignment
boards.cfg | 1 + mkconfig | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/boards.cfg b/boards.cfg index 62bcca8..238b811 100644 --- a/boards.cfg +++ b/boards.cfg @@ -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 # diff --git a/mkconfig b/mkconfig index b661071..be8768c 100755 --- a/mkconfig +++ b/mkconfig @@ -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

Dear Marek Vasut,
In message 1286140454-19572-1-git-send-email-marek.vasut@gmail.com you wrote:
With this implementation, the sentinel character in TARGET name is interpreted as an option and expanded to CONFIG_MK_xxx.
Signed-off-by: Marek Vasut marek.vasut@gmail.com
v2: Use comma, permit assignment
Close, but no cigar.
You fail to handle the "name=value" case.
Best regards,
Wolfgang Denk
participants (2)
-
Marek Vasut
-
Wolfgang Denk