dtbo.img: build device tree overlay partition image

Inspired by "828e0b45 yueyao@ build device tree overlay partition
image", integrating the same feature into floral kernel. The difference
is all build-time generated *.dtbo are packed into dtbo.img instead of
packing only the dtbos specified by the dtboimg.cfg.

dtbo.img is built only when CONFIG_BUILD_ARM64_DT_OVERLAY is set.

Change-Id: Ic0ed97fe699ee56e7272001064abb584690aa40a
Signed-off-by: Woody Lin <woodylin@google.com>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
Signed-off-by: Carlos Jimenez (JavaShin-X) <javashin1986@gmail.com>
Signed-off-by: starlight5234 <starlight5234@protonmail.ch>
This commit is contained in:
Woody Lin 2021-02-03 01:27:06 -04:00 committed by Gagan Malvi
parent 532a685ebb
commit 22f10659be
No known key found for this signature in database
GPG key ID: B932A7CE71E9198F
4 changed files with 21 additions and 1 deletions

View file

@ -148,6 +148,8 @@ endif
KBUILD_DTBS := dtbs
KBUILD_DTBO_IMG := dtbo.img
ifeq ($(CONFIG_BUILD_ARM64_DT_OVERLAY),y)
export DTC_FLAGS := -@
endif
@ -180,6 +182,13 @@ Image-dtb: vmlinux scripts dtbs
Image.gz-dtb: vmlinux scripts dtbs Image.gz
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
ifeq ($(CONFIG_BUILD_ARM64_DT_OVERLAY),y)
$(KBUILD_DTBO_IMG): dtbs
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
all: $(KBUILD_DTBO_IMG)
endif
PHONY += vdso_install
vdso_install:
$(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@

View file

@ -2,3 +2,4 @@ Image
Image-dtb
Image.gz
Image.gz-dtb
dtbo.img

View file

@ -18,7 +18,7 @@ include $(srctree)/arch/arm64/boot/dts/Makefile
OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
targets := Image Image.bz2 Image.gz Image.lz4 Image.lzma Image.lzo
targets := Image Image.bz2 Image.gz Image.lz4 Image.lzma Image.lzo dtbo.img
DTB_NAMES := $(subst $\",,$(CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE_NAMES))
ifneq ($(DTB_NAMES),)
@ -28,6 +28,8 @@ DTB_LIST := $(dtb-y)
endif
DTB_OBJS := $(shell find $(obj)/dts/ -name \*.dtb)
DTBO_OBJS := $(shell find $(obj)/dts/ -name \*.dtbo)
# Add RTIC DTB to the DTB list if RTIC MPGen is enabled
# Note, we keep this for compatibility with
# BUILD_ARM64_APPENDED_DTB_IMAGE targets.
@ -68,6 +70,9 @@ $(obj)/Image.lzo: $(obj)/Image FORCE
$(obj)/Image.gz-dtb: $(obj)/Image.gz $(DTB_OBJS) FORCE
$(call if_changed,cat)
$(obj)/dtbo.img: $(DTBO_OBJS) FORCE
$(call if_changed,mkdtimg)
install:
$(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
$(obj)/Image System.map "$(INSTALL_PATH)"

View file

@ -320,6 +320,11 @@ $(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE
dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
# mkdtimg
#----------------------------------------------------------------------------
quiet_cmd_mkdtimg = DTBOIMG $@
cmd_mkdtimg = mkdtimg create $@ --page_size=4096 $(filter-out FORCE,$^)
# cat
# ---------------------------------------------------------------------------
# Concatentate multiple files together