tools: kwbimage: Add support for specifying LOAD_ADDRESS for BINARY command
authorPali Rohár <pali@kernel.org>
Wed, 12 Jan 2022 17:20:41 +0000 (18:20 +0100)
committerStefan Roese <sr@denx.de>
Fri, 14 Jan 2022 10:39:16 +0000 (11:39 +0100)
commit0aca27ea185188a50292dd5bcec07fef020d10e6
treea685439c4bfa2f323c56f0c9e453f4a61a3c942d
parentaf49605b955f32b027221ef106c04b44a43ad298
tools: kwbimage: Add support for specifying LOAD_ADDRESS for BINARY command

ARM executable code included in kwbimage binary header, which is not
position independent, needs to be loaded and executed by BootROM at the
correct fixed address.

Armada BootROMs load kwbimage header (in which the executable code is also
stored) at fixed address 0x40004000 or 0x40000000 which is mapped to
L2-SRAM (L2 Cache as SRAM). Address 0x40004000 is used on Armada platforms
with Sheeva CPU core (A370 and AXP) where BootROM uses MMU with 0x4000
bytes for MMU translation table. Address 0x40000000 is used on all other
platforms.

Thus the only way to specify load and execute address of this executable
code in binary kwbimage header is by filling dummy arguments into the
binary header, using the same mechanism we already have for achieving
128-bit boundary alignment on A370 and AXP SoCs.

Extend kwbimage config file parser to allow to specify load address as
part of BINARY command with syntax:

    BINARY path_to_binary arg1 arg2 ... argN LOAD_ADDRESS address

If the specified load address is invalid or cannot be used, mkimage will
throw fatal error and exit. This will prevent generating kwbimage with
invalid load address for non-position independent binary code.

If no load address is specified, kwbimage will not fill any the dummy
arguments, thus it will behave the same as before this change.

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