summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2024-10-11 12:23:25 -0600
committerTom Rini <[email protected]>2024-10-11 12:23:25 -0600
commit47e544f576699ca4630e20448db6a05178960697 (patch)
treef31951120512ac41f145dc0fcf6b0bbdfe5b9c01 /scripts
parent5d899fc58c44fe5623e31524da2205d8597a53d1 (diff)
parent0220a68c25cbfdfa495927f83abf0b1d4ebd823b (diff)
Merge patch series "Tidy up use of 'SPL' and CONFIG_SPL_BUILD"
Simon Glass <[email protected]> says: When the SPL build-phase was first created it was designed to solve a particular problem (the need to init SDRAM so that U-Boot proper could be loaded). It has since expanded to become an important part of U-Boot, with three phases now present: TPL, VPL and SPL Due to this history, the term 'SPL' is used to mean both a particular phase (the one before U-Boot proper) and all the non-proper phases. This has become confusing. For a similar reason CONFIG_SPL_BUILD is set to 'y' for all 'SPL' phases, not just SPL. So code which can only be compiled for actual SPL, for example, must use something like this: #if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) In Makefiles we have similar issues. SPL_ has been used as a variable which expands to either SPL_ or nothing, to chose between options like CONFIG_BLK and CONFIG_SPL_BLK. When TPL appeared, a new SPL_TPL variable was created which expanded to 'SPL_', 'TPL_' or nothing. Later it was updated to support 'VPL_' as well. This series starts a change in terminology and usage to resolve the above issues: - The word 'xPL' is used instead of 'SPL' to mean a non-proper build - A new CONFIG_XPL_BUILD define indicates that the current build is an 'xPL' build - The existing CONFIG_SPL_BUILD is changed to mean SPL; it is not now defined for TPL and VPL phases - The existing SPL_ Makefile variable is renamed to SPL_ - The existing SPL_TPL Makefile variable is renamed to PHASE_ It should be noted that xpl_phase() can generally be used instead of the above CONFIGs without a code-space or run-time penalty. This series does not attempt to convert all of U-Boot to use this new terminology but it makes a start. In particular, renaming spl.h and common/spl seems like a bridge too far at this point. The series is fully bisectable. It has also been checked to ensure there are no code-size changes on any commit.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Kbuild.include14
-rw-r--r--scripts/Makefile.autoconf6
-rw-r--r--scripts/Makefile.xpl (renamed from scripts/Makefile.spl)60
3 files changed, 45 insertions, 35 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 5daceb26061..edc91b24e45 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -324,18 +324,18 @@ endif
# do not delete intermediate files automatically
.SECONDARY:
-ifdef CONFIG_SPL_BUILD
-SPL_ := SPL_
+ifdef CONFIG_XPL_BUILD
+XPL_ := SPL_
ifeq ($(CONFIG_VPL_BUILD),y)
-SPL_TPL_ := VPL_
+PHASE_ := VPL_
else
ifeq ($(CONFIG_TPL_BUILD),y)
-SPL_TPL_ := TPL_
+PHASE_ := TPL_
else
-SPL_TPL_ := SPL_
+PHASE_ := SPL_
endif
endif
else
-SPL_ :=
-SPL_TPL_ :=
+XPL_ :=
+PHASE_ :=
endif
diff --git a/scripts/Makefile.autoconf b/scripts/Makefile.autoconf
index b42f9b525fe..c1eab2f3a1d 100644
--- a/scripts/Makefile.autoconf
+++ b/scripts/Makefile.autoconf
@@ -83,15 +83,15 @@ u-boot.cfg: include/config.h FORCE
spl/u-boot.cfg: include/config.h FORCE
$(Q)mkdir -p $(dir $@)
- $(call cmd,u_boot_cfg,-DCONFIG_SPL_BUILD)
+ $(call cmd,u_boot_cfg,-DCONFIG_XPL_BUILD -DCONFIG_SPL_BUILD)
tpl/u-boot.cfg: include/config.h FORCE
$(Q)mkdir -p $(dir $@)
- $(call cmd,u_boot_cfg,-DCONFIG_SPL_BUILD -DCONFIG_TPL_BUILD)
+ $(call cmd,u_boot_cfg,-DCONFIG_XPL_BUILD -DCONFIG_TPL_BUILD)
vpl/u-boot.cfg: include/config.h FORCE
$(Q)mkdir -p $(dir $@)
- $(call cmd,u_boot_cfg,-DCONFIG_SPL_BUILD -DCONFIG_VPL_BUILD)
+ $(call cmd,u_boot_cfg,-DCONFIG_XPL_BUILD -DCONFIG_VPL_BUILD)
include/autoconf.mk: u-boot.cfg
$(call cmd,autoconf)
diff --git a/scripts/Makefile.spl b/scripts/Makefile.xpl
index 1868f1beef6..dca5f4539d0 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.xpl
@@ -20,11 +20,21 @@ _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
include $(srctree)/scripts/Kbuild.include
-include include/config/auto.conf
+
+# This file contains 0, or 2 lines
+# It is empty for U-Boot proper (where $(obj) is empty)
+# For any xPL build it contains CONFIG_XPL_BUILD=y
+# - for SPL builds it also contains CONFIG_SPL_BUILD=y
+# - for TPL builds it also contains CONFIG_TPL_BUILD=y
+# - for VPL builds it also contains CONFIG_VPL_BUILD=y
-include $(obj)/include/autoconf.mk
UBOOTINCLUDE := -I$(obj)/include $(UBOOTINCLUDE)
+KBUILD_CPPFLAGS += -DCONFIG_XPL_BUILD
+ifeq ($(CONFIG_SPL_BUILD),y)
KBUILD_CPPFLAGS += -DCONFIG_SPL_BUILD
+endif
ifeq ($(CONFIG_TPL_BUILD),y)
KBUILD_CPPFLAGS += -DCONFIG_TPL_BUILD
else
@@ -48,20 +58,20 @@ endif
export SPL_NAME
-ifdef CONFIG_SPL_BUILD
-SPL_ := SPL_
+ifdef CONFIG_XPL_BUILD
+XPL_ := SPL_
ifeq ($(CONFIG_VPL_BUILD),y)
-SPL_TPL_ := VPL_
+PHASE_ := VPL_
else
ifeq ($(CONFIG_TPL_BUILD),y)
-SPL_TPL_ := TPL_
+PHASE_ := TPL_
else
-SPL_TPL_ := SPL_
+PHASE_ := SPL_
endif
endif
else
-SPL_ :=
-SPL_TPL_ :=
+XPL_ :=
+PHASE_ :=
endif
ifeq ($(obj)$(CONFIG_SUPPORT_SPL),spl)
@@ -83,7 +93,7 @@ include $(srctree)/scripts/Makefile.lib
KBUILD_CFLAGS += -ffunction-sections -fdata-sections
LDFLAGS_FINAL += --gc-sections
-ifeq ($(CONFIG_$(SPL_TPL_)STACKPROTECTOR),y)
+ifeq ($(CONFIG_$(PHASE_)STACKPROTECTOR),y)
KBUILD_CFLAGS += -fstack-protector-strong
else
KBUILD_CFLAGS += -fno-stack-protector
@@ -107,8 +117,8 @@ endif
libs-y += common/init/
# Special handling for a few options which support SPL/TPL/VPL
-libs-$(CONFIG_$(SPL_TPL_)LIBCOMMON_SUPPORT) += boot/ common/ cmd/ env/
-libs-$(CONFIG_$(SPL_TPL_)LIBGENERIC_SUPPORT) += lib/
+libs-$(CONFIG_$(PHASE_)LIBCOMMON_SUPPORT) += boot/ common/ cmd/ env/
+libs-$(CONFIG_$(PHASE_)LIBGENERIC_SUPPORT) += lib/
ifdef CONFIG_SPL_FRAMEWORK
libs-$(CONFIG_PARTITIONS) += disk/
endif
@@ -121,7 +131,7 @@ libs-y += dts/
libs-y += fs/
libs-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/
libs-$(CONFIG_SPL_NET) += net/
-libs-$(CONFIG_$(SPL_TPL_)UNIT_TEST) += test/
+libs-$(CONFIG_$(PHASE_)UNIT_TEST) += test/
head-y := $(addprefix $(obj)/,$(head-y))
libs-y := $(addprefix $(obj)/,$(libs-y))
@@ -137,12 +147,12 @@ endif
u-boot-spl-init := $(head-y)
u-boot-spl-main := $(libs-y)
-ifdef CONFIG_$(SPL_TPL_)OF_PLATDATA
+ifdef CONFIG_$(PHASE_)OF_PLATDATA
platdata-hdr := include/generated/dt-structs-gen.h include/generated/dt-decl.h
platdata-inst := $(obj)/dts/dt-uclass.o $(obj)/dts/dt-device.o
platdata-noinst := $(obj)/dts/dt-plat.o
-ifdef CONFIG_$(SPL_TPL_)OF_PLATDATA_INST
+ifdef CONFIG_$(PHASE_)OF_PLATDATA_INST
u-boot-spl-platdata := $(platdata-inst)
u-boot-spl-old-platdata := $(platdata-noinst)
else
@@ -159,9 +169,9 @@ endif # OF_PLATDATA
# Linker Script
# First test whether there's a linker-script for the specific stage defined...
-ifneq ($(CONFIG_$(SPL_TPL_)LDSCRIPT),)
+ifneq ($(CONFIG_$(PHASE_)LDSCRIPT),)
# need to strip off double quotes
-LDSCRIPT := $(addprefix $(srctree)/,$(CONFIG_$(SPL_TPL_)LDSCRIPT:"%"=%))
+LDSCRIPT := $(addprefix $(srctree)/,$(CONFIG_$(PHASE_)LDSCRIPT:"%"=%))
else
# ...then fall back to the generic SPL linker-script
ifneq ($(CONFIG_SPL_LDSCRIPT),)
@@ -195,11 +205,11 @@ LDPPFLAGS += \
# Turn various CONFIG symbols into IMAGE symbols for easy reuse of
# the scripts between SPL, TPL and VPL.
-ifneq ($(CONFIG_$(SPL_TPL_)MAX_SIZE),0x0)
-LDPPFLAGS += -DIMAGE_MAX_SIZE=$(CONFIG_$(SPL_TPL_)MAX_SIZE)
+ifneq ($(CONFIG_$(PHASE_)MAX_SIZE),0x0)
+LDPPFLAGS += -DIMAGE_MAX_SIZE=$(CONFIG_$(PHASE_)MAX_SIZE)
endif
-ifneq ($(CONFIG_$(SPL_TPL_)TEXT_BASE),)
-LDPPFLAGS += -DIMAGE_TEXT_BASE=$(CONFIG_$(SPL_TPL_)TEXT_BASE)
+ifneq ($(CONFIG_$(PHASE_)TEXT_BASE),)
+LDPPFLAGS += -DIMAGE_TEXT_BASE=$(CONFIG_$(PHASE_)TEXT_BASE)
endif
MKIMAGEOUTPUT ?= /dev/null
@@ -313,7 +323,7 @@ endif
# - OF_REAL is enabled
# - we have either OF_SEPARATE or OF_HOSTFILE
build_dtb :=
-ifneq ($(CONFIG_$(SPL_TPL_)OF_REAL),)
+ifneq ($(CONFIG_$(PHASE_)OF_REAL),)
ifneq ($(CONFIG_OF_SEPARATE)$(CONFIG_SANDBOX),)
build_dtb := y
endif
@@ -321,7 +331,7 @@ endif
ifneq ($(build_dtb),)
$(obj)/$(SPL_BIN)-dtb.bin: $(obj)/$(SPL_BIN)-nodtb.bin \
- $(if $(CONFIG_$(SPL_TPL_)SEPARATE_BSS),,$(obj)/$(SPL_BIN)-pad.bin) \
+ $(if $(CONFIG_$(PHASE_)SEPARATE_BSS),,$(obj)/$(SPL_BIN)-pad.bin) \
$(FINAL_DTB_CONTAINER) FORCE
$(call if_changed,cat)
@@ -345,7 +355,7 @@ pythonpath = PYTHONPATH=scripts/dtc/pylibfdt
DTOC_ARGS := $(pythonpath) $(srctree)/tools/dtoc/dtoc \
-d $(obj)/$(SPL_BIN).dtb -p $(SPL_NAME)
-ifneq ($(CONFIG_$(SPL_TPL_)OF_PLATDATA_INST),)
+ifneq ($(CONFIG_$(PHASE_)OF_PLATDATA_INST),)
DTOC_ARGS += -i
endif
@@ -390,7 +400,7 @@ quiet_cmd_objcopy = OBJCOPY $@
cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
OBJCOPYFLAGS_$(SPL_BIN)-nodtb.bin = $(SPL_OBJCFLAGS) -O binary \
- $(if $(CONFIG_$(SPL_TPL_)X86_16BIT_INIT),-R .start16 -R .resetvec)
+ $(if $(CONFIG_$(PHASE_)X86_16BIT_INIT),-R .start16 -R .resetvec)
$(obj)/$(SPL_BIN)-nodtb.bin: $(obj)/$(SPL_BIN) FORCE
$(call if_changed,objcopy)
@@ -419,8 +429,8 @@ LDFLAGS_$(SPL_BIN) += $(call ld-option, --no-dynamic-linker)
LDFLAGS_$(SPL_BIN) += --build-id=none
# Pick the best match (e.g. SPL_TEXT_BASE for SPL, TPL_TEXT_BASE for TPL)
-ifneq ($(CONFIG_$(SPL_TPL_)TEXT_BASE),)
-LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_$(SPL_TPL_)TEXT_BASE)
+ifneq ($(CONFIG_$(PHASE_)TEXT_BASE),)
+LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_$(PHASE_)TEXT_BASE)
endif
ifdef CONFIG_TARGET_SOCFPGA_ARRIA10