Re: [U-Boot] [PATCH v2 4/5] spl: fit: Support both external and embedded data

2017-08-14 Thread York Sun
On 08/13/2017 02:35 PM, Simon Glass wrote:
> Hi York,
> 
> On 7 August 2017 at 17:16, York Sun  wrote:
>> SPL supports U-Boot image in FIT format which has data outside of
>> FIT structure. This adds support for embedded data for normal FIT
>> images.
>>
>> Signed-off-by: York Sun 
>>
>> ---
>>
>> Changes in v2:
>> Rebase on top of "SPL: FIT: factor out spl_load_fit_image()" by Andre 
>> Przywara
>>
>>   common/spl/spl_fit.c | 52 
>> +---
>>   1 file changed, 33 insertions(+), 19 deletions(-)
>>
> 
> There is some docs here:
> 
> doc/uImage.FIT/source_file_format.txt
> 
> I feel that what you have here should be documented in some way,
> associated with SPL. Any ideas?

Yes. That's my plan. I have been waiting for Andre to comment on the 
priority of "kervel" vs "firmware". I believe it makes sense to favor 
"kernel" when falcon boot is enabled. The U-Boot image shouldn't contain 
"kernel" node in falcon boot scenario. Or it can be changed to 
"standalone" as Andre did for U-Boot image (to favor "loadables").

York
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 4/5] spl: fit: Support both external and embedded data

2017-08-13 Thread Simon Glass
Hi York,

On 7 August 2017 at 17:16, York Sun  wrote:
> SPL supports U-Boot image in FIT format which has data outside of
> FIT structure. This adds support for embedded data for normal FIT
> images.
>
> Signed-off-by: York Sun 
>
> ---
>
> Changes in v2:
> Rebase on top of "SPL: FIT: factor out spl_load_fit_image()" by Andre Przywara
>
>  common/spl/spl_fit.c | 52 
> +---
>  1 file changed, 33 insertions(+), 19 deletions(-)
>

There is some docs here:

doc/uImage.FIT/source_file_format.txt

I feel that what you have here should be documented in some way,
associated with SPL. Any ideas?

> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> index 23f85d2..0de4f40 100644
> --- a/common/spl/spl_fit.c
> +++ b/common/spl/spl_fit.c
> @@ -128,13 +128,15 @@ static int spl_load_fit_image(struct spl_load_info 
> *info, ulong sector,
>   void *fit, ulong base_offset, int node,
>   struct spl_image_info *image_info)
>  {
> -   ulong offset;
> +   int offset;
> size_t length;
> +   int len;
> ulong load_addr, load_ptr;
> void *src;
> ulong overhead;
> int nr_sectors;
> int align_len = ARCH_DMA_MINALIGN - 1;
> +   const void *data;
>  #if defined(CONFIG_SPL_OS_BOOT) && defined(CONFIG_SPL_GZIP)
> uint8_t image_comp, type;
>
> @@ -149,28 +151,40 @@ static int spl_load_fit_image(struct spl_load_info 
> *info, ulong sector,
> debug("%s ", genimg_get_type_name(type));
>  #endif
>
> -   offset = fdt_getprop_u32(fit, node, "data-offset");
> -   if (offset == FDT_ERROR)
> -   return -ENOENT;
> -   offset += base_offset;
> -   length = fdt_getprop_u32(fit, node, "data-size");
> -   if (length == FDT_ERROR)
> -   return -ENOENT;
> -   load_addr = fdt_getprop_u32(fit, node, "load");
> -   if (load_addr == FDT_ERROR && image_info)
> +   if (fit_image_get_load(fit, node, _addr))
> load_addr = image_info->load_addr;
> -   load_ptr = (load_addr + align_len) & ~align_len;
>
> -   overhead = get_aligned_image_overhead(info, offset);
> -   nr_sectors = get_aligned_image_size(info, length, offset);
> +   if (!fit_image_get_data_offset(fit, node, )) {
> +   /* External data */
> +   offset += base_offset;
> +   if (fit_image_get_data_size(fit, node, ))
> +   return -ENOENT;
>
> -   if (info->read(info, sector + get_aligned_image_offset(info, offset),
> -  nr_sectors, (void*)load_ptr) != nr_sectors)
> -   return -EIO;
> -   debug("image dst=%lx, offset=%lx, size=%lx\n", load_ptr, offset,
> - (unsigned long)length);
> +   load_ptr = (load_addr + align_len) & ~align_len;
> +   length = len;
> +
> +   overhead = get_aligned_image_overhead(info, offset);
> +   nr_sectors = get_aligned_image_size(info, length, offset);
> +
> +   if (info->read(info,
> +  sector + get_aligned_image_offset(info, 
> offset),
> +  nr_sectors, (void *)load_ptr) != nr_sectors)
> +   return -EIO;
> +
> +   debug("External data: dst=%lx, offset=%x, size=%lx\n",
> + load_ptr, offset, (unsigned long)length);
> +   src = (void *)load_ptr + overhead;
> +   } else {
> +   /* Embedded data */
> +   if (fit_image_get_data(fit, node, , )) {
> +   puts("Cannot get image data/size\n");
> +   return -ENOENT;
> +   }
> +   debug("Embedded data: dst=%lx, size=%lx\n", load_addr,
> + (unsigned long)length);
> +   src = (void *)data;
> +   }
>
> -   src = (void *)load_ptr + overhead;
>  #ifdef CONFIG_SPL_FIT_IMAGE_POST_PROCESS
> board_fit_image_post_process(, );
>  #endif
> --
> 2.7.4
>

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 4/5] spl: fit: Support both external and embedded data

2017-08-09 Thread Tom Rini
On Mon, Aug 07, 2017 at 04:16:25PM -0700, York Sun wrote:

> SPL supports U-Boot image in FIT format which has data outside of
> FIT structure. This adds support for embedded data for normal FIT
> images.
> 
> Signed-off-by: York Sun 
> 

Reviewed-by: Tom Rini 

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot