kbuild: fixdep: Resync this with v4.17
[oweals/u-boot.git] / scripts / Makefile.lib
index ef116e0e0aeb8ae65f9619281bf4e82db06af8d4..30f392fdfb08ce52d3bf8818da13b6b98aaf8523 100644 (file)
@@ -292,6 +292,10 @@ cmd_dt_S_dtb=                                              \
 $(obj)/%.dtb.S: $(obj)/%.dtb
        $(call cmd,dt_S_dtb)
 
+ifeq ($(CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY),y)
+DTC_FLAGS += -@
+endif
+
 quiet_cmd_dtc = DTC     $@
 # Modified for U-Boot
 # Bring in any U-Boot-specific include at the end of the file
@@ -300,7 +304,9 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
        $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
        $(DTC) -O dtb -o $@ -b 0 \
                -i $(dir $<) $(DTC_FLAGS) \
-               -d $(depfile).dtc.tmp $(dtc-tmp) ; \
+               -d $(depfile).dtc.tmp $(dtc-tmp) || \
+               (echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \
+               ; \
        cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) ; \
        sed -i "s:$(pre-tmp):$(<):" $(depfile)
 
@@ -538,3 +544,11 @@ quiet_cmd_fdtgrep = FDTGREP $@
        $(objtree)/tools/fdtgrep -r -O dtb - -o $@ \
                -P u-boot,dm-pre-reloc -P u-boot,dm-spl -P u-boot,dm-tpl \
                $(addprefix -P ,$(subst $\",,$(CONFIG_OF_SPL_REMOVE_PROPS)))
+
+# fdt_rm_props
+# ---------------------------------------------------------------------------
+# Pass the original device tree file through fdtgrep. This removes various
+# unused properties. The output is typically a smaller device tree file.
+quiet_cmd_fdt_rm_props = FDTGREP $@
+       cmd_fdt_rm_props = cat $< | $(objtree)/tools/fdtgrep -r -O dtb - -o $@ \
+                       $(addprefix -P ,$(subst $\",,$(CONFIG_OF_REMOVE_PROPS)))