[U-Boot] [PATCH 3/3] MAKEALL: fix boards_by_field function
Masahiro Yamada
yamada.m at jp.panasonic.com
Fri Oct 18 08:37:57 CEST 2013
Hello Albert.
> 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?
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
More information about the U-Boot
mailing list