[3/3] lib: Allow hexdump to be used in SPL

Message ID 20200506140357.32050-3-sjg@chromium.org
State New
Headers show
Series
  • [1/3] log: Allow LOG_DEBUG to always enable log output
Related show

Commit Message

Simon Glass May 6, 2020, 2:03 p.m.
It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 lib/Kconfig  | 6 ++++++
 lib/Makefile | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Stefan Roese May 6, 2020, 3:11 p.m. | #1
On 06.05.20 16:03, Simon Glass wrote:
> It is sometimes useful to output hex dumps in SPL. Add a config option to
> allow this.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>

Reviewed-by: Stefan Roese <sr at denx.de>

Thanks,
Stefan

> ---
> 
>   lib/Kconfig  | 6 ++++++
>   lib/Makefile | 2 +-
>   2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/Kconfig b/lib/Kconfig
> index c3f694afc0..df052e1d59 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -491,6 +491,12 @@ config HEXDUMP
>   	help
>   	  This enables functions for printing dumps of binary data.
>   
> +config SPL_HEXDUMP
> +	bool "Enable hexdump in SPL"
> +	help
> +	  This enables functions for printing dumps of binary data in
> +	  SPL.
> +
>   config OF_LIBFDT
>   	bool "Enable the FDT library"
>   	default y if OF_CONTROL
> diff --git a/lib/Makefile b/lib/Makefile
> index 6e688afa68..a022fb9455 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -104,7 +104,7 @@ obj-$(CONFIG_REGEX) += slre.o
>   obj-y += string.o
>   obj-y += tables_csum.o
>   obj-y += time.o
> -obj-y += hexdump.o
> +obj-$(CONFIG_$(SPL_)HEXDUMP) += hexdump.o
>   obj-$(CONFIG_TRACE) += trace.o
>   obj-$(CONFIG_LIB_UUID) += uuid.o
>   obj-$(CONFIG_LIB_RAND) += rand.o
> 


Viele Gr??e,
Stefan
Tom Rini May 15, 2020, 6:17 p.m. | #2
On Wed, May 06, 2020 at 08:03:57AM -0600, Simon Glass wrote:

> It is sometimes useful to output hex dumps in SPL. Add a config option to
> allow this.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> Reviewed-by: Stefan Roese <sr at denx.de>
> ---
> 
>  lib/Kconfig  | 6 ++++++
>  lib/Makefile | 2 +-
>  2 files changed, 7 insertions(+), 1 deletion(-)

This breaks some platforms such as:
       arm:  +   am335x_evm
+(am335x_evm) arm-linux-gnueabi-ld.bfd: lib/built-in.o: in function `efi_set_variable_common':
+(am335x_evm) lib/efi_loader/efi_variable.c:1077: undefined reference to `hex_asc'
+(am335x_evm) arm-linux-gnueabi-ld.bfd: lib/built-in.o: in function `vsnprintf_internal':
+(am335x_evm) lib/vsprintf.c:697: undefined reference to `hex_asc'
+(am335x_evm) make[1]: *** [u-boot] Error 1
+(am335x_evm) make: *** [sub-make] Error 2

Patch

diff --git a/lib/Kconfig b/lib/Kconfig
index c3f694afc0..df052e1d59 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -491,6 +491,12 @@  config HEXDUMP
 	help
 	  This enables functions for printing dumps of binary data.
 
+config SPL_HEXDUMP
+	bool "Enable hexdump in SPL"
+	help
+	  This enables functions for printing dumps of binary data in
+	  SPL.
+
 config OF_LIBFDT
 	bool "Enable the FDT library"
 	default y if OF_CONTROL
diff --git a/lib/Makefile b/lib/Makefile
index 6e688afa68..a022fb9455 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -104,7 +104,7 @@  obj-$(CONFIG_REGEX) += slre.o
 obj-y += string.o
 obj-y += tables_csum.o
 obj-y += time.o
-obj-y += hexdump.o
+obj-$(CONFIG_$(SPL_)HEXDUMP) += hexdump.o
 obj-$(CONFIG_TRACE) += trace.o
 obj-$(CONFIG_LIB_UUID) += uuid.o
 obj-$(CONFIG_LIB_RAND) += rand.o