summaryrefslogtreecommitdiff
path: root/common/spl/spl.c
diff options
context:
space:
mode:
authorAlper Nebi Yasak <alpernebiyasak@gmail.com>2022-06-18 15:13:11 +0300
committerSimon Glass <sjg@chromium.org>2022-06-28 05:09:52 +0300
commit367ecbf2d3b1c16a3b98b9f6430b8197d2bddbf9 (patch)
tree66a19d6309f56e62a2811ed6258db181612320eb /common/spl/spl.c
parent3a7d32787602a54486856e8392ba202b56ede3c7 (diff)
downloadu-boot-367ecbf2d3b1c16a3b98b9f6430b8197d2bddbf9.tar.xz
spl: binman: Check at runtime if binman symbols were filled in
Binman lets us declare symbols in SPL/TPL that refer to other entries in the same binman image as them. These symbols are filled in with the correct values while binman assembles the images, but this is done in-memory only. Symbols marked as optional can be filled with BINMAN_SYM_MISSING as an error value if their referred entry is missing. However, the unmodified SPL/TPL binaries are still available on disk, and can be used by people. For these files, nothing ensures that the symbols are set to this error value, and they will be considered valid when they are not. Empirically, all symbols show up as zero in a sandbox_vpl build when we run e.g. tpl/u-boot-tpl directly. On the other hand, zero is a perfectly fine value for a binman-written symbol, so we cannot say the symbols have wrong values based on that. Declare a magic symbol that binman always fills in with a fixed value. Check this value as an indicator that symbols were filled in correctly. Return the error value for all symbols when this magic symbol has the wrong value. For binman tests, we need to make room for the new symbol in the mocked SPL/TPL data by extending them by four bytes. This messes up some test image layouts. Fix the affected values, and check the magic symbol wherever it makes sense. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Diffstat (limited to 'common/spl/spl.c')
-rw-r--r--common/spl/spl.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 5dd122611c..29e0898f03 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -41,6 +41,7 @@
#include <wdt.h>
DECLARE_GLOBAL_DATA_PTR;
+DECLARE_BINMAN_MAGIC_SYM;
#ifndef CONFIG_SYS_UBOOT_START
#define CONFIG_SYS_UBOOT_START CONFIG_SYS_TEXT_BASE