summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-06-23 15:38:29 -0600
committerSimon Glass <sjg@chromium.org>2015-07-21 17:39:21 -0600
commitfa78e0a37173211d75e9606257bc028f066962cf (patch)
tree51df2d7c98c352953586bbb29885177e08bb80dc /scripts
parent1043d0a0296a8580fd497a2eb1f411eb07ba98c1 (diff)
downloadu-boot-fa78e0a37173211d75e9606257bc028f066962cf.tar.gz
u-boot-fa78e0a37173211d75e9606257bc028f066962cf.tar.bz2
u-boot-fa78e0a37173211d75e9606257bc028f066962cf.zip
dm: Reduce SPL device tree size
The SPL device tree size must be minimised to save memory. Only include properties that are needed by SPL - this is determined by the presence of the "u-boot,dm-pre-reloc" property. Also remove a predefined list of unused properties from the nodes that remain. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.spl28
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index fd572f4b47..bcc7ca2f89 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -151,6 +151,8 @@ boot.bin: $(obj)/u-boot-spl.bin
ALL-y += $(obj)/$(SPL_BIN).bin $(obj)/$(SPL_BIN).cfg
+ALL-$(CONFIG_OF_SEPARATE) += $(obj)/$(SPL_BIN)-pad.bin $(obj)/$(SPL_BIN)-dtb.bin
+
ifdef CONFIG_SAMSUNG
ALL-y += $(obj)/$(BOARD)-spl.bin
endif
@@ -165,6 +167,32 @@ endif
all: $(ALL-y)
+quiet_cmd_cat = CAT $@
+cmd_cat = cat $(filter-out $(PHONY), $^) > $@
+
+$(obj)/$(SPL_BIN)-dtb.bin: $(obj)/$(SPL_BIN).bin $(obj)/$(SPL_BIN)-pad.bin \
+ $(obj)/$(SPL_BIN).dtb FORCE
+ $(call if_changed,cat)
+
+# Create a file that pads from the end of u-boot-spl.bin to bss_end
+$(obj)/$(SPL_BIN)-pad.bin: $(obj)/$(SPL_BIN)
+ @bss_size_str=$(shell $(NM) $< | awk 'BEGIN {size = 0} /__bss_size/ {size = $$1} END {print "ibase=16; " toupper(size)}' | bc); \
+ dd if=/dev/zero of=$@ bs=1 count=$${bss_size_str} 2>/dev/null;
+
+# 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.
+quiet_cmd_fdtgrep = FDTGREP $@
+ cmd_fdtgrep = $(objtree)/tools/fdtgrep -b u-boot,dm-pre-reloc -RT $< \
+ -n /chosen -O dtb | \
+ $(objtree)/tools/fdtgrep -r -O dtb - -o $@ \
+ $(addprefix -P ,$(subst $\",,$(CONFIG_OF_SPL_REMOVE_PROPS)))
+
+$(obj)/$(SPL_BIN).dtb: dts/dt.dtb
+ $(call cmd,fdtgrep)
+
quiet_cmd_cpp_cfg = CFG $@
cmd_cpp_cfg = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \
-DDO_DEPS_ONLY -D__ASSEMBLY__ -x assembler-with-cpp -P -dM -E -o $@ $<