Fix bugs of MAKEALL
cover Fix bugs of MAKEALL
Commit 27af930e9a5c91365ca639ada580b338eabe4989
changed the boards.cfg format and introduced
some bugs to MAKEALL.
This series fixes them.
Masahiro Yamada (3):
MAKEALL: fix awk warning message
MAKEALL: fix a bug to use CROSS_COMPILE_<ARCH>
MAKEALL: fix boards_by_cpu function
MAKEALL | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
Signature · 1 line
1.8.1.2
PATCH 1/3 MAKEALL: fix awk warning message
If you do ./MAKEALL -M or ./MAKEALL -m
GNU awk would display warnings like follows:
awk: warning: escape sequence \ ' treated as plain '
In the first place, we do not explicitly set the field separator.
---
See line 163 of ./MAKEALL
SELECTED=$(awk '('"$FILTER"') { print $7 }' boards.cfg)We already use awk without specifiying FS.
MAKEALL | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
MAKEALL +2 -2
@@ -518,7 +518,7 @@ get_target_location() { local vendor="" # Automatic mode - local line=`awk -F '\ +' '\$7 == "'"$target"'" { print \$0 }' boards.cfg` + local line=`awk '\$7 == "'"$target"'" { print \$0 }' boards.cfg` if [ -z "${line}" ] ; then echo "" ; return ; fi set ${line}
@@ -556,7 +556,7 @@ get_target_location() { get_target_maintainers() { local name=`echo $1 | cut -d : -f 3` - local line=`awk -F '\ +' '\$7 == "'"$target"'" { print \$0 }' boards.cfg` + local line=`awk '\$7 == "'"$target"'" { print \$0 }' boards.cfg` if [ -z "${line}" ]; then echo "" return ;
Signature · 1 line
1.8.1.2
PATCH 2/3 MAKEALL: fix a bug to use CROSS_COMPILE_<ARCH>
In reply to Masahiro YamadaCommit 27af930e changed the boards.cfg format but missed to change get_target_arch() fuction.
This commit adjusts it for CROSS_COMPILE_<ARCH> to work correctly.
--- MAKEALL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
MAKEALL +1 -1
@@ -571,7 +571,7 @@ get_target_arch() { local target=$1 # Automatic mode - local line=`egrep -i "^[[:space:]]*${target}[[:space:]]" boards.cfg` + local line=`awk '\$7 == "'"$target"'" { print \$0 }' boards.cfg` if [ -z "${line}" ] ; then echo "" ; return ; fi
Signature · 1 line
1.8.1.2
PATCH 2/3 MAKEALL: fix a bug to use CROSS_COMPILE_<ARCH>
Hi Masahiro,
Quoted 16 lines · Masahiro Yamada
Commit
27af930echanged the boards.cfg format but missed to changeget_target_arch()fuction.
This commit adjusts it for CROSS_COMPILE_<ARCH> to work correctly.Signed-off-by Masahiro Yamada <[email protected]>Cc Albert ARIBAUD <[email protected]>--- MAKEALL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)MAKEALL +0
-0
MAKEALL get_target_arch() { · line 577
Quoted 8 lines
MAKEALL +1
-1@@ -571,7 +571,7 @@ get_target_arch() { local target=$1 # Automatic mode - local line=`egrep -i "^[[:space:]]*${target}[[:space:]]" boards.cfg` + local line=`awk '\$7 == "'"$target"'" { print \$0 }' boards.cfg` if [ -z "${line}" ] ; then echo "" ; return ; fi
What issue does this change fix?
Amicalement,
Signature · 1 line
Albert.
PATCH 2/3 MAKEALL: fix a bug to use CROSS_COMPILE_<ARCH>
Hello Albert.
Quoted 1 line
What issue does this change fix?
MAKEALL supports the environment variable CROSS_COMPILE_<ARCH>.
MAKEALL --help says like follows:
CROSS_COMPILE_<ARCH> cross-compiler toolchain prefix for
architecture "ARCH". Substitute "ARCH" for any
This feature is useful when you want to build
various architectures at a time.
For example, you can use it like this:
CROSS_COMPILE_ARM=arm-linux-gnueabi- \
CROSS_COMPILE_POWERPC=powerpc-linux-gnu- \
CROSS_COMPILE_SH=sh4-linux- \./MAKEALL -a arm -a powerpc -a sh
Commit 27af930e broke this feature,
so I want to fix this.
Best Regards
Masahiro Yamada
PATCH 2/3 MAKEALL: fix a bug to use CROSS_COMPILE_<ARCH>
Hi Masahiro,
Quoted 11 lines · Masahiro Yamada
Hello Albert.
Quoted 1 line
What issue does this change fix?
MAKEALL supports the environment variable CROSS_COMPILE_<ARCH>.
Commit
27af930ebroke this feature,
so I want to fix this.
Sorry, I have been unclear. How exactly does the commit break this feature? What worked before it which does not work after?
Quoted 2 lines
Best Regards
Masahiro Yamada
Amicalement,
Signature · 1 line
Albert.
PATCH 2/3 MAKEALL: fix a bug to use CROSS_COMPILE_<ARCH>
Hello Albert
Quoted 5 lines
Quoted 2 lines
Commit
27af930ebroke this feature,
so I want to fix this.Sorry, I have been unclear. How exactly does the commit break this feature? What worked before it which does not work after?
A quite simple test.
$ git checkout 27af930e^ $ CROSS_COMPILE_ARM=arm-linux-gnueabi- ./MAKEALL -a arm Configuring for integratorcp_cm1136 - Board: integratorcp, Options: CM1136 text data bss dec hex filename 160402 6164 16156 182722 2c9c2 ./u-boot Configuring for imx31_phycore board... text data bss dec hex filename 144449 5162 21016 170627 29a83 ./u-boot
...
$ git checkout 27af930e $ CROSS_COMPILE_ARM=arm-linux-gnueabi- ./MAKEALL -a arm Configuring for integratorcp_cm1136 - Board: integratorcp, Options: CM1136 make: *** [lib/asm-offsets.s] Error 127 size: './u-boot': No such file /bin/bash: arm-linux-gcc: command not found /bin/bash: arm-linux-gcc: command not found dirname: missing operand Try 'dirname --help' for more information. /bin/bash: line 3: arm-linux-gcc: command not found /bin/bash: line 3: arm-linux-gcc: command not found /bin/bash: arm-linux-gcc: command not found /bin/bash: arm-linux-gcc: command not found
...
Note:
I am using arm-linux-gnueabi-gcc, not arm-linux-gcc
Best Regards
Masahiro Yamada
PATCH 3/3 MAKEALL: fix boards_by_field function
In reply to Masahiro YamadaCommit 27af930e changed the boards.cfg format and it changed boards_by_field() function incorrectly. For tegra cpus it returned Board Name field, not Target field.
---
Commit 27af930e adjusted this part like follows:
-v field="$1" \
-v select="$2" \
-F "$FS" \
- '($1 !~ /^#/ && $field == select) { print $1 }' \
+ '($1 !~ /^#/ && $field == select) { print $7 }' \
boards.cfg
}
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 "$@" ; }TAB is also treated as a field speparator, so
we should have taken the 8th field for Tegra
whereas the 7th field for the other cpus.
Fortunately, Board Name field and Target filed are the same for all Tegra LSIs.
But we should not expect it.
MAKEALL | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
MAKEALL +5 -5
@@ -226,17 +226,17 @@ RC=0 # Helper funcs for parsing boards.cfg boards_by_field() { - FS="[ \t]+" - [ -n "$3" ] && FS="$3" awk \ -v field="$1" \ -v select="$2" \ - -F "$FS" \ - '($1 !~ /^#/ && $field == select) { print $7 }' \ + -v cut="$3" \ + '{sub(cut,"",$field)} + ($1 !~ /^#/ && $field == select) { print $7 }' \ boards.cfg } + boards_by_arch() { boards_by_field 2 "$@" ; } -boards_by_cpu() { boards_by_field 3 "$@" "[: \t]+" ; } +boards_by_cpu() { boards_by_field 3 "$@" ":.*" ; } boards_by_soc() { boards_by_field 4 "$@" ; } #########################################################################
Signature · 1 line
1.8.1.2
PATCH 3/3 MAKEALL: fix boards_by_field function
Hi Masahiro,
Quoted 25 lines · Masahiro Yamada
Commit
27af930echanged the boards.cfg format and it changedboards_by_field()function incorrectly. For tegra cpus it returned Board Name field, not Target field.Signed-off-by Masahiro Yamada <[email protected]>Cc Albert ARIBAUD <[email protected]>---
Commit
27af930eadjusted this part like follows:-v field="$1" \ -v select="$2" \ -F "$FS" \ - '($1 !~ /^#/ && $field == select) { print $1 }' \ + '($1 !~ /^#/ && $field == select) { print $7 }' \ boards.cfg } 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 "$@" ; }
Quoted 7 lines
TAB is also treated as a field speparator, so
we should have taken the 8th field for Tegra
whereas the 7th field for the other cpus.Fortunately, Board Name field and Target filed are the same for all Tegra LSIs.
But we should not expect it.
Not sure I am following here, as the commit you mention does not change how tabs are processed.
Besides, the system should *not* be sensitive to tabs. If it is, this must be fixed and tabs removed.
Amicalement,
Signature · 1 line
Albert.
PATCH 3/3 MAKEALL: fix boards_by_field function
Hello Albert.
Quoted 24 lines
Quoted 16 lines
Commit
27af930eadjusted this part like follows:-v field="$1" \ -v select="$2" \ -F "$FS" \ - '($1 !~ /^#/ && $field == select) { print $1 }' \ + '($1 !~ /^#/ && $field == select) { print $7 }' \ boards.cfg } 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 "$@" ; }Quoted 7 lines
TAB is also treated as a field speparator, so
we should have taken the 8th field for Tegra
whereas the 7th field for the other cpus.Fortunately, Board Name field and Target filed are the same for all Tegra LSIs.
But we should not expect it.
Quoted 5 lines
Not sure I am following here, as the commit you mention does not change how tabs are processed.
Besides, the system should *not* be sensitive to tabs. If it is, this must be fixed and tabs removed.
Sorry, my mistake.
s/TAB/colon/
The comment should be:
Colon is also treated as a field speparator, so
we should have taken the 8th field for Tegra
whereas the 7th field for the other cpus.
Best Regards
Masahiro Yamada
PATCH 3/3 MAKEALL: fix boards_by_field function
In reply to Masahiro YamadaHi Masahiro,
Quoted 25 lines · Masahiro Yamada
Commit
27af930echanged the boards.cfg format and it changedboards_by_field()function incorrectly. For tegra cpus it returned Board Name field, not Target field.Signed-off-by Masahiro Yamada <[email protected]>Cc Albert ARIBAUD <[email protected]>---
Commit
27af930eadjusted this part like follows:-v field="$1" \ -v select="$2" \ -F "$FS" \ - '($1 !~ /^#/ && $field == select) { print $1 }' \ + '($1 !~ /^#/ && $field == select) { print $7 }' \ boards.cfg } 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 "$@" ; }
Quoted 3 lines
TAB is also treated as a field speparator, so
we should have taken the 8th field for Tegra
whereas the 7th field for the other cpus.
(As per our discussion, 'tab' here should be 'colon')
Not sure I am getting the logic here. Colon is *not* a field separator, precisely because it is not present on all lines; it is a sub-field separator. At this low level, the only field separator should be spaces.
Therefore, I would prefer boards_by_field() and board_by_cpu() to *not* handle colons and thus consider the CPU field as a whole even when it consists in a cpu:splcpu pair.
Splitting that pair and using either cpu or splcpu depending on whether building SPL or not should only happen when the CPU field is actually used, not fetched.
Can you try and provide a v2 patch (set) along these lines?
Amicalement,
Signature · 1 line
Albert.
PATCH 3/3 MAKEALL: fix boards_by_field function
Hello Albert
Quoted 13 lines
Quoted 13 lines
-v field="$1" \ -v select="$2" \ -F "$FS" \ - '($1 !~ /^#/ && $field == select) { print $1 }' \ + '($1 !~ /^#/ && $field == select) { print $7 }' \ boards.cfg } 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 "$@" ; }
Quoted 5 lines
Quoted 3 lines
TAB is also treated as a field speparator, so
we should have taken the 8th field for Tegra
whereas the 7th field for the other cpus.(As per our discussion, 'tab' here should be 'colon')
Yes, I answerd so in my previous reply.
Quoted 7 lines
Not sure I am getting the logic here. Colon is *not* a field separator, precisely because it is not present on all lines; it is a sub-field separator. At this low level, the only field separator should be spaces.
Therefore, I would prefer
boards_by_field()andboard_by_cpu()to *not* handle colons and thus consider the CPU field as a whole even when it consists in a cpu:splcpu pair.
Yes. I think I already did this in my v1 patch.
+ -v cut="$3" \
+ '{sub(cut,"",$field)}These lines split the pair into cpu and spl_cpu.
I simply cut down spl_cpu because it is the same behaviour as before Commit 27af930e.
Quoted 5 lines
Splitting that pair and using either cpu or splcpu depending on whether building SPL or not should only happen when the CPU field is actually used, not fetched.
Can you try and provide a v2 patch (set) along these lines?
Sorry, I cannot understand what you mean.
Best Regards
Masahiro Yamada
PATCH 3/3 MAKEALL: fix boards_by_field function
Hi Masahiro,
Quoted 47 lines · Masahiro Yamada
Hello Albert
Quoted 13 lines
Quoted 13 lines
-v field="$1" \ -v select="$2" \ -F "$FS" \ - '($1 !~ /^#/ && $field == select) { print $1 }' \ + '($1 !~ /^#/ && $field == select) { print $7 }' \ boards.cfg } 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 "$@" ; }Quoted 5 lines
Quoted 3 lines
TAB is also treated as a field speparator, so
we should have taken the 8th field for Tegra
whereas the 7th field for the other cpus.(As per our discussion, 'tab' here should be 'colon')
Yes, I answerd so in my previous reply.
Quoted 7 lines
Not sure I am getting the logic here. Colon is *not* a field separator, precisely because it is not present on all lines; it is a sub-field separator. At this low level, the only field separator should be spaces.
Therefore, I would prefer
boards_by_field()andboard_by_cpu()to *not* handle colons and thus consider the CPU field as a whole even when it consists in a cpu:splcpu pair.Yes. I think I already did this in my v1 patch.
+ -v cut="$3" \ + '{sub(cut,"",$field)}These lines split the pair into cpu and
spl_cpu.
I simply cut downspl_cpubecause it is the same behaviour as before Commit27af930e.
Quoted 8 lines
Quoted 5 lines
Splitting that pair and using either cpu or splcpu depending on whether building SPL or not should only happen when the CPU field is actually used, not fetched.
Can you try and provide a v2 patch (set) along these lines?
Sorry, I cannot understand what you mean.
I do understand that your patch wants to restore the behavior prior to 27af930e.
My problem is, while things worked prior to 27af930e, they were not done the right way, because boards_by_<field>() functions should not depend on the fact that a field contains a colon or not; they should only depend on the fact that fields are space-separated.
IOW, target integratorcp_cm1136 on line 46 in boards.cfg has 9 fields, and its CPU field is "arm1136"; and line 348, dalmore, *also* has 9 fields even though its CPU field is "armv7:arm720t".
The way the code is written now, board_by_field() has to do the job of board_by_cpu() and has to know the CPU field has colon-separated subfields. What should be done is, board_by_field should not even worry about colons at all, and it is board_by_cpu() which should know about CPU dubfields and treat them properly.
Is this clearer?
Quoted 3 lines
Best Regards
Masahiro Yamada
Amicalement,
Signature · 1 line
Albert.
PATCH 3/3 MAKEALL: fix boards_by_field function
Hello Albert.
Quoted 7 lines
The way the code is written now,
board_by_field()has to do the job ofboard_by_cpu()and has to know the CPU field has colon-separated subfields. What should be done is,board_by_fieldshould not even worry about colons at all, and it isboard_by_cpu()which should know about CPU dubfields and treat them properly.Is this clearer?
OK. It's clear now.
I re-wrote like follows:
boards_by_field()
{
field=$1
regexp=$2
awk '($1 !~ /^#/ && $'"$field"' ~ /^'"$regexp"'$/) { print $7 }' \
boards.cfg
}boards_by_arch() { boards_by_field 2 "$@" ; }boards_by_cpu() { boards_by_field 3 "$@" ; boards_by_field 3 "$@:.*" ; } boards_by_soc() { boards_by_field 4 "$@" ; }
Is this good enough?
BTW, I think these function names are misleading.
We want to get the 7th field (Target),
not 6th field (Board Name) of boards.cfg
by these functions.
So I think we should rename
s/boards_by_field/targets_by_field/
s/boards_by_arch/targets_by_arch/
s/boards_by_cpu/targets_by_cpu/
s/boards_by_soc/targets_by_soc/
Best Regards
Masahiro Yamada
PATCH 3/3 MAKEALL: fix boards_by_field function
In reply to Albert ARIBAUDHello Albert.
Quoted 9 lines
The way the code is written now,
board_by_field()has to do the job ofboard_by_cpu()and has to know the CPU field has colon-separated subfields. What should be done is,board_by_fieldshould not even worry about colons at all, and it isboard_by_cpu()which should know about CPU dubfields and treat them properly.Is this clearer?
I posted v2.
Best Regards
Masahiro Yamada