dts: Makefile: simplify the logic of kernel dtb feature

Our purpose is replacing the u-boot.dtb with u-boot-spl.dtb
when kernel dtb feature is enabled. The current logic is too
complicated and not easy to extend new features.

The best way is to generate but not replace a u-boot.dtb the
same as u-boot-spl.dtb during DTB compile process.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I678ec7c60c91ecc6f6f0a935e50a691c52c94162
This commit is contained in:
Joseph Chen 2020-02-17 18:13:28 +08:00 committed by Jianhong Chen
parent da5d85a3ee
commit fcdd83d445
2 changed files with 8 additions and 22 deletions

View File

@ -875,16 +875,11 @@ endif
$(call cmd,cfgcheck,u-boot.cfg)
PHONY += dtbs
dtbs: dts/dt.dtb dts/dt-spl.dtb
dtbs: dts/dt.dtb
@:
dts/dt.dtb: u-boot
$(Q)$(MAKE) $(build)=dts dtbs
ifeq ($(CONFIG_USING_KERNEL_DTB),y)
dts/dt-spl.dtb: dts/dt.dtb
@:
endif
quiet_cmd_copy = COPY $@
cmd_copy = cp $< $@
@ -906,8 +901,8 @@ u-boot-fit-dtb.bin: u-boot-nodtb.bin fit-dtb.blob
u-boot.bin: u-boot-fit-dtb.bin FORCE
$(call if_changed,copy)
else ifeq ($(CONFIG_OF_SEPARATE),y)
ifeq ($(CONFIG_USING_KERNEL_DTB),y)
u-boot-dtb.bin: u-boot-nodtb.bin dts/dt-spl.dtb FORCE
u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE
$(call if_changed,cat)
ifneq ($(wildcard dts/kern.dtb),)
@ -921,13 +916,7 @@ u-boot.bin: u-boot-dtb.bin FORCE
$(call if_changed,copy)
$(call if_changed,truncate)
endif
else
u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE
$(call if_changed,cat)
u-boot.bin: u-boot-dtb.bin FORCE
$(call if_changed,copy)
endif
else
u-boot.bin: u-boot-nodtb.bin FORCE
$(call if_changed,copy)
@ -942,11 +931,7 @@ endif
quiet_cmd_copy = COPY $@
cmd_copy = cp $< $@
ifeq ($(CONFIG_USING_KERNEL_DTB),y)
u-boot.dtb: dts/dt-spl.dtb FORCE
else
u-boot.dtb: dts/dt.dtb FORCE
endif
$(call cmd,copy)
OBJCOPYFLAGS_u-boot.hex := -O ihex
@ -1054,11 +1039,7 @@ u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl u-boot-ivt.img: \
$(if $(CONFIG_SPL_LOAD_FIT),u-boot-nodtb.bin dts/dt.dtb,u-boot.bin) FORCE
$(call if_changed,mkimage)
ifeq ($(CONFIG_USING_KERNEL_DTB),y)
u-boot.itb: u-boot-nodtb.bin dts/dt-spl.dtb $(U_BOOT_ITS) FORCE
else
u-boot.itb: u-boot-nodtb.bin dts/dt.dtb $(U_BOOT_ITS) FORCE
endif
$(call if_changed,mkfitimage)
u-boot-spl.kwb: u-boot.img spl/u-boot-spl.bin FORCE

View File

@ -51,8 +51,13 @@ $(obj)/dt-tpl.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
$(obj)/dt-spl.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
$(call if_changed,fdtgrep)
ifeq ($(CONFIG_USING_KERNEL_DTB),y)
$(obj)/dt.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
$(call if_changed,fdtgrep)
else
$(obj)/dt.dtb: $(DTB) FORCE
$(call if_changed,shipped)
endif
targets += dt.dtb dt-spl.dtb dt-tpl.dtb