[U-Boot] [PATCH v1] common: fix building image.c

Ricardo Salveti rsalveti at rsalveti.net
Fri Aug 30 18:06:12 UTC 2019


On Tue, Aug 20, 2019 at 11:09 AM Igor Opaniuk <igor.opaniuk at gmail.com> wrote:
>
> From: Igor Opaniuk <igor.opaniuk at toradex.com>
>
> Wrap image_decomp() and all dependent functions with
> !ifdef(USE_HOSTCC) macro, as this function isn't used by
> any tool from /tools.
>
> Without this it leads to compilation issues (because of
> CONFIG_LZMA from newly added #include <generated/autoconf.h>
> statement, which pulls all these definitions):
>
> In file included from tools/common/image.c:1:0:
> ./tools/../common/image.c: In function ‘image_decomp’:
> ./tools/../common/image.c:428:9: warning: implicit declaration of function
> ‘gunzip’; did you mean ‘munmap’? [-Wimplicit-function-declaration]
>    ret = gunzip(load_buf, unc_len, image_buf, &image_len);
>          ^~~~~~
>          munmap
> ./tools/../common/image.c:450:3: error: unknown type name ‘SizeT’;
> did you mean ‘size_t’?
>    SizeT lzma_len = unc_len;
>    ^~~~~
>    size_t
> ./tools/../common/image.c:452:9: warning: implicit declaration of function
> ‘lzmaBuffToBuffDecompress’ [-Wimplicit-function-declaration]
>    ret = lzmaBuffToBuffDecompress(load_buf, &lzma_len,
>          ^~~~~~~~~~~~~~~~~~~~~~~~
> scripts/Makefile.host:114: recipe for target 'tools/common/image.o' failed
>
> Fixes: 2aa7f0fa51 ("habv4: tools: Avoid hardcoded CSF size for SPL target")
> Signed-off-by: Igor Opaniuk <igor.opaniuk at toradex.com>
> ---
>
>  common/image-fit.c | 5 ++++-
>  common/image.c     | 3 +--
>  2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/common/image-fit.c b/common/image-fit.c
> index 5c63c769de..72b19f889b 100644
> --- a/common/image-fit.c
> +++ b/common/image-fit.c
> @@ -1728,6 +1728,7 @@ int fit_conf_get_prop_node(const void *fit, int noffset,
>         return fit_conf_get_prop_node_index(fit, noffset, prop_name, 0);
>  }
>
> +#ifndef USE_HOSTCC
>  static int fit_image_select(const void *fit, int rd_noffset, int verify)
>  {
>         fit_image_print(fit, rd_noffset, "   ");
> @@ -1743,6 +1744,7 @@ static int fit_image_select(const void *fit, int rd_noffset, int verify)
>
>         return 0;
>  }
> +#endif /* USE_HOSTCC */

This will cause the build to fail when FIT is enabled:

tools/common/bootm.o: In function `bootm_host_load_images':
bootm.c:(.text+0xb4): undefined reference to `fit_image_load'
bootm.c:(.text+0x132): undefined reference to `image_decomp'
collect2: error: ld returned 1 exit status
scripts/Makefile.host:106: recipe for target 'tools/dumpimage' failed

Guess it is better to isolate the other individual pieces instead.

Cheers,
-- 
Ricardo Salveti de Araujo


More information about the U-Boot mailing list