Hi Jean-Jacques, On Thu, 23 May 2019 at 11:39, Jean-Jacques Hiblot <jjhib...@ti.com> wrote: > > If the node describing an overlay does not specify a load address, it will > be loaded at the address previously used. > Fixing it by allocating a temporary 64kB region that will be used as a > default load address. > > Signed-off-by: Jean-Jacques Hiblot <jjhib...@ti.com> > --- > > Changes in v3: None > Changes in v2: None > > common/spl/spl_fit.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c > index c1c982f002..b521ee68e6 100644 > --- a/common/spl/spl_fit.c > +++ b/common/spl/spl_fit.c > @@ -9,6 +9,7 @@ > #include <fpga.h> > #include <image.h> > #include <linux/libfdt.h>
should go at end > +#include <malloc.h> > #include <spl.h> > > #ifndef CONFIG_SYS_BOOTM_LEN > @@ -302,6 +303,16 @@ static int spl_fit_append_fdt(struct spl_image_info > *spl_image, > spl_image->fdt_addr = (void *)image_info.load_addr; > #if !CONFIG_IS_ENABLED(FIT_IMAGE_TINY) > #if defined(CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY) > + void *tmpbuffer; > + /* > + * allocate 64kB of memory. This will be used to store the DT overlay 64KB > + * before it is applied. It may not be used depending on how the > + * overlay is stored. > + */ > + tmpbuffer = malloc(64 * 1024); > + if (!tmpbuffer) > + debug("%s: unable to allocate space for overlays\n", > __func__); Need to return an error here I think > + > for (; ; index++) { > node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, > index); > if (node < 0) { > @@ -309,6 +320,7 @@ static int spl_fit_append_fdt(struct spl_image_info > *spl_image, > return 0; > } > > + image_info.load_addr = (ulong)tmpbuffer; > ret = spl_load_fit_image(info, sector, fit, base_offset, node, > &image_info); > if (ret < 0) > @@ -327,6 +339,8 @@ static int spl_fit_append_fdt(struct spl_image_info > *spl_image, > debug("%s: DT overlay %s applied\n", __func__, > fit_get_name(fit, node, NULL)); > } > + if (tmpbuffer) > + free(tmpbuffer); Is this buffer freed if there is an error? > #endif > /* Try to make space, so we can inject details on the loadables */ > ret = fdt_shrink_to_minimum(spl_image->fdt_addr, 8192); > -- > 2.17.1 > Regards, Simon _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot