common: fit: unify fit image align size
Set 512 as default align size in order to access any image by block unit. Signed-off-by: Joseph Chen <chenjh@rock-chips.com> Change-Id: I372ca7ff567816cb8369aff9d1fbe9865fa6d933
This commit is contained in:
parent
c15f307504
commit
acd4329027
|
@ -62,7 +62,7 @@ void *locate_dtb_in_fit(const void *fit)
|
|||
int ret;
|
||||
|
||||
size = fdt_totalsize(fit);
|
||||
size = (size + 3) & ~3;
|
||||
size = FIT_ALIGN(size);
|
||||
|
||||
header = (struct image_header *)fit;
|
||||
|
||||
|
|
|
@ -850,7 +850,7 @@ int fit_image_get_data(const void *fit, int noffset,
|
|||
fit_image_get_data_size(fit, noffset, &data_sz);
|
||||
if (data_sz) {
|
||||
data_off += (ulong)fit;
|
||||
data_off += round_up(fdt_totalsize(fit), 4);
|
||||
data_off += FIT_ALIGN(fdt_totalsize(fit));
|
||||
*data = (void *)data_off;
|
||||
*size = data_sz;
|
||||
return 0;
|
||||
|
|
|
@ -359,8 +359,8 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
|
|||
* image.
|
||||
*/
|
||||
size = fdt_totalsize(fit);
|
||||
size = (size + 3) & ~3;
|
||||
base_offset = (size + 3) & ~3;
|
||||
size = FIT_ALIGN(size);
|
||||
base_offset = FIT_ALIGN(size);
|
||||
|
||||
/*
|
||||
* So far we only have one block of data from the FIT. Read the entire
|
||||
|
|
|
@ -358,7 +358,7 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr)
|
|||
|
||||
/* Align data offset to 4-byte boundrary */
|
||||
fit_size = fdt_totalsize(fit_header);
|
||||
fit_size = (fit_size + 3) & ~3;
|
||||
fit_size = FIT_ALIGN(fit_size);
|
||||
|
||||
/* Read in the splash data */
|
||||
location->offset = (location->offset + fit_size + splash_offset);
|
||||
|
|
|
@ -921,6 +921,12 @@ int bootz_setup(ulong image, ulong *start, ulong *end);
|
|||
#define FIT_MAX_HASH_LEN HASH_MAX_DIGEST_SIZE
|
||||
|
||||
#if IMAGE_ENABLE_FIT
|
||||
|
||||
#ifndef IMAGE_ALIGN_SIZE
|
||||
#define IMAGE_ALIGN_SIZE 512
|
||||
#endif
|
||||
#define FIT_ALIGN(x) (((x)+IMAGE_ALIGN_SIZE-1)&~(IMAGE_ALIGN_SIZE-1))
|
||||
|
||||
/* cmdline argument format parsing */
|
||||
int fit_parse_conf(const char *spec, ulong addr_curr,
|
||||
ulong *addr, const char **conf_name);
|
||||
|
|
|
@ -460,7 +460,7 @@ static int fit_extract_data(struct image_tool_params *params, const char *fname)
|
|||
}
|
||||
fdt_setprop_u32(fdt, node, "data-size", len);
|
||||
|
||||
buf_ptr += (len + 3) & ~3;
|
||||
buf_ptr += FIT_ALIGN(len);
|
||||
}
|
||||
|
||||
/* Pack the FDT and place the data after it */
|
||||
|
@ -469,7 +469,7 @@ static int fit_extract_data(struct image_tool_params *params, const char *fname)
|
|||
debug("Size reduced from %x to %x\n", fit_size, fdt_totalsize(fdt));
|
||||
debug("External data size %x\n", buf_ptr);
|
||||
new_size = fdt_totalsize(fdt);
|
||||
new_size = (new_size + 3) & ~3;
|
||||
new_size = FIT_ALIGN(new_size);
|
||||
munmap(fdt, sbuf.st_size);
|
||||
|
||||
if (ftruncate(fd, new_size)) {
|
||||
|
@ -528,7 +528,7 @@ static int fit_import_data(struct image_tool_params *params, const char *fname)
|
|||
if (fd < 0)
|
||||
return -EIO;
|
||||
fit_size = fdt_totalsize(old_fdt);
|
||||
data_base = (fit_size + 3) & ~3;
|
||||
data_base = FIT_ALIGN(fit_size);
|
||||
|
||||
/* Allocate space to hold the new FIT */
|
||||
size = sbuf.st_size + 16384;
|
||||
|
|
Loading…
Reference in New Issue