Message ID | c2d1dde15556837c61f940f470225aec2bb0e25c.1547558364.git.michal.simek@xilinx.com |
---|---|
State | Deferred |
Delegated to: | Michal Simek |
Headers | show |
Series | [U-Boot,1/3] tools: zynqimage: Align image_size/image_stored_size | expand |
On 15. 01. 19 14:19, Michal Simek wrote: > Bootrom is not capable to work with non aligned bootloader sizes. > SPL with OF_SEPARATE generates non-align images quite often that's > why this change is required before OF_SEPARATE enableding. > > Signed-off-by: Michal Simek <michal.simek@xilinx.com> > --- > > tools/zynqmpbif.c | 4 ++-- > tools/zynqmpimage.c | 1 + > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/tools/zynqmpbif.c b/tools/zynqmpbif.c > index a33c15e1f018..8c47107c7b94 100644 > --- a/tools/zynqmpbif.c > +++ b/tools/zynqmpbif.c > @@ -425,8 +425,8 @@ static int bif_add_part(struct bif_entry *bf, const char *data, size_t len) > if (!bif_output.header->image_offset) > bif_output.header->image_offset = > cpu_to_le32(bf->offset); > - bif_output.header->image_size = cpu_to_le32(len); > - bif_output.header->image_stored_size = cpu_to_le32(len); > + bif_output.header->image_size = cpu_to_le32(len_padded); > + bif_output.header->image_stored_size = cpu_to_le32(len_padded); > > bif_output.header->image_attributes &= ~HEADER_CPU_SELECT_MASK; > switch (bf->dest_cpu) { > diff --git a/tools/zynqmpimage.c b/tools/zynqmpimage.c > index 19b2f02ff150..67032aa7b23c 100644 > --- a/tools/zynqmpimage.c > +++ b/tools/zynqmpimage.c > @@ -411,6 +411,7 @@ static void zynqmpimage_set_header(void *ptr, struct stat *sbuf, int ifd, > cpu_to_le32((uint32_t)sizeof(struct zynqmp_header)); > zynqhdr->image_size = cpu_to_le32(params->file_size - > sizeof(struct zynqmp_header)); > + zynqhdr->image_size = ROUND(zynqhdr->image_size, 4); > zynqhdr->image_stored_size = zynqhdr->image_size; > zynqhdr->image_load = 0xfffc0000; > if (params->eflag) > Please ignore this part of the patch. I will do this differently with aligning input file. Thanks, Michal
diff --git a/tools/zynqmpbif.c b/tools/zynqmpbif.c index a33c15e1f018..8c47107c7b94 100644 --- a/tools/zynqmpbif.c +++ b/tools/zynqmpbif.c @@ -425,8 +425,8 @@ static int bif_add_part(struct bif_entry *bf, const char *data, size_t len) if (!bif_output.header->image_offset) bif_output.header->image_offset = cpu_to_le32(bf->offset); - bif_output.header->image_size = cpu_to_le32(len); - bif_output.header->image_stored_size = cpu_to_le32(len); + bif_output.header->image_size = cpu_to_le32(len_padded); + bif_output.header->image_stored_size = cpu_to_le32(len_padded); bif_output.header->image_attributes &= ~HEADER_CPU_SELECT_MASK; switch (bf->dest_cpu) { diff --git a/tools/zynqmpimage.c b/tools/zynqmpimage.c index 19b2f02ff150..67032aa7b23c 100644 --- a/tools/zynqmpimage.c +++ b/tools/zynqmpimage.c @@ -411,6 +411,7 @@ static void zynqmpimage_set_header(void *ptr, struct stat *sbuf, int ifd, cpu_to_le32((uint32_t)sizeof(struct zynqmp_header)); zynqhdr->image_size = cpu_to_le32(params->file_size - sizeof(struct zynqmp_header)); + zynqhdr->image_size = ROUND(zynqhdr->image_size, 4); zynqhdr->image_stored_size = zynqhdr->image_size; zynqhdr->image_load = 0xfffc0000; if (params->eflag)
Bootrom is not capable to work with non aligned bootloader sizes. SPL with OF_SEPARATE generates non-align images quite often that's why this change is required before OF_SEPARATE enableding. Signed-off-by: Michal Simek <michal.simek@xilinx.com> --- tools/zynqmpbif.c | 4 ++-- tools/zynqmpimage.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)