Makefile: tpl: u-boot-tpl.dtb support include node with prop "u-boot,dm-tpl"

Without this patch, u-boot-tpl.dtb is always copy from u-boot-spl.dtb which
doesn't apply fdtgrep with "-b u-boot,dm-tpl".

Sometimes, the platform with critical sram size requires u-boot-tpl.dtb as
smaller as possible, so we use "u-boot,dm-tpl" prop to idendify what the
tpl really needs.

Rules:
"u-boot,dm-tpl": include node with prop for u-boot-tpl.dtb;
"u-boot,dm-spl": include node with prop for u-boot-spl.dtb;
"u-boot,pre-reloc": include node with prop for u-boot-tpl.dtb and u-boot-spl.dtb;

Change-Id: I29c2464d285174f4d0a4a1f8b91a84238ed82384
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
Joseph Chen 2019-06-19 08:34:33 +08:00 committed by Jianhong Chen
parent df5ff5a374
commit 8dd9db5d1c
2 changed files with 22 additions and 4 deletions

View File

@ -38,13 +38,23 @@ quiet_cmd_fdtgrep = FDTGREP $@
$(objtree)/tools/fdtgrep -r -O dtb - -o $@ \
$(addprefix -P ,$(subst $\",,$(CONFIG_OF_SPL_REMOVE_PROPS)))
fdtgrep_tpl_props := -b u-boot,dm-pre-reloc -b u-boot,dm-tpl
quiet_cmd_fdtgrep_tpl = FDTGREP $@
cmd_fdtgrep_tpl = $(objtree)/tools/fdtgrep $(fdtgrep_tpl_props) -RT $< \
-n /config -O dtb | \
$(objtree)/tools/fdtgrep -r -O dtb - -o $@ \
$(addprefix -P ,$(subst $\",,$(CONFIG_OF_SPL_REMOVE_PROPS)))
$(obj)/dt-tpl.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
$(call if_changed,fdtgrep_tpl)
$(obj)/dt-spl.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
$(call if_changed,fdtgrep)
$(obj)/dt.dtb: $(DTB) FORCE
$(call if_changed,shipped)
targets += dt.dtb dt-spl.dtb
targets += dt.dtb dt-spl.dtb dt-tpl.dtb
$(DTB): $(dtb_depends)
ifeq ($(EXT_DTB),)
@ -61,22 +71,25 @@ endif
arch-dtbs:
$(Q)$(MAKE) $(build)=$(ARCH_PATH) dtbs
.SECONDARY: $(obj)/dt.dtb.S $(obj)/dt-spl.dtb.S
.SECONDARY: $(obj)/dt.dtb.S $(obj)/dt-spl.dtb.S $(obj)/dt-tpl.dtb.S
ifeq ($(CONFIG_SPL_BUILD),y)
obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o
# support "out-of-tree" build for dtb-spl
$(obj)/dt-tpl.dtb.o: $(obj)/dt-tpl.dtb.S FORCE
$(call if_changed_dep,as_o_S)
$(obj)/dt-spl.dtb.o: $(obj)/dt-spl.dtb.S FORCE
$(call if_changed_dep,as_o_S)
else
obj-$(CONFIG_OF_EMBED) := dt.dtb.o
endif
dtbs: $(obj)/dt.dtb $(obj)/dt-spl.dtb
dtbs: $(obj)/dt.dtb $(obj)/dt-spl.dtb $(obj)/dt-tpl.dtb
@:
clean-files := dt.dtb.S dt-spl.dtb.S
clean-files := dt.dtb.S dt-spl.dtb.S dt-tpl.dtb.S
# Let clean descend into dts directories
subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/mips/dts ../arch/sandbox/dts ../arch/x86/dts

View File

@ -246,8 +246,13 @@ $(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;
ifeq ($(CONFIG_TPL_BUILD),y)
$(obj)/$(SPL_BIN).dtb: dts/dt-tpl.dtb FORCE
$(call if_changed,copy)
else
$(obj)/$(SPL_BIN).dtb: dts/dt-spl.dtb FORCE
$(call if_changed,copy)
endif
pythonpath = PYTHONPATH=scripts/dtc/pylibfdt