Skip to contentSkip to conversation

kbuild: Don't assume dts files live in arch/*/boot/dts

PATCH In review Matthijs Kooijman 3 participants 5 messages May 8, 2013 – May 23, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: Don't assume dts files live in arch/*/boot/dts

In commit b40b25ff (kbuild: always run gcc -E on *.dts, remove cmd_dtc_cpp), dts building was changed to always use the C preprocessor. This meant that the .dts file passed to dtc is not the original, but the preprocessed one.

When compiling with a separate build directory (i.e., with O=), this preprocessed file will not live in the same directory as the original. When the .dts file includes .dtsi files, dtc will look for them in the build directory, not in the source directory and compilation will fail.

The commit referenced above tried to fix this by passing arch/*/boot/dts as an include path to dtc. However, for mips, the .dts files are not in this directory, so dts compilation on mips breaks for some targets.

Instead of hardcoding this particular include path, this commit just uses the directory of the .dts file that is being compiled, which effectively restores the previous behaviour wrt includes. For most .dts files, this path is just the same as the previous hardcoded arch/*/boot/dts path.

This was tested on a mips (rt3052) and an arm (bcm2835) target.

---
 scripts/Makefile.lib | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.lib +1 -1
index 51bb3de..8337663 100644
@@ -264,7 +264,7 @@ $(obj)/%.dtb.S: $(obj)/%.dtb
 quiet_cmd_dtc = DTC     $@
 cmd_dtc = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
 	$(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 \
-		-i $(srctree)/arch/$(SRCARCH)/boot/dts $(DTC_FLAGS) \
+		-i $(dir $<) $(DTC_FLAGS) \
 		-d $(depfile).dtc $(dtc-tmp) ; \
 	cat $(depfile).pre $(depfile).dtc > $(depfile)
 
Signature · 1 line
1.8.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Matthijs Kooijman

In commit b40b25ff (kbuild: always run gcc -E on *.dts, remove cmd_dtc_cpp), dts building was changed to always use the C preprocessor. This meant that the .dts file passed to dtc is not the original, but the preprocessed one.

When compiling with a separate build directory (i.e., with O=), this preprocessed file will not live in the same directory as the original. When the .dts file includes .dtsi files, dtc will look for them in the build directory, not in the source directory and compilation will fail.

The commit referenced above tried to fix this by passing arch/*/boot/dts as an include path to dtc. However, for mips, the .dts files are not in this directory, so dts compilation on mips breaks for some targets.

Quoted 7 lines

Instead of hardcoding this particular include path, this commit just uses the directory of the .dts file that is being compiled, which effectively restores the previous behaviour wrt includes. For most .dts files, this path is just the same as the previous hardcoded arch/*/boot/dts path.

This was tested on a mips (rt3052) and an arm (bcm2835) target.

(although I wonder if the .dts files shouldn't be in a standard location?)

#2 lore raw

Hey Stephen,

Quoted 8 lines · Stephen Warren
Quoted 5 lines · Matthijs Kooijman

...
The commit referenced above tried to fix this by passing arch/*/boot/dts as an include path to dtc. However, for mips, the .dts files are not in this directory, so dts compilation on mips breaks for some targets.
...

(although I wonder if the .dts files shouldn't be in a standard location?)

On mips, I think the dts files are stored together with the soc code in per-manufacturer directories, which probably works for them.

Regardless of that discussion, I think my patch makes the dts handling code more generic, so it's probably a good idea to include it anyway.

#3 lore raw
In reply to Stephen Warren

Hi Michal,

Quoted 21 lines · Stephen Warren
Quoted 20 lines · Matthijs Kooijman

In commit b40b25ff (kbuild: always run gcc -E on *.dts, remove cmd_dtc_cpp), dts building was changed to always use the C preprocessor. This meant that the .dts file passed to dtc is not the original, but the preprocessed one.

When compiling with a separate build directory (i.e., with O=), this preprocessed file will not live in the same directory as the original. When the .dts file includes .dtsi files, dtc will look for them in the build directory, not in the source directory and compilation will fail.

The commit referenced above tried to fix this by passing arch/*/boot/dts as an include path to dtc. However, for mips, the .dts files are not in this directory, so dts compilation on mips breaks for some targets.

Instead of hardcoding this particular include path, this commit just uses the directory of the .dts file that is being compiled, which effectively restores the previous behaviour wrt includes. For most .dts files, this path is just the same as the previous hardcoded arch/*/boot/dts path.

Quoted 3 lines
Quoted 1 line

This was tested on a mips (rt3052) and an arm (bcm2835) target.

Did this patch look ok to you? If so, could you pick it up and send it over to Linus for 3.10 (or should I send it directly)?

Gr.

Matthijs

#4 lore raw
Quoted 24 lines · Matthijs Kooijman

Hi Michal,

Quoted 21 lines · Stephen Warren
Quoted 20 lines · Matthijs Kooijman

In commit b40b25ff (kbuild: always run gcc -E on *.dts, remove cmd_dtc_cpp), dts building was changed to always use the C preprocessor. This meant that the .dts file passed to dtc is not the original, but the preprocessed one.

When compiling with a separate build directory (i.e., with O=), this preprocessed file will not live in the same directory as the original. When the .dts file includes .dtsi files, dtc will look for them in the build directory, not in the source directory and compilation will fail.

The commit referenced above tried to fix this by passing arch/*/boot/dts as an include path to dtc. However, for mips, the .dts files are not in this directory, so dts compilation on mips breaks for some targets.

Instead of hardcoding this particular include path, this commit just uses the directory of the .dts file that is being compiled, which effectively restores the previous behaviour wrt includes. For most .dts files, this path is just the same as the previous hardcoded arch/*/boot/dts path.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

This was tested on a mips (rt3052) and an arm (bcm2835) target.

Did this patch look ok to you? If so, could you pick it up and send it over to Linus for 3.10 (or should I send it directly)?

I applied the patch to kbuild.git#rc-fixes now.

Michal