build: Add support for device tree in boot.img
Add support for optional device tree image (dt.img) to boot and recovery images. Some devices use kernel device tree and this adds the device tree image as a section within the boot/recovery images. Change-Id: I91431ef2f4b86485895678916e39a8572be878eb Build: add DT image variable to Makefile DT image variable is currently present in generate_extra_images.mk.This file is moved to build/tasks to support persist image generation during parallel make. As build/tasks is called at the end of Makefile, DT image variable is not available for other images generation like boot and recovery. Adding this variable in Makefile ensures the variable is defined before usage Change-Id: I21f675d8ce648dc1cf1f4f3aede33278300e08c9 CRs-fixed: 548299 Fix case where boot/recovery.img were being built with wrong params. The boot and recovery images now get built using the same params during ota package generation as during a normal build. Change-Id: I93d46e11a4245288f0e87c87a2e4bf45ac5aff69 Fix the extra dt.img compilation issue. Add support for optional device tree image (dt.img) for device that doesnt have TARGET_BOOTIMAGE_USE_EXT2 Change-Id: I6e07b3ca6d049a8ebdad7ea304b4f39e7c846151 releasetools: Store and use the dt image file through target files Target files packages may be used for signing images separate from the build process. Store the device tree image file in the target files package so it can be used during the signing process. Change-Id: Ie8507121fa9c4ba57ecffeab05bd859ae5f5b788
This commit is contained in:
@@ -1418,6 +1418,12 @@ else ifndef BUILDING_VENDOR_BOOT_IMAGE # && BOARD_USES_GENERIC_KERNEL_IMAGE != t
|
||||
endif
|
||||
endif # BUILDING_VENDOR_BOOT_IMAGE == "" && BOARD_USES_GENERIC_KERNEL_IMAGE != true
|
||||
|
||||
ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true)
|
||||
INSTALLED_DTIMAGE_TARGET := $(PRODUCT_OUT)/dt.img
|
||||
INTERNAL_BOOTIMAGE_ARGS += --dt $(INSTALLED_DTIMAGE_TARGET)
|
||||
BOOTIMAGE_EXTRA_DEPS := $(INSTALLED_DTIMAGE_TARGET)
|
||||
endif
|
||||
|
||||
INTERNAL_MKBOOTIMG_VERSION_ARGS := \
|
||||
--os_version $(PLATFORM_VERSION_LAST_STABLE) \
|
||||
--os_patch_level $(PLATFORM_SECURITY_PATCH)
|
||||
@@ -1442,7 +1448,7 @@ define build_boot_board_avb_enabled
|
||||
$(call build_boot_from_kernel_avb_enabled,$(1),$(kernel))
|
||||
endef
|
||||
|
||||
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(AVBTOOL) $(INTERNAL_BOOTIMAGE_FILES) $(BOARD_AVB_BOOT_KEY_PATH)
|
||||
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(AVBTOOL) $(INTERNAL_BOOTIMAGE_FILES) $(BOARD_AVB_BOOT_KEY_PATH) $(BOOTIMAGE_EXTRA_DEPS)
|
||||
$(call pretty,"Target boot image: $@")
|
||||
$(call build_boot_board_avb_enabled,$@)
|
||||
|
||||
@@ -1456,7 +1462,30 @@ bootimage-nodeps: $(MKBOOTIMG) $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
|
||||
@echo "make $@: ignoring dependencies"
|
||||
$(foreach b,$(INSTALLED_BOOTIMAGE_TARGET),$(call build_boot_board_avb_enabled,$(b)))
|
||||
|
||||
else # BOARD_AVB_ENABLE != true
|
||||
else ifeq (true,$(PRODUCT_SUPPORTS_VBOOT)) # BOARD_AVB_ENABLE != true
|
||||
|
||||
# $1: boot image target
|
||||
define build_boot_supports_vboot
|
||||
$(MKBOOTIMG) --kernel $(call bootimage-to-kernel,$(1)) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1).unsigned
|
||||
$(VBOOT_SIGNER) $(FUTILITY) $(1).unsigned $(PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $(1).keyblock $(1)
|
||||
$(call assert-max-image-size,$(1),$(call get-bootimage-partition-size,$(1),boot))
|
||||
endef
|
||||
|
||||
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(VBOOT_SIGNER) $(FUTILITY) $(BOOTIMAGE_EXTRA_DEPS)
|
||||
$(call pretty,"Target boot image: $@")
|
||||
$(call build_boot_supports_vboot,$@)
|
||||
|
||||
$(call declare-container-license-metadata,$(INSTALLED_BOOTIMAGE_TARGET),SPDX-license-identifier-GPL-2.0-only SPDX-license-identifier-Apache-2.0,restricted notice,$(BUILD_SYSTEM)/LINUX_KERNEL_COPYING build/soong/licenses/LICENSE,"Boot Image",boot)
|
||||
$(call declare-container-license-deps,$(INSTALLED_BOOTIMAGE_TARGET),$(INTERNAL_BOOTIMAGE_FILES),$(PRODUCT_OUT)/:/)
|
||||
|
||||
UNMOUNTED_NOTICE_VENDOR_DEPS += $(INSTALLED_BOOTIMAGE_TARGET)
|
||||
|
||||
.PHONY: bootimage-nodeps
|
||||
bootimage-nodeps: $(MKBOOTIMG) $(VBOOT_SIGNER) $(FUTILITY)
|
||||
@echo "make $@: ignoring dependencies"
|
||||
$(foreach b,$(INSTALLED_BOOTIMAGE_TARGET),$(call build_boot_supports_vboot,$(b)))
|
||||
|
||||
else # PRODUCT_SUPPORTS_VBOOT != true
|
||||
|
||||
# $1: boot image target
|
||||
define build_boot_novboot
|
||||
@@ -1464,7 +1493,7 @@ define build_boot_novboot
|
||||
$(call assert-max-image-size,$1,$(call get-bootimage-partition-size,$(1),boot))
|
||||
endef
|
||||
|
||||
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
|
||||
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOTIMAGE_EXTRA_DEPS)
|
||||
$(call pretty,"Target boot image: $@")
|
||||
$(call build_boot_novboot,$@)
|
||||
|
||||
@@ -2786,6 +2815,11 @@ ifndef BOARD_RECOVERY_MKBOOTIMG_ARGS
|
||||
BOARD_RECOVERY_MKBOOTIMG_ARGS := $(BOARD_MKBOOTIMG_ARGS)
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true)
|
||||
INTERNAL_RECOVERYIMAGE_ARGS += --dt $(INSTALLED_DTIMAGE_TARGET)
|
||||
RECOVERYIMAGE_EXTRA_DEPS := $(INSTALLED_DTIMAGE_TARGET)
|
||||
endif
|
||||
|
||||
$(INTERNAL_RECOVERY_RAMDISK_FILES_TIMESTAMP): $(MKBOOTFS) \
|
||||
$(INTERNAL_ROOT_FILES) \
|
||||
$(INSTALLED_RAMDISK_TARGET) \
|
||||
@@ -2881,7 +2915,7 @@ UNMOUNTED_NOTICE_VENDOR_DEPS+= $(INSTALLED_BOOTIMAGE_TARGET)
|
||||
endif # BOARD_USES_RECOVERY_AS_BOOT
|
||||
|
||||
ifndef BOARD_CUSTOM_BOOTIMG_MK
|
||||
$(INSTALLED_RECOVERYIMAGE_TARGET): $(recoveryimage-deps)
|
||||
$(INSTALLED_RECOVERYIMAGE_TARGET): $(recoveryimage-deps) $(RECOVERYIMAGE_EXTRA_DEPS)
|
||||
$(call build-recoveryimage-target, $@, \
|
||||
$(if $(filter true, $(BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE)),, $(recovery_kernel)))
|
||||
else
|
||||
@@ -6582,6 +6616,9 @@ endif
|
||||
ifdef BOARD_KERNEL_PAGESIZE
|
||||
echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize
|
||||
endif
|
||||
ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true)
|
||||
$(hide) $(ACP) $(INSTALLED_DTIMAGE_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/dt
|
||||
endif
|
||||
endif # not (BUILDING_VENDOR_BOOT_IMAGE and BOARD_USES_RECOVERY_AS_BOOT)
|
||||
endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true
|
||||
@# Components of the boot image
|
||||
@@ -6612,6 +6649,9 @@ endif
|
||||
ifdef BOARD_KERNEL_PAGESIZE
|
||||
echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
|
||||
endif
|
||||
ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true)
|
||||
$(hide) $(ACP) $(INSTALLED_DTIMAGE_TARGET) $(zip_root)/BOOT/dt
|
||||
endif
|
||||
endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET == "" && BOARD_USES_GENERIC_KERNEL_IMAGE != true
|
||||
endif # BOARD_USES_RECOVERY_AS_BOOT not true
|
||||
$(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
|
||||
|
@@ -1791,6 +1791,11 @@ def _BuildBootableImage(image_name, sourcedir, fs_config_file,
|
||||
cmd.append("--pagesize")
|
||||
cmd.append(open(fn).read().rstrip("\n"))
|
||||
|
||||
fn = os.path.join(sourcedir, "dt")
|
||||
if os.access(fn, os.F_OK):
|
||||
cmd.append("--dt")
|
||||
cmd.append(fn)
|
||||
|
||||
if partition_name == "recovery":
|
||||
args = info_dict.get("recovery_mkbootimg_args")
|
||||
if not args:
|
||||
|
Reference in New Issue
Block a user