ARM: convert build of appended dtb zImage to list of dtbs

Allow CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE_NAMES to specify
a space separated list of dtbs to append to the zImage,
and name the resulting file zImage-dtb.

Change-Id: Ied5d0bafbd1d01fc1f109c15c4283de7029903c9
Signed-off-by: Colin Cross <ccross@android.com>
Git-commit: 9bb8731d87eba59fe7f0e504f11f5dc995ae1166
Git-repo: https://android.googlesource.com/kernel/common
[jshriram@codeaurora.org: Fixed minor merge conflicts]
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
This commit is contained in:
Colin Cross 2020-04-21 19:20:24 -07:00 • committed by Jeevan Shriram
commit d3cddb0cac
6 changed files with 33 additions and 6 deletions

View file

@ -1770,16 +1770,16 @@ config BUILD_ARM_APPENDED_DTB_IMAGE
bool "Build a concatenated zImage/dtb by default"
depends on OF
help
Enabling this option will cause a concatenated zImage and DTB to
be built by default (instead of a standalone zImage.) The image
will built in arch/arm/boot/zImage-dtb.<dtb name>
Enabling this option will cause a concatenated zImage and list of
DTBs to be built by default (instead of a standalone zImage.)
The image will built in arch/arm/boot/zImage-dtb
config BUILD_ARM_APPENDED_DTB_IMAGE_NAME
string "Default dtb name"
depends on BUILD_ARM_APPENDED_DTB_IMAGE
help
name of the dtb to append when building a concatenated
zImage/dtb.
Space separated list of names of dtbs to append when building a
concatenated zImage-dtb.
# Compressed boot loader in ROM. Yes, we really want to ask about
# TEXT and BSS so we preserve their values in the config files.

View file

@ -301,7 +301,7 @@ boot := arch/arm/boot
ifeq ($(CONFIG_XIP_KERNEL),y)
KBUILD_IMAGE := $(boot)/xipImage
else ifeq ($(CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE),y)
KBUILD_IMAGE := $(boot)/zImage-dtb.$(CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE_NAME)
KBUILD_IMAGE := $(boot)/zImage-dtb
else
KBUILD_IMAGE := $(boot)/zImage
endif

View file

@ -3,3 +3,4 @@ zImage
xipImage
bootpImage
uImage
zImage-dtb

View file

@ -31,6 +31,14 @@ export ZRELADDR INITRD_PHYS PARAMS_PHYS
targets := Image zImage xipImage bootpImage uImage
DTB_NAMES := $(subst $\",,$(CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE_NAMES))
ifneq ($(DTB_NAMES),)
DTB_LIST := $(addsuffix .dtb,$(DTB_NAMES))
else
DTB_LIST := $(dtb-y)
endif
DTB_OBJS := $(addprefix $(obj)/dts/,$(DTB_LIST))
ifeq ($(CONFIG_XIP_KERNEL),y)
cmd_deflate_xip_data = $(CONFIG_SHELL) -c \
@ -68,6 +76,10 @@ $(obj)/compressed/vmlinux: $(obj)/Image FORCE
$(obj)/zImage: $(obj)/compressed/vmlinux FORCE
$(call if_changed,objcopy)
$(obj)/zImage-dtb: $(obj)/zImage $(DTB_OBJS) FORCE
$(call if_changed,cat)
@echo ' Kernel: $@ is ready'
endif
ifneq ($(LOADADDR),)

View file

@ -1309,3 +1309,13 @@ vendor := $(dtstree)/vendor
ifneq "$(wildcard $(vendor)/Makefile)" ""
subdir-y += vendor
endif
DTB_NAMES := $(subst $\",,$(CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE_NAMES))
ifneq ($(DTB_NAMES),)
DTB_LIST := $(addsuffix .dtb,$(DTB_NAMES))
else
DTB_LIST := $(dtb-y)
endif
targets += dtbs dtbs_install
targets += $(DTB_LIST)

View file

@ -310,6 +310,10 @@ $(obj)/%.dt.yaml: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE
dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
# Concatentate multiple files together
quiet_cmd_cat = CAT $@
cmd_cat = (cat $(filter-out FORCE,$^) > $@) || (rm -f $@; false)
# Bzip2
# ---------------------------------------------------------------------------