Skip to content

Commit c52d881

Browse files
rmccvjspranav
authored andcommitted
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
1 parent 927da50 commit c52d881

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

core/Makefile

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,8 @@ endif
951951
ifdef BUILDING_BOOT_IMAGE
952952
INSTALLED_BOOTIMAGE_TARGET := $(BUILT_BOOTIMAGE_TARGET)
953953

954+
ifndef BOARD_CUSTOM_BOOTIMG_MK
955+
954956
ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
955957
$(error TARGET_BOOTIMAGE_USE_EXT2 is not supported anymore)
956958
endif # TARGET_BOOTIMAGE_USE_EXT2
@@ -1034,6 +1036,7 @@ bootimage-nodeps: $(MKBOOTIMG)
10341036
$(foreach b,$(INSTALLED_BOOTIMAGE_TARGET),$(call build_boot_novboot,$(b)))
10351037

10361038
endif # BOARD_AVB_ENABLE
1039+
endif # BOARD_CUSTOM_BOOTIMG_MK not defined
10371040
endif # BUILDING_BOOT_IMAGE
10381041

10391042
else # TARGET_NO_KERNEL == "true"
@@ -1927,6 +1930,7 @@ IGNORE_RECOVERY_SEPOLICY := $(patsubst $(TARGET_RECOVERY_OUT)/%,--exclude=/%,$(r
19271930
# for the recovery image
19281931
recovery_kernel := $(firstword $(INSTALLED_KERNEL_TARGET))
19291932
recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
1933+
recovery_uncompressed_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.cpio
19301934
recovery_resources_common := bootable/recovery/res
19311935

19321936
# Set recovery_density to a density bucket based on TARGET_SCREEN_DENSITY, PRODUCT_AAPT_PREF_CONFIG,
@@ -2175,7 +2179,7 @@ ifndef BOARD_RECOVERY_MKBOOTIMG_ARGS
21752179
BOARD_RECOVERY_MKBOOTIMG_ARGS := $(BOARD_MKBOOTIMG_ARGS)
21762180
endif
21772181

2178-
$(INTERNAL_RECOVERY_RAMDISK_FILES_TIMESTAMP): $(MKBOOTFS) $(COMPRESSION_COMMAND_DEPS) \
2182+
$(INTERNAL_RECOVERY_RAMDISK_FILES_TIMESTAMP): $(MKBOOTFS) \
21792183
$(INTERNAL_ROOT_FILES) \
21802184
$(INSTALLED_RAMDISK_TARGET) \
21812185
$(INTERNAL_RECOVERYIMAGE_FILES) \
@@ -2213,8 +2217,13 @@ $(INTERNAL_RECOVERY_RAMDISK_FILES_TIMESTAMP): $(MKBOOTFS) $(COMPRESSION_COMMAND_
22132217
$(BOARD_RECOVERY_IMAGE_PREPARE)
22142218
$(hide) touch $@
22152219

2216-
$(recovery_ramdisk): $(INTERNAL_RECOVERY_RAMDISK_FILES_TIMESTAMP)
2217-
$(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(COMPRESSION_COMMAND) > $(recovery_ramdisk)
2220+
$(recovery_uncompressed_ramdisk): $(INTERNAL_RECOVERY_RAMDISK_FILES_TIMESTAMP)
2221+
@echo ----- Making uncompressed recovery ramdisk ------
2222+
$(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) > $@
2223+
2224+
$(recovery_ramdisk): $(recovery_uncompressed_ramdisk) $(COMPRESSION_COMMAND_DEPS)
2225+
@echo ----- Making compressed recovery ramdisk ------
2226+
$(COMPRESSION_COMMAND) < $(recovery_uncompressed_ramdisk) > $@
22182227

22192228
# $(1): output file
22202229
# $(2): optional kernel file
@@ -2277,9 +2286,13 @@ $(INSTALLED_BOOTIMAGE_TARGET): $(recoveryimage-deps)
22772286
$(call build-recoveryimage-target, $@, $(PRODUCT_OUT)/$(subst .img,,$(subst boot,kernel,$(notdir $@))))
22782287
endif # BOARD_USES_RECOVERY_AS_BOOT
22792288

2289+
ifndef BOARD_CUSTOM_BOOTIMG_MK
22802290
$(INSTALLED_RECOVERYIMAGE_TARGET): $(recoveryimage-deps)
22812291
$(call build-recoveryimage-target, $@, \
22822292
$(if $(filter true, $(BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE)),, $(recovery_kernel)))
2293+
else
2294+
INTERNAL_RECOVERYIMAGE_ARGS += --kernel $(recovery_kernel)
2295+
endif # BOARD_CUSTOM_BOOTIMG_MK
22832296

22842297
ifdef RECOVERY_RESOURCE_ZIP
22852298
$(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ZIPTIME)
@@ -2310,6 +2323,11 @@ $(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is depr
23102323
endif
23112324

23122325

2326+
ifdef BOARD_CUSTOM_BOOTIMG_MK
2327+
include $(BOARD_CUSTOM_BOOTIMG_MK)
2328+
endif
2329+
2330+
ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
23132331
# -----------------------------------------------------------------
23142332
# the debug ramdisk, which is the original ramdisk plus additional
23152333
# files: force_debuggable, adb_debug.prop and userdebug sepolicy.
@@ -5050,6 +5068,12 @@ ifdef INTERNAL_VENDOR_RAMDISK_FRAGMENTS
50505068
))
50515069
endif # INTERNAL_VENDOR_RAMDISK_FRAGMENTS != ""
50525070
endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET
5071+
ifdef BOARD_CUSTOM_BOOTIMG
5072+
@# Prebuilt boot images
5073+
$(hide) mkdir -p $(zip_root)/BOOTABLE_IMAGES
5074+
$(hide) $(ACP) $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/BOOTABLE_IMAGES/
5075+
$(hide) $(ACP) $(INSTALLED_RECOVERYIMAGE_TARGET) $(zip_root)/BOOTABLE_IMAGES/
5076+
endif
50535077
ifdef BUILDING_SYSTEM_IMAGE
50545078
@# Contents of the system image
50555079
$(hide) $(call package_files-copy-root, \

0 commit comments

Comments
 (0)