-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get only the first CONFIG_ENV_SECT_SIZE #815
base: master
Are you sure you want to change the base?
Get only the first CONFIG_ENV_SECT_SIZE #815
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