Message ID | 20190820140932.17912-1-igor.opaniuk@gmail.com |
---|---|
State | Changes Requested |
Delegated to: | Stefano Babic |
Headers | show |
Series | [U-Boot,v1] common: fix building image.c | expand |
On Tue, Aug 20, 2019 at 5:09 PM Igor Opaniuk <igor.opaniuk@gmail.com> wrote: > > From: Igor Opaniuk <igor.opaniuk@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@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 */ > > int fit_get_node_from_config(bootm_headers_t *images, const char *prop_name, > ulong addr) > @@ -1771,6 +1773,7 @@ int fit_get_node_from_config(bootm_headers_t *images, const char *prop_name, > return noffset; > } > > +#ifndef USE_HOSTCC > /** > * fit_get_image_type_property() - get property name for IH_TYPE_... > * > @@ -2010,6 +2013,7 @@ int fit_image_load(bootm_headers_t *images, ulong addr, > } else { > loadbuf = map_sysmem(load, max_decomp_len); > } > + > if (image_decomp(comp, load, data, image_type, > loadbuf, buf, len, max_decomp_len, &load_end)) { > printf("Error decompressing %s\n", prop_name); > @@ -2065,7 +2069,6 @@ int boot_get_setup_fit(bootm_headers_t *images, uint8_t arch, > return ret; > } > > -#ifndef USE_HOSTCC > int boot_get_fdt_fit(bootm_headers_t *images, ulong addr, > const char **fit_unamep, const char **fit_uname_configp, > int arch, ulong *datap, ulong *lenp) > diff --git a/common/image.c b/common/image.c > index e94bbcf108..27a412e2c8 100644 > --- a/common/image.c > +++ b/common/image.c > @@ -384,6 +384,7 @@ void image_print_contents(const void *ptr) > } > } > > +#ifndef USE_HOSTCC > /** > * print_decomp_msg() - Print a suitable decompression/loading message > * > @@ -484,8 +485,6 @@ int image_decomp(int comp, ulong load, ulong image_start, int type, > return ret; > } > > - > -#ifndef USE_HOSTCC > #if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT) > /** > * image_get_ramdisk - get and verify ramdisk image > -- > 2.17.1 > JFYI: This is actual only for u-boot-imx custodian tree (which is broken), patch that brakes the build hasn't been pulled to u-boot/master yet.
On Tue, Aug 20, 2019 at 11:09 AM Igor Opaniuk <igor.opaniuk@gmail.com> wrote: > > From: Igor Opaniuk <igor.opaniuk@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@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,
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 */ int fit_get_node_from_config(bootm_headers_t *images, const char *prop_name, ulong addr) @@ -1771,6 +1773,7 @@ int fit_get_node_from_config(bootm_headers_t *images, const char *prop_name, return noffset; } +#ifndef USE_HOSTCC /** * fit_get_image_type_property() - get property name for IH_TYPE_... * @@ -2010,6 +2013,7 @@ int fit_image_load(bootm_headers_t *images, ulong addr, } else { loadbuf = map_sysmem(load, max_decomp_len); } + if (image_decomp(comp, load, data, image_type, loadbuf, buf, len, max_decomp_len, &load_end)) { printf("Error decompressing %s\n", prop_name); @@ -2065,7 +2069,6 @@ int boot_get_setup_fit(bootm_headers_t *images, uint8_t arch, return ret; } -#ifndef USE_HOSTCC int boot_get_fdt_fit(bootm_headers_t *images, ulong addr, const char **fit_unamep, const char **fit_uname_configp, int arch, ulong *datap, ulong *lenp) diff --git a/common/image.c b/common/image.c index e94bbcf108..27a412e2c8 100644 --- a/common/image.c +++ b/common/image.c @@ -384,6 +384,7 @@ void image_print_contents(const void *ptr) } } +#ifndef USE_HOSTCC /** * print_decomp_msg() - Print a suitable decompression/loading message * @@ -484,8 +485,6 @@ int image_decomp(int comp, ulong load, ulong image_start, int type, return ret; } - -#ifndef USE_HOSTCC #if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT) /** * image_get_ramdisk - get and verify ramdisk image