Patchwork [U-Boot,RFC,V2,9/9] Changes due to boards.cfg reformat

login
register
mail settings
Submitter Albert ARIBAUD
Date July 26, 2013, 9:37 p.m.
Message ID <1374874635-12042-10-git-send-email-albert.u.boot@aribaud.net>
Download mbox | patch
Permalink /patch/262315/
State Superseded
Delegated to: Tom Rini
Headers show

Comments

Albert ARIBAUD - July 26, 2013, 9:37 p.m.
The order of boards.cfg fields has changed; modify files which depend
on it.

NOTES:

1. mkconfig could probably endure more cleaning; it apparently has
   uncertain views about what its positional parameters are at various
   times of its execution. However, this submission will not perform any
   such cleanup.

2. buildman has not been tested.

3. make xxx_config and MAKEALL -a arm have been tested.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
---
 MAKEALL                 | 20 +++++++++++---------
 Makefile                |  2 +-
 mkconfig                | 31 ++++++++++++++++---------------
 tools/buildman/board.py |  2 +-
 4 files changed, 29 insertions(+), 26 deletions(-)

Patch

diff --git a/MAKEALL b/MAKEALL
index bed99de..3e895f6 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -160,7 +160,7 @@  FILTER="\$1 !~ /^#/"
 [ "$opt_v" ] && FILTER="${FILTER} && $opt_v"
 
 if [ "$SELECTED" ] ; then
-	SELECTED=$(awk '('"$FILTER"') { print $1 }' boards.cfg)
+	SELECTED=$(awk '('"$FILTER"') { print $7 }' boards.cfg)
 
 	# Make sure some boards from boards.cfg are actually found
 	if [ -z "$SELECTED" ] ; then
@@ -237,7 +237,7 @@  boards_by_field()
 }
 boards_by_arch() { boards_by_field 2 "$@" ; }
 boards_by_cpu()  { boards_by_field 3 "$@" "[: \t]+" ; }
-boards_by_soc()  { boards_by_field 6 "$@" ; }
+boards_by_soc()  { boards_by_field 4 "$@" ; }
 
 #########################################################################
 ## MPC5xx Systems
@@ -519,7 +519,7 @@  get_target_location() {
 	local vendor=""
 
 	# Automatic mode
-	local line=`egrep -i "^[[:space:]]*${target}[[:space:]]" boards.cfg`
+	local line=`egrep -i "[[:space:]]*${target}[[:space:]]" boards.cfg`
 
 	if [ -z "${line}" ] ; then echo "" ; return ; fi
 
@@ -532,15 +532,17 @@  get_target_location() {
 
 	[ "${BOARD_NAME}" ] || BOARD_NAME="${1%_config}"
 
-	if [ "$4" = "-" ] ; then
-		board=${BOARD_NAME}
-	else
-		board="$4"
+	if [ $# -gt 5 ]; then
+		if [ "$6" = "-" ] ; then
+			board=${BOARD_NAME}
+		else
+			board="$4"
+		fi
 	fi
 
 	[ $# -gt 4 ] && [ "$5" != "-" ] && vendor="$5"
-	[ $# -gt 6 ] && [ "$7" != "-" ] && {
-		tmp="${7%:*}"
+	[ $# -gt 6 ] && [ "$8" != "-" ] && {
+		tmp="${8%:*}"
 		if [ "$tmp" ] ; then
 			CONFIG_NAME="$tmp"
 		fi
diff --git a/Makefile b/Makefile
index 7206aba..4d24cfa 100644
--- a/Makefile
+++ b/Makefile
@@ -784,7 +784,7 @@  unconfig:
 
 sinclude $(obj).boards.depend
 $(obj).boards.depend:	boards.cfg
-	@awk '(NF && $$1 !~ /^#/) { print $$1 ": " $$1 "_config; $$(MAKE)" }' $< > $@
+	@awk '(NF && $$1 !~ /^#/) { print $$7 ": " $$7 "_config; $$(MAKE) -d" }' $< > $@
 
 #
 # Functions to generate common board directory names
diff --git a/mkconfig b/mkconfig
index 816ae3d..1d06c8e 100755
--- a/mkconfig
+++ b/mkconfig
@@ -23,10 +23,11 @@  options=""
 
 if [ \( $# -eq 2 \) -a \( "$1" = "-A" \) ] ; then
 	# Automatic mode
-	line=`egrep -i "^[[:space:]]*${2}[[:space:]]" boards.cfg` || {
+	line=`awk '($0 !~ /^#/ && $7 ~ /^'"$2"'$/) { print $1, $2, $3, $4, $5, $6, $7, $8 }' boards.cfg`
+	if [ -z "$line" ] ; then
 		echo "make: *** No rule to make target \`$2_config'.  Stop." >&2
 		exit 1
-	}
+	fi
 
 	set ${line}
 	# add default board name if needed
@@ -37,44 +38,44 @@  while [ $# -gt 0 ] ; do
 	case "$1" in
 	--) shift ; break ;;
 	-a) shift ; APPEND=yes ;;
-	-n) shift ; BOARD_NAME="${1%_config}" ; shift ;;
+	-n) shift ; BOARD_NAME="${7%_config}" ; shift ;;
 	-t) shift ; TARGETS="`echo $1 | sed 's:_: :g'` ${TARGETS}" ; shift ;;
 	*)  break ;;
 	esac
 done
 
-[ $# -lt 4 ] && exit 1
-[ $# -gt 7 ] && exit 1
+[ $# -lt 7 ] && exit 1
+[ $# -gt 8 ] && exit 1
 
 # Strip all options and/or _config suffixes
-CONFIG_NAME="${1%_config}"
+CONFIG_NAME="${7%_config}"
 
-[ "${BOARD_NAME}" ] || BOARD_NAME="${1%_config}"
+[ "${BOARD_NAME}" ] || BOARD_NAME="${7%_config}"
 
 arch="$2"
 cpu=`echo $3 | awk 'BEGIN {FS = ":"} ; {print $1}'`
 spl_cpu=`echo $3 | awk 'BEGIN {FS = ":"} ; {print $2}'`
-if [ "$4" = "-" ] ; then
+if [ "$6" = "-" ] ; then
 	board=${BOARD_NAME}
 else
-	board="$4"
+	board="$6"
 fi
-[ $# -gt 4 ] && [ "$5" != "-" ] && vendor="$5"
-[ $# -gt 5 ] && [ "$6" != "-" ] && soc="$6"
-[ $# -gt 6 ] && [ "$7" != "-" ] && {
+[ "$5" != "-" ] && vendor="$5"
+[ "$4" != "-" ] && soc="$4"
+[ $# -gt 7 ] && [ "$8" != "-" ] && {
 	# 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
-	tmp="${7%:*}"
+	tmp="${8%:*}"
 	if [ "$tmp" ] ; then
 		CONFIG_NAME="$tmp"
 	fi
 	# Check if we only have a colon...
-	if [ "${tmp}" != "$7" ] ; then
-		options=${7#*:}
+	if [ "${tmp}" != "$8" ] ; then
+		options=${8#*:}
 		TARGETS="`echo ${options} | sed 's:,: :g'` ${TARGETS}"
 	fi
 }
diff --git a/tools/buildman/board.py b/tools/buildman/board.py
index cc7b5d0..a388896 100644
--- a/tools/buildman/board.py
+++ b/tools/buildman/board.py
@@ -63,7 +63,7 @@  class Boards:
                 for upto in range(len(fields)):
                     if fields[upto] == '-':
                         fields[upto] = ''
-                while len(fields) < 7:
+                while len(fields) < 9:
                     fields.append('')
 
                 board = Board(*fields)