]> git.baikalelectronics.ru Git - uboot.git/commit
tools: kwbimage: Fix calculating size of binary header
authorPali Rohár <pali@kernel.org>
Fri, 23 Jul 2021 09:14:08 +0000 (11:14 +0200)
committerStefan Roese <sr@denx.de>
Sat, 31 Jul 2021 07:49:31 +0000 (09:49 +0200)
commitb7ac532c75c316c1fff2e43a2c4d530033f53046
treebe88dcc00a9d38a33d930a0cdf86e2ca97657a4a
parent84f1290b9e9f6ac94bd19520466fde157d7e7d96
tools: kwbimage: Fix calculating size of binary header

Binary header consist of:
* 1 byte for header type
* 3 bytes for header size
* 1 byte for number of arguments
* 3 reserved bytes
* N*4 bytes for arguments
* M bytes (aligned to 4 bytes) for executable data
* 1 byte for information about next header
* 3 reserved bytes

The first four bytes are specified as
  sizeof(struct opt_hdr_v1)
and the remaining bytes as
  ALIGN(s.st_size, 4) + (binarye->binary.nargs + 2) * sizeof(uint32_t)

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
tools/kwbimage.c