kernel: Add support to append DTBs to kernel image
* Many Qualcomm targets that uses boot header v0 or v1 have the DTBs appended to the end of kernel image. * In downstream msm kernels up to msm-4.19, Appending DTBs is handled in the kernel tree. However, on msm-5.4 and newer msm kernels, and on mainline kernel, This is not supported. * Normally, DTB processing depends on how the bootloader loads it and should not be handled in the kernel tree, so we handle it here. * Instead of appending all DTBs by default, Get the list of DTBs that needs to be included from a variable, so that we don't need to modify dts Makefile to exclude unwanted DTBs, and we could also ensure the DTBs are appended in a specific order. Change-Id: I603d1ebac5ee808bad045b85f9868d572d52cb80
This commit is contained in:
committed by
Jan Altensen
parent
a699cdecbf
commit
f171568f8b
@@ -41,6 +41,9 @@
|
|||||||
# For example, for ARM devices,
|
# For example, for ARM devices,
|
||||||
# use zImage-dtb instead of zImage.
|
# use zImage-dtb instead of zImage.
|
||||||
#
|
#
|
||||||
|
# BOARD_KERNEL_APPEND_DTBS = List of DTBs to be appended to the kernel image,
|
||||||
|
# wildcard is allowed for filename.
|
||||||
|
#
|
||||||
# BOARD_DTB_CFG = Path to a mkdtboimg config file for dtb.img
|
# BOARD_DTB_CFG = Path to a mkdtboimg config file for dtb.img
|
||||||
#
|
#
|
||||||
# BOARD_DTBO_CFG = Path to a mkdtboimg config file
|
# BOARD_DTBO_CFG = Path to a mkdtboimg config file
|
||||||
@@ -688,14 +691,37 @@ endif
|
|||||||
|
|
||||||
## Install it
|
## Install it
|
||||||
|
|
||||||
|
ifeq ($(or $(FULL_RECOVERY_KERNEL_BUILD), $(FULL_KERNEL_BUILD)),true)
|
||||||
|
|
||||||
|
# Append DTBs to kernel image
|
||||||
|
# $(1): output directory path (The value passed to O=)
|
||||||
|
# $(2): output kernel image path
|
||||||
|
define append-dtbs-to-kernel-image
|
||||||
|
$(hide) if grep -q '^CONFIG_OF=y' $(1)/.config; then \
|
||||||
|
$(if $(BOARD_KERNEL_APPEND_DTBS),\
|
||||||
|
echo "Appending DTBs to kernel image";\
|
||||||
|
$(foreach dtb,$(BOARD_KERNEL_APPEND_DTBS),\
|
||||||
|
cat `find $(1)/arch/$(KERNEL_ARCH)/boot/dts/$(dir $(dtb)) -maxdepth 1 -type f -name "$(notdir $(dtb))"` >> $(2);\
|
||||||
|
)\
|
||||||
|
)\
|
||||||
|
true;\
|
||||||
|
fi
|
||||||
|
endef
|
||||||
|
|
||||||
|
endif # FULL_RECOVERY_KERNEL_BUILD or FULL_KERNEL_BUILD
|
||||||
|
|
||||||
ifeq ($(NEEDS_KERNEL_COPY),true)
|
ifeq ($(NEEDS_KERNEL_COPY),true)
|
||||||
$(INSTALLED_KERNEL_TARGET): $(KERNEL_BIN)
|
$(INSTALLED_KERNEL_TARGET): $(KERNEL_BIN)
|
||||||
$(transform-prebuilt-to-target)
|
$(transform-prebuilt-to-target)
|
||||||
|
$(if $(filter true,$(FULL_KERNEL_BUILD)),\
|
||||||
|
$(call append-dtbs-to-kernel-image,$(KERNEL_OUT),$@))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(RECOVERY_KERNEL_COPY),true)
|
ifeq ($(RECOVERY_KERNEL_COPY),true)
|
||||||
$(INSTALLED_RECOVERY_KERNEL_TARGET): $(RECOVERY_BIN)
|
$(INSTALLED_RECOVERY_KERNEL_TARGET): $(RECOVERY_BIN)
|
||||||
$(transform-prebuilt-to-target)
|
$(transform-prebuilt-to-target)
|
||||||
|
$(if $(filter true,$(FULL_RECOVERY_KERNEL_BUILD)),\
|
||||||
|
$(call append-dtbs-to-kernel-image,$(RECOVERY_KERNEL_OUT),$@))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: recovery-kernel
|
.PHONY: recovery-kernel
|
||||||
|
Reference in New Issue
Block a user