From: Michael Srba <[email protected]> Add CONFIG_SPL_OF_LIVE and if set, initialize of_live in spl.c
Signed-off-by: Michael Srba <[email protected]> Reviewed-by: Simon Glass <[email protected]> --- common/spl/spl.c | 9 +++++++++ dts/Kconfig | 8 ++++++++ lib/Makefile | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/common/spl/spl.c b/common/spl/spl.c index 722b18c98ed..6c9a1a1cbcc 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -17,6 +17,7 @@ #include <irq_func.h> #include <log.h> #include <mapmem.h> +#include <of_live.h> #include <serial.h> #include <spl.h> #include <spl_load.h> @@ -510,6 +511,14 @@ static int spl_common_init(bool setup_malloc) return ret; } } + if (CONFIG_IS_ENABLED(OF_LIVE)) { + bootstage_start(BOOTSTAGE_ID_ACCUM_OF_LIVE, "of_live"); + ret = of_live_build(gd->fdt_blob, + (struct device_node **)gd_of_root_ptr()); + bootstage_accum(BOOTSTAGE_ID_ACCUM_OF_LIVE); + if (ret) + return ret; + } if (CONFIG_IS_ENABLED(DM)) { bootstage_start(BOOTSTAGE_ID_ACCUM_DM_SPL, xpl_phase() == PHASE_TPL ? "dm tpl" : "dm_spl"); diff --git a/dts/Kconfig b/dts/Kconfig index 6b501c2239e..20b5834b8fa 100644 --- a/dts/Kconfig +++ b/dts/Kconfig @@ -86,6 +86,14 @@ config OF_LIVE enables a live tree which is available after relocation, and can be adjusted as needed. +config SPL_OF_LIVE + bool "Enable use of a live tree in SPL" + depends on SPL_DM && SPL_OF_CONTROL + help + This option enables a live tree in SPL, allowing the sharing + of OF fixup code between U-Boot proper and SPL. + See also OF_LIVE. + config OF_UPSTREAM bool "Enable use of devicetree imported from Linux kernel release" depends on !COMPILE_TEST && !SANDBOX diff --git a/lib/Makefile b/lib/Makefile index d0ffabc2b47..bbd540e9687 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -13,7 +13,6 @@ obj-$(CONFIG_FWU_MULTI_BANK_UPDATE) += fwu_updates/ obj-$(CONFIG_LZMA) += lzma/ obj-$(CONFIG_BZIP2) += bzip2/ obj-$(CONFIG_FIT) += libfdt/ -obj-$(CONFIG_OF_LIVE) += of_live.o obj-$(CONFIG_CMD_DHRYSTONE) += dhry/ obj-$(CONFIG_ARCH_AT91) += at91/ obj-$(CONFIG_OPTEE_LIB) += optee/ @@ -55,6 +54,7 @@ obj-$(CONFIG_BITREVERSE) += bitrev.o obj-y += list_sort.o endif +obj-$(CONFIG_$(PHASE_)OF_LIVE) += of_live.o obj-$(CONFIG_$(PHASE_)TPM) += tpm-common.o ifeq ($(CONFIG_$(PHASE_)TPM),y) obj-$(CONFIG_TPM) += tpm_api.o -- 2.53.0

