From 6aee24e728b4d27b4a0ad7902b5ac83fc70ef06c Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Wed, 5 Nov 2014 21:30:23 +0000 Subject: [PATCH] Add BOARD_CUSTOM_BOOTIMG_MK support This is a combination of 2 commits. This is the 1st commit message: Add BOARD_CUSTOM_BOOTIMG_MK support Simplified version of the previous implementation. Recovery's ramdisk is spun off from the main recovery target again to allow overriding just the image-generation step [mikeioannina]: Squash cm-13.0 changes and adapt to N Change-Id: I058d214f0cf2d05b7621b369ef1f8a983c3ac258 This is the commit message #2: build: Handle custom boot images properly When a pre-built image should be used, it should be stored in the target files zip so that it can be used with external signing processes. Original-Change-Id: I2661af9ac58af30bb9314b552775046d3abf44e0 Change-Id: I10b3bd0bb33489b8ffb26d16d002f8dd6ff405ad [aleasto] Rewritten for R, where the recovery ramdisk is created via make dependencies, rather than $(call)s [mainey] Adapt to new flag INTERNAL_RECOVERY_RAMDISK_FILES_TIMESTAMP Change-Id: I058d214f0cf2d05b7621b369ef1f8a983c3ac258 --- core/Makefile | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/core/Makefile b/core/Makefile index 2b0e65d4f0..8befe8787f 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1426,6 +1426,8 @@ INTERNAL_MKBOOTIMG_VERSION_ARGS := \ ifdef BUILDING_BOOT_IMAGE INSTALLED_BOOTIMAGE_TARGET := $(BUILT_BOOTIMAGE_TARGET) +ifndef BOARD_CUSTOM_BOOTIMG_MK + ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true) $(error TARGET_BOOTIMAGE_USE_EXT2 is not supported anymore) endif # TARGET_BOOTIMAGE_USE_EXT2 @@ -1477,6 +1479,7 @@ bootimage-nodeps: $(MKBOOTIMG) $(foreach b,$(INSTALLED_BOOTIMAGE_TARGET),$(call build_boot_novboot,$(b))) endif # BOARD_AVB_ENABLE +endif # BOARD_CUSTOM_BOOTIMG_MK not defined endif # BUILDING_BOOT_IMAGE else # TARGET_NO_KERNEL == "true" @@ -2506,6 +2509,7 @@ IGNORE_RECOVERY_SEPOLICY := $(patsubst $(TARGET_RECOVERY_OUT)/%,--exclude=/%,$(r # for the recovery image recovery_kernel := $(firstword $(INSTALLED_KERNEL_TARGET)) recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img +recovery_uncompressed_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.cpio recovery_resources_common := bootable/recovery/res ifneq (,$(TARGET_RECOVERY_DENSITY)) @@ -2782,7 +2786,7 @@ ifndef BOARD_RECOVERY_MKBOOTIMG_ARGS BOARD_RECOVERY_MKBOOTIMG_ARGS := $(BOARD_MKBOOTIMG_ARGS) endif -$(INTERNAL_RECOVERY_RAMDISK_FILES_TIMESTAMP): $(MKBOOTFS) $(COMPRESSION_COMMAND_DEPS) \ +$(INTERNAL_RECOVERY_RAMDISK_FILES_TIMESTAMP): $(MKBOOTFS) \ $(INTERNAL_ROOT_FILES) \ $(INSTALLED_RAMDISK_TARGET) \ $(INTERNAL_RECOVERYIMAGE_FILES) \ @@ -2823,8 +2827,13 @@ $(INTERNAL_RECOVERY_RAMDISK_FILES_TIMESTAMP): $(MKBOOTFS) $(COMPRESSION_COMMAND_ $(BOARD_RECOVERY_IMAGE_PREPARE) $(hide) touch $@ -$(recovery_ramdisk): $(INTERNAL_RECOVERY_RAMDISK_FILES_TIMESTAMP) - $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(COMPRESSION_COMMAND) > $(recovery_ramdisk) +$(recovery_uncompressed_ramdisk): $(INTERNAL_RECOVERY_RAMDISK_FILES_TIMESTAMP) + @echo ----- Making uncompressed recovery ramdisk ------ + $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) > $@ + +$(recovery_ramdisk): $(recovery_uncompressed_ramdisk) $(COMPRESSION_COMMAND_DEPS) + @echo ----- Making compressed recovery ramdisk ------ + $(COMPRESSION_COMMAND) < $(recovery_uncompressed_ramdisk) > $@ # $(1): output file # $(2): optional kernel file @@ -2871,9 +2880,13 @@ $(call declare-container-license-deps,$(INSTALLED_BOOTIMAGE_TARGET),$(recoveryim UNMOUNTED_NOTICE_VENDOR_DEPS+= $(INSTALLED_BOOTIMAGE_TARGET) endif # BOARD_USES_RECOVERY_AS_BOOT +ifndef BOARD_CUSTOM_BOOTIMG_MK $(INSTALLED_RECOVERYIMAGE_TARGET): $(recoveryimage-deps) $(call build-recoveryimage-target, $@, \ $(if $(filter true, $(BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE)),, $(recovery_kernel))) +else +INTERNAL_RECOVERYIMAGE_ARGS += --kernel $(recovery_kernel) +endif # BOARD_CUSTOM_BOOTIMG_MK ifdef RECOVERY_RESOURCE_ZIP $(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ZIPTIME) @@ -2909,6 +2922,9 @@ ifneq ($(BOARD_NAND_SPARE_SIZE),) $(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.) endif +ifdef BOARD_CUSTOM_BOOTIMG_MK +include $(BOARD_CUSTOM_BOOTIMG_MK) +endif # ----------------------------------------------------------------- # Build debug ramdisk and debug boot image. @@ -6645,6 +6661,12 @@ ifdef BOARD_KERNEL_PAGESIZE echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/VENDOR_KERNEL_BOOT/pagesize endif endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET +ifdef BOARD_CUSTOM_BOOTIMG + @# Prebuilt boot images + $(hide) mkdir -p $(zip_root)/BOOTABLE_IMAGES + $(hide) $(ACP) $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/BOOTABLE_IMAGES/ + $(hide) $(ACP) $(INSTALLED_RECOVERYIMAGE_TARGET) $(zip_root)/BOOTABLE_IMAGES/ +endif ifdef BUILDING_SYSTEM_IMAGE @# Contents of the system image ifneq ($(SOONG_DEFINED_SYSTEM_IMAGE_PATH),)