summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAlper Nebi Yasak <alpernebiyasak@gmail.com>2022-06-18 15:13:09 +0300
committerSimon Glass <sjg@chromium.org>2022-06-28 03:09:52 +0100
commitd8830cf84035120562bb490be276fab9e43d6414 (patch)
treeda462321dd8915197c5fa45e77e3d7662c99b93f /common
parent5204823c81c2be4ef3abfcaae351401f8dd5f058 (diff)
spl: binman: Split binman symbols support from enabling binman
Enabling CONFIG_BINMAN makes binman run after a build to package any images specified in the device-tree. It also enables a mechanism for SPL/TPL to declare and use special linker symbols that refer to other entries in the same binman image. A similar feature that gets this info from the device-tree exists for U-Boot proper, but it is gated behind a CONFIG_BINMAN_FDT unlike the symbols. Confusingly, CONFIG_SPL/TPL_BINMAN_SYMBOLS also exist. These configs don't actually enable/disable the symbols mechanism as one would expect, but declare some symbols for U-Boot using this mechanism. Reuse the BINMAN_SYMBOLS configs to make them toggle the symbols mechanism, and declare symbols for the U-Boot phases in a dependent BINMAN_UBOOT_SYMBOLS config. Extend it to cover symbols of all phases. Update the config prompt and help message to make it clearer about this. Fix binman test binaries to work with CONFIG_IS_ENABLED(BINMAN_SYMBOLS). Co-developed-by: Peng Fan <peng.fan@nxp.com> [Alper: New config for phase symbols, update Kconfigs, commit message] Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Diffstat (limited to 'common')
-rw-r--r--common/spl/Kconfig22
-rw-r--r--common/spl/Kconfig.tpl24
-rw-r--r--common/spl/spl.c9
3 files changed, 40 insertions, 15 deletions
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 2ad2351c6e..46d9be73bb 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -190,12 +190,24 @@ config SPL_BINMAN_SYMBOLS
depends on SPL_FRAMEWORK && BINMAN
default y
help
- This enables use of symbols in SPL which refer to U-Boot, enabling SPL
- to obtain the location of U-Boot simply by calling spl_get_image_pos()
- and spl_get_image_size().
+ This enables use of symbols in SPL which refer to other entries in
+ the same binman image as the SPL. These can be declared with the
+ binman_sym_declare(type, entry, prop) macro and accessed by the
+ binman_sym(type, entry, prop) macro defined in binman_sym.h.
- For this to work, you must have a U-Boot image in the binman image, so
- binman can update SPL with the location of it.
+ See tools/binman/binman.rst for a detailed explanation.
+
+config SPL_BINMAN_UBOOT_SYMBOLS
+ bool "Declare binman symbols for U-Boot phases in SPL"
+ depends on SPL_BINMAN_SYMBOLS
+ default y
+ help
+ This enables use of symbols in SPL which refer to U-Boot phases,
+ enabling SPL to obtain the location and size of its next phase simply
+ by calling spl_get_image_pos() and spl_get_image_size().
+
+ For this to work, you must have all U-Boot phases in the same binman
+ image, so binman can update SPL with the locations of everything.
source "common/spl/Kconfig.nxp"
diff --git a/common/spl/Kconfig.tpl b/common/spl/Kconfig.tpl
index 834cb6b6dd..8c59c76730 100644
--- a/common/spl/Kconfig.tpl
+++ b/common/spl/Kconfig.tpl
@@ -9,16 +9,28 @@ config TPL_SIZE_LIMIT
If this value is zero, it is ignored.
config TPL_BINMAN_SYMBOLS
- bool "Declare binman symbols in TPL"
+ bool "Support binman symbols in TPL"
depends on TPL_FRAMEWORK && BINMAN
default y
help
- This enables use of symbols in TPL which refer to U-Boot, enabling TPL
- to obtain the location of U-Boot simply by calling spl_get_image_pos()
- and spl_get_image_size().
+ This enables use of symbols in TPL which refer to other entries in
+ the same binman image as the TPL. These can be declared with the
+ binman_sym_declare(type, entry, prop) macro and accessed by the
+ binman_sym(type, entry, prop) macro defined in binman_sym.h.
- For this to work, you must have a U-Boot image in the binman image, so
- binman can update TPL with the location of it.
+ See tools/binman/binman.rst for a detailed explanation.
+
+config TPL_BINMAN_UBOOT_SYMBOLS
+ bool "Declare binman symbols for U-Boot phases in TPL"
+ depends on TPL_BINMAN_SYMBOLS
+ default y
+ help
+ This enables use of symbols in TPL which refer to U-Boot phases,
+ enabling TPL to obtain the location and size of its next phase simply
+ by calling spl_get_image_pos() and spl_get_image_size().
+
+ For this to work, you must have all U-Boot phases in the same binman
+ image, so binman can update TPL with the locations of everything.
config TPL_FRAMEWORK
bool "Support TPL based upon the common SPL framework"
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 7505165624..5dd122611c 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -52,11 +52,10 @@ DECLARE_GLOBAL_DATA_PTR;
u32 *boot_params_ptr = NULL;
-#if CONFIG_IS_ENABLED(BINMAN_SYMBOLS)
+#if CONFIG_IS_ENABLED(BINMAN_UBOOT_SYMBOLS)
/* See spl.h for information about this */
binman_sym_declare(ulong, u_boot_any, image_pos);
binman_sym_declare(ulong, u_boot_any, size);
-#endif
#ifdef CONFIG_TPL
binman_sym_declare(ulong, u_boot_spl, image_pos);
@@ -68,6 +67,8 @@ binman_sym_declare(ulong, u_boot_vpl, image_pos);
binman_sym_declare(ulong, u_boot_vpl, size);
#endif
+#endif /* BINMAN_UBOOT_SYMBOLS */
+
/* Define board data structure */
static struct bd_info bdata __attribute__ ((section(".data")));
@@ -152,7 +153,7 @@ void spl_fixup_fdt(void *fdt_blob)
ulong spl_get_image_pos(void)
{
- if (!CONFIG_IS_ENABLED(BINMAN_SYMBOLS))
+ if (!CONFIG_IS_ENABLED(BINMAN_UBOOT_SYMBOLS))
return BINMAN_SYM_MISSING;
#ifdef CONFIG_VPL
@@ -166,7 +167,7 @@ ulong spl_get_image_pos(void)
ulong spl_get_image_size(void)
{
- if (!CONFIG_IS_ENABLED(BINMAN_SYMBOLS))
+ if (!CONFIG_IS_ENABLED(BINMAN_UBOOT_SYMBOLS))
return BINMAN_SYM_MISSING;
#ifdef CONFIG_VPL