[U-Boot] [PATCH v3 3/7] dfu: Remove dependency on HUSH parser in SPL

Lukasz Majewski lukma at denx.de
Tue Jan 22 22:43:33 UTC 2019


On Thu, 17 Jan 2019 13:43:04 -0600
"Andrew F. Davis" <afd at ti.com> wrote:

> CLI support with the HUSH parser is not currently SPL safe due to it's
> use of realloc. That function is not defined for SPLs that use
> SYS_MALLOC_SIMPLE. CLI support can be built in to SPL and some
> functions do work, but use of some like run_command() will cause
> build to fail. When no SPL code calls this function build works as
> the compiler removes this unreachable code so the unresolved symbols
> are ignored.
> 
> If DFU support is enabled in SPL then MMU DFU support may get brought
> in also, this code does make a call to run_command() causing build to
> fail if the HUSH parser is not built-in. To break this odd and
> unneeded dependency chain we use CONFIG_IS_ENABLED where appropriate
> to prevent calls into HUSH code from SPL. This also removes our need
> to pull in the rather unrelated source file when SPL_DFU is defined.
> 

If I remember correctly the HUSH was _required_ by TI to be able to use
DFU in SPL (and that was a rationale to add it to SPL - which IMHO was
wrong from the outset).

What has changed that it is not needed anymore?

> Signed-off-by: Andrew F. Davis <afd at ti.com>
> Reviewed-by: Tom Rini <trini at konsulko.com>
> ---
>  common/Makefile | 1 -
>  common/cli.c    | 2 +-
>  2 files changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/common/Makefile b/common/Makefile
> index 3711016505..ad390d083a 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -67,7 +67,6 @@ ifdef CONFIG_SPL_BUILD
>  ifdef CONFIG_SPL_DFU
>  obj-$(CONFIG_DFU_OVER_USB) += dfu.o
>  endif
> -obj-$(CONFIG_SPL_DFU) += cli_hush.o
>  obj-$(CONFIG_SPL_HASH_SUPPORT) += hash.o
>  obj-$(CONFIG_TPL_HASH_SUPPORT) += hash.o
>  obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o
> diff --git a/common/cli.c b/common/cli.c
> index 51b8d5f85c..fea8f8004c 100644
> --- a/common/cli.c
> +++ b/common/cli.c
> @@ -27,7 +27,7 @@ DECLARE_GLOBAL_DATA_PTR;
>   */
>  int run_command(const char *cmd, int flag)
>  {
> -#ifndef CONFIG_HUSH_PARSER
> +#if !CONFIG_IS_ENABLED(HUSH_PARSER)
>  	/*
>  	 * cli_run_command can return 0 or 1 for success, so clean up
>  	 * its result.




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190122/49ee04f2/attachment.sig>


More information about the U-Boot mailing list