From f07381529bf69f14abd18cd3bd47982f466e179f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= Date: Wed, 3 May 2023 12:23:39 +0200 Subject: scripts: dtc-version: support git version strings too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Building dtc from git causes the version number to start with a 'v' (e.g. v1.7.0). printf then fails to parse 'v1' as a decimal value, and prints '000700' instead of '010700'. Subsequently, the build fails, because '000700' is less than the required '010400' version. Signed-off-by: Martin Hundebøll --- scripts/dtc-version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/dtc-version.sh b/scripts/dtc-version.sh index bfb514e179f..53ff868bcdc 100755 --- a/scripts/dtc-version.sh +++ b/scripts/dtc-version.sh @@ -20,7 +20,7 @@ if ! which $dtc >/dev/null ; then exit 1 fi -MAJOR=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 1) +MAJOR=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 1 | tr -d v) MINOR=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 2) PATCH=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 3 | cut -d - -f 1) -- cgit v1.2.3 From 6923f49d3ac29ac55845895887da1bfc8534de00 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Thu, 4 May 2023 13:33:08 +0200 Subject: scripts/Makefile.dts: tweak logic for deciding which dtbs to build The idea in 3609e1dc5f4d (dts: automatically build necessary .dtb files) was fine, but the implementation was suboptimal due to some misunderstandings on my part (and possibly defects in some defconfig files): - Sometimes DEFAULT_DEVICE_TREE is not included in OF_LIST or SPL_OF_LIST - SPL_OF_LIST is not always a subset of OF_LIST - While SPL_OF_LIST governs the list of dtbs relevant to SPL (i.e., may be built into an SPL-with-bunch-of-dtbs-to-choose-between-at-runtime), those dtbs are not actually _built_ during the SPL build phase, i.e. when $(SPL_) would expand to SPL_. fdtgrep runs on the artifacts produced during the ordinary U-Boot build. Tweak the logic so that we simply add the union of all dtbs mentioned in either DEFAULT_DEVICE_TREE, OF_LIST and SPL_OF_LIST to dtb-y. That should, for real, ensure that we always build all the dtbs that is relevant to the current board, and should in turn enable us to massively simplify arch/*/dts/Makefile. Signed-off-by: Rasmus Villemoes Tested-by: Tom Rini Reviewed-by: Simon Glass --- scripts/Makefile.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/Makefile.dts b/scripts/Makefile.dts index 2561025da82..5e2429c6170 100644 --- a/scripts/Makefile.dts +++ b/scripts/Makefile.dts @@ -1,3 +1,3 @@ # SPDX-License-Identifier: GPL-2.0+ -dtb-y += $(patsubst %,%.dtb,$(subst ",,$(CONFIG_$(SPL_)OF_LIST))) +dtb-y += $(patsubst %,%.dtb,$(subst ",,$(CONFIG_DEFAULT_DEVICE_TREE) $(CONFIG_OF_LIST) $(CONFIG_SPL_OF_LIST))) -- cgit v1.2.3 From d50af66343f1bb3797e06aa4fabe11f4f61d8ee8 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Thu, 4 May 2023 14:26:43 +0200 Subject: kbuild: add dtc as dependency on .dtb files [Linux commit b8fc5b2157b1] If dtc is rebuilt, we should rebuild .dtb files with the new dtc. [Import notes: Back then there was no .dtbo rule in Linux's Makefile.lib, but the current .dtbo rules in Linux also have the $(DTC) dependency, so also add it to our .dtbo rule.] Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- scripts/Makefile.lib | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 7b27224b5d4..651d700369e 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -331,7 +331,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ ; \ sed "s:$(pre-tmp):$(<):" $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) -$(obj)/%.dtb: $(src)/%.dts FORCE +$(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE $(call if_changed_dep,dtc) pre-tmp = $(subst $(comma),_,$(dot-target).pre.tmp) @@ -351,7 +351,7 @@ cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \ -d $(depfile).dtc.tmp $(dtc-tmp) ; \ cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) -$(obj)/%.dtbo: $(src)/%.dts FORCE +$(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE $(call if_changed_dep,dtco) # Fonts -- cgit v1.2.3 From a0f9a77912b21adf5dbde5d5d47943c5d881d1c1 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Thu, 4 May 2023 14:26:44 +0200 Subject: kbuild: Allow DTB overlays to built from .dtso named source files [Linux commit 363547d2191c] Currently DTB Overlays (.dtbo) are build from source files with the same extension (.dts) as the base DTs (.dtb). This may become confusing and even lead to wrong results. For example, a composite DTB (created from a base DTB and a set of overlays) might have the same name as one of the overlays that create it. Different files should be generated from differently named sources. .dtb <-> .dts .dtbo <-> .dtso We do not remove the ability to compile DTBO files from .dts files here, only add a new rule allowing the .dtso file name. The current .dts named overlays can be renamed with time. After all have been renamed we can remove the other rule. [Import notes: Adapt to U-Boot by using the cmd_dtco function instead of cmd_dtc just like the current .dts -> .dtbo rule.] Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- scripts/Makefile.lib | 3 +++ 1 file changed, 3 insertions(+) (limited to 'scripts') diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 651d700369e..7362a392ada 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -354,6 +354,9 @@ cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \ $(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE $(call if_changed_dep,dtco) +$(obj)/%.dtbo: $(src)/%.dtso $(DTC) FORCE + $(call if_changed_dep,dtco) + # Fonts # --------------------------------------------------------------------------- -- cgit v1.2.3 From 2f27405902894c3cb1b274536d623c286aa7c425 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Tue, 16 May 2023 11:17:56 +0200 Subject: scripts/Makefile.lib: change spelling of $(srctree)/arch/$(ARCH)/dts in dtc_cpp_flags Currently, all in-tree .dts files (apart from some under test/ and tools/), reside in arch/$ARCH/dts. However, in the linux kernel tree, dts files for arm64 boards, and probably in the not too distant future [1], arm boards as well, live in subdirectories of that. For private forks, using a vendor or project subdirectory is also more convenient to clearly separate private code from upstream - in the same way that code under board/ is also split and easy to maintain. In order to prepare for us to follow suit and do the splitting of the in-tree .dts files, and to make life a little easier for private forks that already place dts files not directly in arch/$ARCH/dts, change the $(srctree)/arch/$(ARCH)/dts path to instead refer to the directory of the .dts file being compiled. This should be a no-op for all existing cases. [1] https://lore.kernel.org/lkml/20220328000915.15041-1-ansuelsmth@gmail.com/ Signed-off-by: Rasmus Villemoes --- scripts/Makefile.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 7362a392ada..f5ab7af0f45 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -186,7 +186,7 @@ u_boot_dtsi = $(strip $(u_boot_dtsi_options_debug) \ # Modified for U-Boot dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ $(UBOOTINCLUDE) \ - -I$(srctree)/arch/$(ARCH)/dts \ + -I$(dir $<) \ -I$(srctree)/arch/$(ARCH)/dts/include \ -I$(srctree)/include \ -D__ASSEMBLY__ \ -- cgit v1.2.3