dts: Makefile: support provide a minimum SPL DTB

Some boards need a SPL DTB as smaller as possible to save dm scan
time and space. It provides a SPL DTB only include the node with
property "u-boot,dm-spl". The property "u-boot,pre-reloc" doesn't
work any more.

This feature is disabled by default to compatible current boards,
only the board really cares about boot time needs it.

Fix "/chosen" is deleted for TPL DTB.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I743d7b734daff6e0508e01f534078663d809952f
This commit is contained in:
Joseph Chen 2020-02-17 19:23:23 +08:00 committed by Jianhong Chen
parent fcdd83d445
commit 4447bf1624
2 changed files with 23 additions and 1 deletions

View File

@ -47,6 +47,16 @@ config SPL_OF_CONTROL
which is not enough to support device tree. Enable this option to which is not enough to support device tree. Enable this option to
allow such boards to be supported by U-Boot SPL. allow such boards to be supported by U-Boot SPL.
config SPL_DTB_MINIMUM
bool "Provide a minimum SPL DTB "
depends on SPL_OF_CONTROL
default n
help
Some boards need a SPL DTB as smaller as possible to save dm scan
time and space. It provides a SPL DTB only include the node with
property "u-boot,dm-spl". The property "u-boot,pre-reloc" doesn't
work any more.
config TPL_OF_CONTROL config TPL_OF_CONTROL
bool "Enable run-time configuration via Device Tree in TPL" bool "Enable run-time configuration via Device Tree in TPL"
depends on TPL && OF_CONTROL depends on TPL && OF_CONTROL

View File

@ -41,15 +41,27 @@ quiet_cmd_fdtgrep = FDTGREP $@
fdtgrep_tpl_props := -b u-boot,dm-pre-reloc -b u-boot,dm-tpl fdtgrep_tpl_props := -b u-boot,dm-pre-reloc -b u-boot,dm-tpl
quiet_cmd_fdtgrep_tpl = FDTGREP $@ quiet_cmd_fdtgrep_tpl = FDTGREP $@
cmd_fdtgrep_tpl = $(objtree)/tools/fdtgrep $(fdtgrep_tpl_props) -RT $< \ cmd_fdtgrep_tpl = $(objtree)/tools/fdtgrep $(fdtgrep_tpl_props) -RT $< \
-n /config -O dtb | \ -n /chosen -n config -O dtb | \
$(objtree)/tools/fdtgrep -r -O dtb - -o $@ \
$(addprefix -P ,$(subst $\",,$(CONFIG_OF_SPL_REMOVE_PROPS)))
fdtgrep_spl_minimum_props := -b u-boot,dm-spl
quiet_cmd_fdtgrep_spl_minimum = FDTGREP $@
cmd_fdtgrep_spl_minimum = $(objtree)/tools/fdtgrep $(fdtgrep_spl_minimum_props) -RT $< \
-n /chosen -n config -O dtb | \
$(objtree)/tools/fdtgrep -r -O dtb - -o $@ \ $(objtree)/tools/fdtgrep -r -O dtb - -o $@ \
$(addprefix -P ,$(subst $\",,$(CONFIG_OF_SPL_REMOVE_PROPS))) $(addprefix -P ,$(subst $\",,$(CONFIG_OF_SPL_REMOVE_PROPS)))
$(obj)/dt-tpl.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE $(obj)/dt-tpl.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
$(call if_changed,fdtgrep_tpl) $(call if_changed,fdtgrep_tpl)
ifeq ($(CONFIG_SPL_DTB_MINIMUM),y)
$(obj)/dt-spl.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
$(call if_changed,fdtgrep_spl_minimum)
else
$(obj)/dt-spl.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE $(obj)/dt-spl.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
$(call if_changed,fdtgrep) $(call if_changed,fdtgrep)
endif
ifeq ($(CONFIG_USING_KERNEL_DTB),y) ifeq ($(CONFIG_USING_KERNEL_DTB),y)
$(obj)/dt.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE $(obj)/dt.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE