Skip to contentSkip to conversation

ARM32/64: DT overlay build support

PATCH Superseded Tero Kristo 2 participants 13 messages Aug 28, 2018 – Sep 3, 2018

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ARM32/64: DT overlay build support

Hi,

This series introduces devicetree overlay building support for ARM platforms. The .dtbo target is introduced globally, then makefile changes for both arm32/64 for supporting the .dtbo target, changes to support sub-dir makefile flags, and finally adding the DTC flags override for TI platforms, as that is where we want to introduce the DT overlay support initially.

The ARM makefile changes for supporting DTS sub-makefiles don't look too clean, but that was the only way I could figure out how to get it done.

-Tero

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

#1 lore raw

PATCH 1/7 kbuild: add support for building %.dtbo targets

Add support for building DT overlay targets, which can be applied either runtime or statically on top of base devicetree blobs. The only supported runtime application of overlays right now is during bootloader execution; if the bootloader in question supports this.

---
 scripts/Makefile.lib | 3 +++
 1 file changed, 3 insertions(+)
scripts/Makefile.lib +3 -0
index 61e5966..527aab9 100644
@@ -292,6 +292,9 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
 $(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE
 	$(call if_changed_dep,dtc)
 
+$(obj)/%.dtbo: $(src)/%.dtso $(DTC) FORCE
+	$(call if_changed_dep,dtc)
+
 dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
 
 # Bzip2
Signature · 4 lines
1.9.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#2 lore raw

PATCH 2/7 ARM: dts: add support for building DT overlays

In reply to Tero Kristo

Add simple support for building DT overlays. This just compiles any given .dtso file under the base arch/arm/boot/dts directory into a .dtbo.

---
 arch/arm/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/Makefile +1 -1
index d1516f8..ab555a0 100644
@@ -339,7 +339,7 @@ $(BOOT_TARGETS): vmlinux
 $(INSTALL_TARGETS):
 	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
 
-%.dtb: | scripts
+%.dtb %.dtbo: | scripts
 	$(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
 
 PHONY += dtbs dtbs_install
Signature · 4 lines
1.9.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#3 lore raw

PATCH 3/7 ARM: dts: add support for individual build flags for DT subdirs

In reply to Tero Kristo

Currently the makefile is setup in such manner that even if we build a DT file in a subdirectory under arch/arm/boot/dts, it gets built based on the base boot/dts/Makefile rules. This patch modifies the base makefile in such manner, that it detects which makefile to use based on build target path. This allows setting for example per-directory DTC_FLAGS and using those for the subdir build. The dtbdir local variable is setup to target to the build path.

---
 arch/arm/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/Makefile +3 -1
index ab555a0..b7c21e8 100644
@@ -339,8 +339,10 @@ $(BOOT_TARGETS): vmlinux
 $(INSTALL_TARGETS):
 	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
 
+%.dtb %.dtbo: dtbdir = $(patsubst %/,%,$(patsubst %./,%,$(boot)/dts/$(dir $@)))
+
 %.dtb %.dtbo: | scripts
-	$(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
+	$(Q)$(MAKE) $(build)=$(dtbdir) MACHINE=$(MACHINE) $(boot)/dts/$@
 
 PHONY += dtbs dtbs_install
 
Signature · 4 lines
1.9.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#4 lore raw

PATCH 4/7 arm64: dts: add support for building DT overlays

In reply to Tero Kristo

Add simple support for building DT overlays. This just compiles any given .dtso file under the base arch/arm64/boot/dts/*/ directory into a .dtbo.

---
 arch/arm64/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/Makefile +1 -1
index 106039d..f04c814 100644
@@ -127,7 +127,7 @@ Image.%: Image
 zinstall install:
 	$(Q)$(MAKE) $(build)=$(boot) $@
 
-%.dtb: scripts
+%.dtb %.dtbo: scripts
 	$(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
 
 PHONY += dtbs dtbs_install
Signature · 4 lines
1.9.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#5 lore raw

PATCH 5/7 arm64: dts: add support for per sub-dir makefiles for DT building

In reply to Tero Kristo

Currently the makefile for arm64 builds all the DT files based on rules in the arch/arm64/boot/dts/Makefile, as this is statically passed via the $(build)= parameter. Change the $(build) parameter to actually point to the subdir itself, so the makefile from that subdir can be used to set-up build flags etc., for example setting up DTC_FLAGS. The patsubst magic is used to strip the trailing "/" from the path, as that confuses the kbuild system.

---
 arch/arm64/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/Makefile +1 -1
index f04c814..2ac4358 100644
@@ -128,7 +128,7 @@ zinstall install:
 	$(Q)$(MAKE) $(build)=$(boot) $@
 
 %.dtb %.dtbo: scripts
-	$(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
+	$(Q)$(MAKE) $(build)=$(patsubst %/,%,$(boot)/dts/$(dir $@)) $(boot)/dts/$@
 
 PHONY += dtbs dtbs_install
 
Signature · 4 lines
1.9.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#6 lore raw

PATCH 6/7 ARM: dts: ti: add support for building Texas Instruments specific overlays

In reply to Tero Kristo

Add support for TI specific DT subdir, along with support for building DT overlays. Right now, no DT files are specified in this directory, those are to be added later.

---
 arch/arm/boot/dts/Makefile    | 1 +
 arch/arm/boot/dts/ti/Makefile | 9 +++++++++
 2 files changed, 10 insertions(+)
 create mode 100644 arch/arm/boot/dts/ti/Makefile
arch/arm/boot/dts/Makefile +1 -0
index b5bd3de..59a4b63 100644
@@ -755,6 +755,7 @@ dtb-$(CONFIG_SOC_DRA7XX) += \
 	dra72-evm-revc.dtb \
 	dra71-evm.dtb \
 	dra76-evm.dtb
+subdir-$(CONFIG_SOC_DRA7XX) += ti
 dtb-$(CONFIG_ARCH_ORION5X) += \
 	orion5x-kuroboxpro.dtb \
 	orion5x-lacie-d2-network.dtb \
arch/arm/boot/dts/ti/Makefile new file +9 -0
new file mode 100644
index 0000000..e0203ba
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Make file to build device tree binaries for boards based on
+# Texas Instruments Inc processors
+#
+# Copyright (C) 2016-2018 Texas Instruments Incorporated - http://www.ti.com/
+#
+
+DTC_FLAGS += -@
Signature · 4 lines
1.9.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#7 lore raw

PATCH 7/7 arm64: ti: add support for building Texas instruments overlays

In reply to Tero Kristo

Add the symbols to TI build DT files, for supporting overlays. Right now, there are no overlay files introduced, those shall be added later on.

---
 arch/arm64/boot/dts/ti/Makefile | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/ti/Makefile +2 -0
index 63e619d..753de8c 100644
@@ -6,4 +6,6 @@
 # Copyright (C) 2016-2018 Texas Instruments Incorporated - http://www.ti.com/
 #
 
+DTC_FLAGS += -@
+
 dtb-$(CONFIG_ARCH_K3_AM6_SOC) += k3-am654-base-board.dtb
Signature · 4 lines
1.9.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#8 lore raw

cover ARM32/64: DT overlay build support

In reply to Tero Kristo

+ Mark Rutland, just in case he is interested

Quoted 9 lines · Tero Kristo

Hi,

This series introduces devicetree overlay building support for ARM platforms. The .dtbo target is introduced globally, then makefile changes for both arm32/64 for supporting the .dtbo target, changes to support sub-dir makefile flags, and finally adding the DTC flags override for TI platforms, as that is where we want to introduce the DT overlay support initially.

Quoted 9 lines

The ARM makefile changes for supporting DTS sub-makefiles don't look too clean, but that was the only way I could figure out how to get it done.

-Tero

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

This series does three unrelated things:

(1) create a ti specific dts subdirectory arch/arm/boot/dts/ti/

(2) create a rule for creating a .dtbo from a .dtso

(3) add a dtc compile flag to add phandle symbol information to all .dtb files created from arch/arm/boot/dts/ti/ and arch/arm64/boot/dts/ti/

Please split the patches into three independent series so that each of the three concepts can be discussed separately.

Thanks,

Frank

#9 lore raw

cover ARM32/64: DT overlay build support

Quoted 16 lines · Frank Rowand

+ Mark Rutland, just in case he is interested

Quoted 13 lines · Tero Kristo

Hi,

This series introduces devicetree overlay building support for ARM platforms. The .dtbo target is introduced globally, then makefile changes for both arm32/64 for supporting the .dtbo target, changes to support sub-dir makefile flags, and finally adding the DTC flags override for TI platforms, as that is where we want to introduce the DT overlay support initially.

The ARM makefile changes for supporting DTS sub-makefiles don't look too clean, but that was the only way I could figure out how to get it done.

Quoted 6 lines
Quoted 4 lines

-Tero

--

This series does three unrelated things:

Well, I was kind of trying to show the whole solution here but...

Quoted 10 lines

(1) create a ti specific dts subdirectory arch/arm/boot/dts/ti/

(2) create a rule for creating a .dtbo from a .dtso

(3) add a dtc compile flag to add phandle symbol information to all .dtb files created from arch/arm/boot/dts/ti/ and arch/arm64/boot/dts/ti/

Please split the patches into three independent series so that each of the three concepts can be discussed separately.

Ok will do that, hopefully tomorrow. Didn't manage to squeeze in time to do it today.

-Tero
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

#10 lore raw

cover ARM32/64: DT overlay build support

Hi Tero,

(Really adding Mark as a cc: this time. Last time I added him as a bcc: by mistake.)

Quoted 17 lines · Tero Kristo
Quoted 16 lines · Frank Rowand

+ Mark Rutland, just in case he is interested

Quoted 13 lines · Tero Kristo

Hi,

This series introduces devicetree overlay building support for ARM platforms. The .dtbo target is introduced globally, then makefile changes for both arm32/64 for supporting the .dtbo target, changes to support sub-dir makefile flags, and finally adding the DTC flags override for TI platforms, as that is where we want to introduce the DT overlay support initially.

The ARM makefile changes for supporting DTS sub-makefiles don't look too clean, but that was the only way I could figure out how to get it done.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

-Tero

This series does three unrelated things:

Well, I was kind of trying to show the whole solution here but...

That actually makes sense, and normally I wouldn't have asked for the split. It might be the case that I am being too cautious, and maybe there won't be much discussion at all. I was just concerned that in this case some of the concepts might get overlooked due to discussion of other concepts. I'm also expecting different people to care about each of the concepts.

Quoted 5 lines
Quoted 5 lines

(1) create a ti specific dts subdirectory arch/arm/boot/dts/ti/

(2) create a rule for creating a .dtbo from a .dtso

Quoted 8 lines
Quoted 6 lines

(3) add a dtc compile flag to add phandle symbol information to ???? all .dtb files created from arch/arm/boot/dts/ti/ and ???? arch/arm64/boot/dts/ti/

Please split the patches into three independent series so that each of the three concepts can be discussed separately.

Ok will do that, hopefully tomorrow. Didn't manage to squeeze in time to do it today.

Thanks, I appreciate your flexibility.

-Frank

Quoted 5 lines

-Tero

Signature · 1 line
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#11 lore raw

cover ARM32/64: DT overlay build support

Quoted 49 lines · Frank Rowand

Hi Tero,

(Really adding Mark as a cc: this time. Last time I added him as a bcc: by mistake.)

Quoted 17 lines · Tero Kristo
Quoted 16 lines · Frank Rowand

+ Mark Rutland, just in case he is interested

Quoted 13 lines · Tero Kristo

Hi,

This series introduces devicetree overlay building support for ARM platforms. The .dtbo target is introduced globally, then makefile changes for both arm32/64 for supporting the .dtbo target, changes to support sub-dir makefile flags, and finally adding the DTC flags override for TI platforms, as that is where we want to introduce the DT overlay support initially.

The ARM makefile changes for supporting DTS sub-makefiles don't look too clean, but that was the only way I could figure out how to get it done.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

-Tero

This series does three unrelated things:

Well, I was kind of trying to show the whole solution here but...

That actually makes sense, and normally I wouldn't have asked for the split. It might be the case that I am being too cautious, and maybe there won't be much discussion at all. I was just concerned that in this case some of the concepts might get overlooked due to discussion of other concepts. I'm also expecting different people to care about each of the concepts.

Quoted 9 lines
Quoted 9 lines

(1) create a ti specific dts subdirectory arch/arm/boot/dts/ti/

(2) create a rule for creating a .dtbo from a .dtso

(3) add a dtc compile flag to add phandle symbol information to ???? all .dtb files created from arch/arm/boot/dts/ti/ and ???? arch/arm64/boot/dts/ti/

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Please split the patches into three independent series so that each of the three concepts can be discussed separately.

Ok will do that, hopefully tomorrow. Didn't manage to squeeze in time to do it today.

Thanks, I appreciate your flexibility.

Hi Frank,

I did post v2 as a split series on Friday, but seems I missed adding you in the delivery for those by accident... sorry about that. Do you want me to repost or can you pick those from the devicetree list?

-Tero

Quoted 8 lines

-Frank

Quoted 4 lines

-Tero

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

#12 lore raw

cover ARM32/64: DT overlay build support

Hi Tero,

Quoted 55 lines · Tero Kristo
Quoted 54 lines · Frank Rowand

Hi Tero,

(Really adding Mark as a cc: this time.? Last time I added him as a bcc: by mistake.)

Quoted 17 lines · Tero Kristo
Quoted 16 lines · Frank Rowand

+ Mark Rutland, just in case he is interested

Quoted 13 lines · Tero Kristo

Hi,

This series introduces devicetree overlay building support for ARM platforms. The .dtbo target is introduced globally, then makefile changes for both arm32/64 for supporting the .dtbo target, changes to support sub-dir makefile flags, and finally adding the DTC flags override for TI platforms, as that is where we want to introduce the DT overlay support initially.

The ARM makefile changes for supporting DTS sub-makefiles don't look too clean, but that was the only way I could figure out how to get it done.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

-Tero

--?

This series does three unrelated things:

Well, I was kind of trying to show the whole solution here but...

That actually makes sense, and normally I wouldn't have asked for the split.? It might be the case that I am being too cautious, and maybe there won't be much discussion at all.? I was just concerned that in this case some of the concepts might get overlooked due to discussion of other concepts.? I'm also expecting different people to care about each of the concepts.

Quoted 13 lines
Quoted 11 lines

(1) create a ti specific dts subdirectory arch/arm/boot/dts/ti/

(2) create a rule for creating a .dtbo from a .dtso

(3) add a dtc compile flag to add phandle symbol information to ????? all .dtb files created from arch/arm/boot/dts/ti/ and ????? arch/arm64/boot/dts/ti/

Please split the patches into three independent series so that each of the three concepts can be discussed separately.

Ok will do that, hopefully tomorrow. Didn't manage to squeeze in time to do it today.

Quoted 7 lines
Quoted 1 line

Thanks, I appreciate your flexibility.

Hi Frank,

I did post v2 as a split series on Friday, but seems I missed adding you in the delivery for those by accident... sorry about that. Do you want me to repost or can you pick those from the devicetree list?

Yes, please repost to be sure I see all the replys.

Thanks,

Frank

Quoted 14 lines

-Tero

Quoted 8 lines

-Frank

Quoted 4 lines

-Tero
--?

Signature · 1 line
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki