]> git.sur5r.net Git - u-boot/blobdiff - scripts/Makefile.lib
mmc: sh_mmcif: Migrate configs to CONFIG_SH_MMCIF
[u-boot] / scripts / Makefile.lib
index 0d5c5291a1b6fda40dc826a38bf7d53dd83de251..c6b3f6906499056f708b39f6bc3d3ce9d7082f2f 100644 (file)
@@ -165,17 +165,27 @@ cpp_flags      = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE)     \
 ld_flags       = $(LDFLAGS) $(ldflags-y)
 
 # Try these files in order to find the U-Boot-specific .dtsi include file
-u_boot_dtsi_options = $(wildcard $(dir $<)$(basename $(notdir $<))-u-boot.dtsi) \
+u_boot_dtsi_options = $(strip $(wildcard $(dir $<)$(basename $(notdir $<))-u-boot.dtsi) \
        $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi) \
        $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \
        $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \
-       $(wildcard $(dir $<)u-boot.dtsi)
+       $(wildcard $(dir $<)u-boot.dtsi))
+
+u_boot_dtsi_options_raw = $(warning Automatic .dtsi inclusion: options: \
+       $(dir $<)$(basename $(notdir $<))-u-boot.dtsi \
+       $(dir $<)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi \
+       $(dir $<)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi \
+       $(dir $<)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi \
+       $(dir $<)u-boot.dtsi ... \
+       found: $(if $(u_boot_dtsi_options),"$(u_boot_dtsi_options)",nothing!))
 
 # Uncomment for debugging
-# $(warning u_boot_dtsi_options: $(u_boot_dtsi_options))
+# This shows all the files that were considered and the one that we chose.
+# u_boot_dtsi_options_debug = $(u_boot_dtsi_options_raw)
 
 # We use the first match
-u_boot_dtsi = $(notdir $(firstword $(u_boot_dtsi_options)))
+u_boot_dtsi = $(strip $(u_boot_dtsi_options_debug) \
+       $(notdir $(firstword $(u_boot_dtsi_options))))
 
 # Modified for U-Boot
 dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
@@ -511,4 +521,22 @@ cmd_xzmisc = (cat $(filter-out FORCE,$^) | \
 MKIMAGEOUTPUT ?= /dev/null
 quiet_cmd_mkimage = MKIMAGE $@
 cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \
-       $(if $(KBUILD_VERBOSE:1=), >$(MKIMAGEOUTPUT))
+       >$(MKIMAGEOUTPUT) $(if $(KBUILD_VERBOSE:0=), && cat $(MKIMAGEOUTPUT))
+
+# fdtgrep
+# ---------------------------------------------------------------------------
+# Pass the original device tree file through fdtgrep twice. The first pass
+# removes any unwanted nodes (i.e. those which don't have the
+# 'u-boot,dm-pre-reloc' property and thus are not needed by SPL. The second
+# pass removes various unused properties from the remaining nodes.
+# The output is typically a much smaller device tree file.
+ifeq ($(CONFIG_TPL_BUILD),y)
+fdtgrep_props := -b u-boot,dm-pre-reloc -b u-boot,dm-tpl
+else
+fdtgrep_props := -b u-boot,dm-pre-reloc -b u-boot,dm-spl
+endif
+quiet_cmd_fdtgrep = FDTGREP $@
+      cmd_fdtgrep = $(objtree)/tools/fdtgrep $(fdtgrep_props) -RT $< \
+               -n /chosen -n /config -O dtb | \
+       $(objtree)/tools/fdtgrep -r -O dtb - -o $@ \
+               $(addprefix -P ,$(subst $\",,$(CONFIG_OF_SPL_REMOVE_PROPS)))