tools: kwbimage: Simplify aligning and calculating checksum
authorPali Rohár <pali@kernel.org>
Fri, 23 Jul 2021 09:13:56 +0000 (11:13 +0200)
committerStefan Roese <sr@denx.de>
Sat, 31 Jul 2021 07:49:31 +0000 (09:49 +0200)
commit37cb9c15d70d638d77bf9b8e50e06132efea7cff
tree5c990f43014f24707785a6e5e9a23c3378b1c3b6
parent8ab9c6be690e037589a7f0305ce76b3907f9c295
tools: kwbimage: Simplify aligning and calculating checksum

The return value of kwbimage_generate() is used for aligning the data
part of kwbimage. Use it for calculating proper 4 byte alignment as is
required by BootROM and also use it for allocating additional 4 bytes
for the 32-bit data checksum.

This simplifies the alignment code to be only at one place (in function
kwbimage_generate) and also simplifies setting checksum as it can be
directly updated in memory.

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>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Tested-by: Chris Packham <judge.packham@gmail.com>
tools/kwbimage.c