Suppressing Diagnostic Output for 'fw_setenv'
The u-boot companion command line tool 'fw_setenv' emits verbose output during a set operation of the form:
Unlocking flash...
Done
Erasing old environment...
Done
Writing environment to /dev/mtd4...
Done
Locking ...
Done
While this is nice for debugging and troubleshooting, it is a bit verbose in a production environment. I propose two alternatives for suppressing this output:
1) Compile-time: Change 'printf' to 'debug' in which case the above diagnostics will only be output when the tool is built with 'DEBUG' asserted.
2) Run-time: Change the implementation such that the invocation usage of 'fw_setenv' is:
Usage: fw_setenv [ -q ] name [ value ... ]
I'd favor (2); however, I welcome strong opinions one way or another before I submit a patch.
Regards,
Grant
Dear Grant,
Quoted 11 lines · Grant Erickson
The u-boot companion command line tool '
fw_setenv' emits verbose output during a set operation of the form:Unlocking flash...
Done
Erasing old environment...
Done
Writing environment to/dev/mtd4...
Done
Locking ...
Done
I'm all with you.
Quoted 8 lines
While this is nice for debugging and troubleshooting, it is a bit verbose in a production environment. I propose two alternatives for suppressing this output:
1) Compile-time: Change 'printf' to 'debug' in which case the above diagnostics will only be output when the tool is built with 'DEBUG' asserted.
Quoted 7 lines
2) Run-time: Change the implementation such that the invocation usage of '
fw_setenv' is:Usage:
fw_setenv[ -q ] name [ value ... ]I'd favor (2); however, I welcome strong opinions one way or another before I submit a patch.
I'd prefer (2) too, but I'd make it quiet by default:
Usage: fw_setenv [ -v ] name [ value ... ]
Best regards
Markus
Signature · 3 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de")
PATCH 1/1 Suppressing Diagnostic Output for 'fw_setenv'
In reply to Grant EricksonAdded support for a ``-v'' option for fw_setenv to explicitly enable what was formerly default verbose diagnostic output when updating the environment.
--- tools/env/fw_env.c | 43 +++++++++++++++++++++++++++++-------------- tools/env/fw_env_main.c | 4 +++- 2 files changed, 32 insertions(+), 15 deletions(-)
tools/env/fw_env_main.c +3 -1
@@ -30,13 +30,15 @@* "name", the ``name=value'' pairs of one or more * environment variables "name", or the whole * environment if no names are specified. -* fw_setenv name [ value ... ] +* fw_setenv [ -v ] name [ value ... ] * - If a name without any values is given, the variable * with this name is deleted from the environment; * otherwise, all "value" arguments are concatenated, * separated by single blank characters, and the * resulting string is assigned to the environment * variable "name" +* - With the ``-v''option asserted, verbose progress is +* displayed as the environment is updated. */ #include <stdio.h>
tools/env/fw_env.c +29 -14
132 lines not on this page · raw message
Signature · 1 line
1.6.0
PATCH 1/1 Suppressing Diagnostic Output for 'fw_setenv'
Quoted 5 lines · Grant Erickson
Added support for a ``-v'' option for
fw_setenvto explicitly enable what was formerly default verbose diagnostic output when updating the environment.Signed-off-by Grant Erickson <[email protected]>
Best regards
Markus Klotzbuecher
Signature · 3 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de")
PATCH 1/1 Suppressing Diagnostic Output for 'fw_setenv'
In reply to Grant EricksonDear Grant Erickson,
Quoted 9 lines · In message <[email protected]> you…
Added support for a ``-v'' option for
fw_setenvto explicitly enable what was formerly default verbose diagnostic output when updating the environment.Signed-off-by Grant Erickson <[email protected]>--- tools/env/fw_env.c | 43 +++++++++++++++++++++++++++++-------------- tools/env/fw_env_main.c | 4 +++- 2 files changed, 32 insertions(+), 15 deletions(-)
I will not apply this patch for now, as I expect that Guennadi will address this issue in his rewrite of the fw_setenv command when adding NAND support.
Please check again and resubmit (if still needed) later (affter Guennadi's patch went in).
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Make it right before you make it faster.
PATCH 1/1 Suppressing Diagnostic Output for 'fw_setenv'
Quoted 13 lines · Wolfgang Denk
Dear Grant Erickson,
Quoted 9 lines · In message <[email protected]> you…
Added support for a ``-v'' option for
fw_setenvto explicitly enable what was formerly default verbose diagnostic output when updating the environment.Signed-off-by Grant Erickson <[email protected]>--- tools/env/fw_env.c | 43 +++++++++++++++++++++++++++++-------------- tools/env/fw_env_main.c | 4 +++- 2 files changed, 32 insertions(+), 15 deletions(-)
Quoted 6 lines
I will not apply this patch for now, as I expect that Guennadi will address this issue in his rewrite of the
fw_setenvcommand when adding NAND support.Please check again and resubmit (if still needed) later (affter Guennadi's patch went in).
In my last patch version (v2, submitted last Thursday, 4 Sep), I put all debugging output in "#ifdef DEBUG" blocks. So, if this patch is accepted in its current form, you will have to look at those ifdef's and see which of them you want to make dynamically selectable per '-v' switch.
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de