summaryrefslogtreecommitdiff
path: root/tools/zynqmpbif.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-01-24 10:47:05 -0500
committerTom Rini <trini@konsulko.com>2019-01-24 10:47:05 -0500
commitce0d1e48165fdd3bde4bb431f1d2e100b1617a6e (patch)
tree8b30f2052d732ae7cfae221be6a9287f87e1de78 /tools/zynqmpbif.c
parentaff66f22d6eeb27c6329c0a3c1ebc52914c8affa (diff)
parent4efdbc88b79bd8bd3e285cd238e1942d669a7088 (diff)
Merge tag 'xilinx-for-v2019.04' of git://git.denx.de/u-boot-microblaze
Xilinx changes for v2019.04 tools: - Fix zynqmpimage generation zynq: - Some configs/Kconfig/DT updates - Enable REMAKE_ELF and OF_SEPARATE - Topic boards update - i2c cleanups and conversion to DM_I2C zynqmp: - Some configs/Kconfig/DT updates - Board config cleanup - Move arch folder to mach-zynqmp versal: - Enable DM_I2C, CMD_DM zynq-gem: - Fix driver cache handling i2c: - Live tree simple update phy: - Fixed phy cleanup travis: - Wire Versal SoC
Diffstat (limited to 'tools/zynqmpbif.c')
-rw-r--r--tools/zynqmpbif.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/tools/zynqmpbif.c b/tools/zynqmpbif.c
index 6c8f66055d..8c47107c7b 100644
--- a/tools/zynqmpbif.c
+++ b/tools/zynqmpbif.c
@@ -319,16 +319,25 @@ static int bif_add_pmufw(struct bif_entry *bf, const char *data, size_t len)
static int bif_add_part(struct bif_entry *bf, const char *data, size_t len)
{
size_t parthdr_offset = 0;
+ size_t len_padded = ROUND(len, 4);
+
struct partition_header parthdr = {
- .len_enc = cpu_to_le32(len / 4),
- .len_unenc = cpu_to_le32(len / 4),
- .len = cpu_to_le32(len / 4),
+ .len_enc = cpu_to_le32(len_padded / 4),
+ .len_unenc = cpu_to_le32(len_padded / 4),
+ .len = cpu_to_le32(len_padded / 4),
.entry_point = cpu_to_le64(bf->entry),
.load_address = cpu_to_le64(bf->load),
};
int r;
uint32_t csum;
+ if (len < len_padded) {
+ char *newdata = malloc(len_padded);
+ memcpy(newdata, data, len);
+ memset(newdata + len, 0, len_padded - len);
+ data = newdata;
+ }
+
if (bf->flags & (1ULL << BIF_FLAG_PMUFW_IMAGE))
return bif_add_pmufw(bf, data, len);
@@ -416,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) {