Get only the first CONFIG_ENV_SECT_SIZE#815
Get only the first CONFIG_ENV_SECT_SIZE#815amdrsantos wants to merge 1 commit intoopencomputeproject:masterfrom
Conversation
|
Hi - thanks for pointing this issue out, and the pull request makes it a lot clearer what the code would look like. |
|
Hmm. For a minor change, there's a surprising amount of corner cases. `if [ -z "$env_sector_size" ] ; then $(echo "$env_sector_define" | wc -l ) times in $MACHINE_CONFIG. $env_sector_define" |
|
I would include one more test, for the case that grep returns no results: `if [ -z "$env_sector_size" ] ; then fi ` I am working on a Linux debian9x64bit 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 GNU/Linux. The platform I am tring to integrated is similar to Accton AS6700-32X, can not disclosure yet. |
|
Nice catch on the empty value. I'd have thought the wc would have reported 0, but of course it's counting lines. |
In the u-boot, some platforms configs have the "CONFIG_ENV_SECT_SIZE" referenced more than once in its .h.
This can causes the "build-config/scripts/onie-mk-bin.sh" to fail.
In my use case:
++ grep CONFIG_ENV_SECT_SIZE /home/build/src/onie/build/_-r0/u-boot/u-boot-2013.01.01/include/configs/.h
++ awk '{print $3}'
(CONFIG_SYS_MONITOR_BASE
"\0"'
/home/build/src/onie/build-config/scripts/onie-mk-bin.sh: line 80: 0x20000
(CONFIG_SYS_MONITOR_BASE
"\0" + 0 : syntax error in expression (error token is "(CONFIG_SYS_MONITOR_BASE
"\0" + 0 ")
(CONFIG_SYS_MONITOR_BASE
"\0"' = '' ']'
(CONFIG_SYS_MONITOR_BASE
"\0"' = 0 ']'
Therefore I suggest adding the "-m 1" parameter to grep, in order to get only the first match.
Cheers,
Alex