summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2013-02-12 15:03:37 -0700
committerDong Aisheng <b29396@freescale.com>2013-05-20 13:52:02 +0800
commitfef90a5c3951dfb753d01bd33519f2c15708b5fd (patch)
tree23c372a9506b448cbe124d959aeca47edd119419 /scripts
parent62e99489e040e5a5ff215b73d892d838770f080b (diff)
kbuild: limit dtc+cpp include path
Device tree source files may now include header files. The intent is that those header files define/name constants used as part of the DT bindings. Currently this feature is open to abuse, since any kernel header file at all can be included, This could allow device tree files to become dependant on kernel headers files, and thus make them no longer OS-independent. This would also prevent separating the device tree source files from the kernel repository. Solve this by limiting the cpp include path for device tree files to separate directories. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Dong Aisheng <b29396@freescale.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.lib8
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 7910229ec665..07125e697d7a 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -156,6 +156,11 @@ cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
ld_flags = $(LDFLAGS) $(ldflags-y)
+dtc_cpp_flags = -Wp,-MD,$(depfile) -nostdinc \
+ -I$(srctree)/arch/$(SRCARCH)/boot/dts \
+ -I$(srctree)/arch/$(SRCARCH)/include/dts \
+ -undef -D__DTS__
+
# Finds the multi-part object the current object will be linked into
modname-multi = $(sort $(foreach m,$(multi-used),\
$(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=))))
@@ -272,8 +277,7 @@ $(obj)/%.dtb: $(src)/%.dts FORCE
dtc-tmp = $(subst $(comma),_,$(dot-target).dts)
quiet_cmd_dtc_cpp = DTC+CPP $@
-cmd_dtc_cpp = $(CPP) $(cpp_flags) -x assembler-with-cpp -undef -D__DTS__ \
- -o $(dtc-tmp) $< ; \
+cmd_dtc_cpp = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
$(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) $(dtc-tmp)
$(obj)/%.dtb: $(src)/%.dtsp FORCE