2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2017-11-14 01:54:58 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2017 Google, Inc
|
|
|
|
*
|
|
|
|
* Simple program to create some binman symbols. This is used by binman tests.
|
|
|
|
*/
|
|
|
|
|
2022-06-18 12:13:09 +00:00
|
|
|
#include <linux/kconfig.h>
|
2017-11-14 01:54:58 +00:00
|
|
|
#include <binman_sym.h>
|
|
|
|
|
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>
2022-06-18 12:13:11 +00:00
|
|
|
DECLARE_BINMAN_MAGIC_SYM;
|
|
|
|
|
2021-03-18 07:24:56 +00:00
|
|
|
binman_sym_declare(unsigned long, u_boot_spl_any, offset);
|
2018-08-01 21:22:37 +00:00
|
|
|
binman_sym_declare(unsigned long long, u_boot_spl2, offset);
|
2018-08-01 21:22:42 +00:00
|
|
|
binman_sym_declare(unsigned long, u_boot_any, image_pos);
|
2019-08-24 13:23:05 +00:00
|
|
|
binman_sym_declare(unsigned long, u_boot_any, size);
|