mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-14 07:13:03 +00:00
700f3108d3
When building for a TPL/SPL setup (e.g. on the RK3368), we need the TPL stage to have the extra space for for the 'Rockchip SPL name' (i.e. 'RK33' word). Yet, the SPL will start execution at its first word (i.e. the first word in the SPL binary needs to be a valid instruction). To make things a bit more involved, CONFIG_SPL_BUILD is defined both for the SPL and the TPL stage. To avoid having to explicitly test for the first stage (TPL, if and only if TPL and SPL are built, SPL otherwise), this commit modifies the sequence to repeat the 'b reset' (instead of reserving 4 bytes of undefined space) at the start of the boot0 hook: if overwritten (and execution starts at the second word), the first instruction is still a 'b reset'... if not overwritten, we start on a 'b reset' as well. This solution wouldn't even require the check whether we are in the SPL/TPL build (i.e. CONFIG_SPL_BUILD), but we leave this check in for documentation purposes. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
33 lines
1.1 KiB
C
33 lines
1.1 KiB
C
|
|
/*
|
|
* Copyright 2017 Theobroma Systems Design und Consulting GmbH
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
|
|
/*
|
|
* Execution starts on the instruction following this 4-byte header
|
|
* (containing the magic 'RK33').
|
|
*
|
|
* To make life easier for everyone, we build the SPL binary with
|
|
* space for this 4-byte header already included in the binary.
|
|
*/
|
|
|
|
#ifdef CONFIG_SPL_BUILD
|
|
/*
|
|
* We need to add 4 bytes of space for the 'RK33' at the
|
|
* beginning of the executable. However, as we want to keep
|
|
* this generic and make it applicable to builds that are like
|
|
* the RK3368 (TPL needs this, SPL doesn't) or the RK3399 (no
|
|
* TPL, but extra space needed in the SPL), we simply repeat
|
|
* the 'b reset' with the expectation that the first one will
|
|
* be overwritten, if this is the first stage contained in the
|
|
* final image created with mkimage)...
|
|
*/
|
|
b reset /* may be overwritten --- should be 'nop' or a 'b reset' */
|
|
#endif
|
|
b reset
|
|
|
|
#if defined(CONFIG_ROCKCHIP_RK3399) && defined(CONFIG_SPL_BUILD)
|
|
.space CONFIG_ROCKCHIP_SPL_RESERVE_IRAM /* space for the ATF data */
|
|
#endif
|