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
This commit is contained in:
Ricardo Cerqueira 2014-11-05 21:30:23 +00:00 committed by Bartłomiej Rudecki
parent 3329a204d2
commit 9b1095722e
Signed by: przekichane
GPG key ID: 751F23C6F014EF76

View file

@ -1351,6 +1351,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
@ -1425,6 +1427,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"
@ -2423,6 +2426,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))
@ -2699,7 +2703,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) \
@ -2740,8 +2744,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
@ -2797,9 +2806,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)
@ -2835,6 +2848,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.
@ -6572,6 +6588,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
$(hide) $(call package_files-copy-root, \