Skip to content

Commit

Permalink
Add BOARD_CUSTOM_BOOTIMG_MK support
Browse files Browse the repository at this point in the history
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

Change-Id: I058d214f0cf2d05b7621b369ef1f8a983c3ac258
  • Loading branch information
rmcc authored and mikeNG committed Dec 12, 2020
1 parent 5899154 commit 71fd15b
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,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)

Expand Down Expand Up @@ -1319,6 +1321,7 @@ bootimage-nodeps: $(MKBOOTIMG)
$(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))

endif # TARGET_BOOTIMAGE_USE_EXT2
endif # BOARD_CUSTOM_BOOTIMG_MK not defined
endif # BUILDING_BOOT_IMAGE

else # TARGET_NO_KERNEL == "true"
Expand Down Expand Up @@ -1928,6 +1931,7 @@ IGNORE_RECOVERY_SEPOLICY := $(patsubst $(TARGET_RECOVERY_OUT)/%,--exclude=/%,$(r

recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
recovery_uncompressed_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.cpio
recovery_resources_common := $(call include-path-for, recovery)/res

# Set recovery_density to a density bucket based on TARGET_SCREEN_DENSITY, PRODUCT_AAPT_PREF_CONFIG,
Expand Down Expand Up @@ -2191,7 +2195,7 @@ ifndef BOARD_RECOVERY_MKBOOTIMG_ARGS
BOARD_RECOVERY_MKBOOTIMG_ARGS := $(BOARD_MKBOOTIMG_ARGS)
endif

$(recovery_ramdisk): $(MKBOOTFS) $(COMPRESSION_COMMAND_DEPS) \
$(recovery_uncompressed_ramdisk): $(MKBOOTFS) \
$(INTERNAL_ROOT_FILES) \
$(INSTALLED_RAMDISK_TARGET) \
$(INTERNAL_RECOVERYIMAGE_FILES) \
Expand Down Expand Up @@ -2226,7 +2230,13 @@ $(recovery_ramdisk): $(MKBOOTFS) $(COMPRESSION_COMMAND_DEPS) \
cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.wipe)
ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
$(BOARD_RECOVERY_IMAGE_PREPARE)
$(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(COMPRESSION_COMMAND) > $(recovery_ramdisk)
@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): kernel file
Expand Down Expand Up @@ -2285,8 +2295,12 @@ $(INSTALLED_BOOTIMAGE_TARGET): $(recoveryimage-deps)
$(call build-recoveryimage-target, $@, $(PRODUCT_OUT)/$(subst .img,,$(subst boot,kernel,$(notdir $@))))
endif # BOARD_USES_RECOVERY_AS_BOOT

ifndef BOARD_CUSTOM_BOOTIMG_MK
$(INSTALLED_RECOVERYIMAGE_TARGET): $(recoveryimage-deps)
$(call build-recoveryimage-target, $@, $(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)
Expand Down Expand Up @@ -2315,6 +2329,11 @@ 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


ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
# -----------------------------------------------------------------
# the debug ramdisk, which is the original ramdisk plus additional
Expand Down Expand Up @@ -4707,6 +4726,12 @@ ifdef BOARD_KERNEL_PAGESIZE
endif
echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/VENDOR_BOOT/vendor_cmdline
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, \
Expand Down

0 comments on commit 71fd15b

Please sign in to comment.