Skip to content

Commit e8ff4ad

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 Change-Id: I058d214f0cf2d05b7621b369ef1f8a983c3ac258
1 parent 33092c7 commit e8ff4ad

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

core/Makefile

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,8 @@ INTERNAL_MKBOOTIMG_VERSION_ARGS := \
12521252
ifdef BUILDING_BOOT_IMAGE
12531253
INSTALLED_BOOTIMAGE_TARGET := $(BUILT_BOOTIMAGE_TARGET)
12541254

1255+
ifndef BOARD_CUSTOM_BOOTIMG_MK
1256+
12551257
ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
12561258
$(error TARGET_BOOTIMAGE_USE_EXT2 is not supported anymore)
12571259

@@ -1322,6 +1324,7 @@ bootimage-nodeps: $(MKBOOTIMG)
13221324
$(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
13231325

13241326
endif # TARGET_BOOTIMAGE_USE_EXT2
1327+
endif # BOARD_CUSTOM_BOOTIMG_MK not defined
13251328
endif # BUILDING_BOOT_IMAGE
13261329

13271330
else # TARGET_NO_KERNEL == "true"
@@ -1931,6 +1934,7 @@ IGNORE_RECOVERY_SEPOLICY := $(patsubst $(TARGET_RECOVERY_OUT)/%,--exclude=/%,$(r
19311934

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

19361940
# Set recovery_density to a density bucket based on TARGET_SCREEN_DENSITY, PRODUCT_AAPT_PREF_CONFIG,
@@ -2204,7 +2208,7 @@ ifndef BOARD_RECOVERY_MKBOOTIMG_ARGS
22042208
BOARD_RECOVERY_MKBOOTIMG_ARGS := $(BOARD_MKBOOTIMG_ARGS)
22052209
endif
22062210

2207-
$(recovery_ramdisk): $(MKBOOTFS) $(COMPRESSION_COMMAND_DEPS) \
2211+
$(recovery_uncompressed_ramdisk): $(MKBOOTFS) \
22082212
$(INTERNAL_ROOT_FILES) \
22092213
$(INSTALLED_RAMDISK_TARGET) \
22102214
$(INTERNAL_RECOVERYIMAGE_FILES) \
@@ -2242,7 +2246,13 @@ $(recovery_ramdisk): $(MKBOOTFS) $(COMPRESSION_COMMAND_DEPS) \
22422246
cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.wipe)
22432247
ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
22442248
$(BOARD_RECOVERY_IMAGE_PREPARE)
2245-
$(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(COMPRESSION_COMMAND) > $(recovery_ramdisk)
2249+
@echo ----- Making uncompressed recovery ramdisk ------
2250+
$(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) > $@
2251+
2252+
$(recovery_ramdisk): $(recovery_uncompressed_ramdisk) $(COMPRESSION_COMMAND_DEPS)
2253+
@echo ----- Making compressed recovery ramdisk ------
2254+
$(COMPRESSION_COMMAND) < $(recovery_uncompressed_ramdisk) > $@
2255+
22462256

22472257
# $(1): output file
22482258
# $(2): kernel file
@@ -2301,8 +2311,12 @@ $(INSTALLED_BOOTIMAGE_TARGET): $(recoveryimage-deps)
23012311
$(call build-recoveryimage-target, $@, $(PRODUCT_OUT)/$(subst .img,,$(subst boot,kernel,$(notdir $@))))
23022312
endif # BOARD_USES_RECOVERY_AS_BOOT
23032313

2314+
ifndef BOARD_CUSTOM_BOOTIMG_MK
23042315
$(INSTALLED_RECOVERYIMAGE_TARGET): $(recoveryimage-deps)
23052316
$(call build-recoveryimage-target, $@, $(recovery_kernel))
2317+
else
2318+
INTERNAL_RECOVERYIMAGE_ARGS += --kernel $(recovery_kernel)
2319+
endif # BOARD_CUSTOM_BOOTIMG_MK
23062320

23072321
ifdef RECOVERY_RESOURCE_ZIP
23082322
$(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ZIPTIME)
@@ -2331,6 +2345,11 @@ ifneq ($(BOARD_NAND_SPARE_SIZE),)
23312345
$(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.)
23322346
endif
23332347

2348+
ifdef BOARD_CUSTOM_BOOTIMG_MK
2349+
include $(BOARD_CUSTOM_BOOTIMG_MK)
2350+
endif
2351+
2352+
23342353
ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
23352354
# -----------------------------------------------------------------
23362355
# the debug ramdisk, which is the original ramdisk plus additional
@@ -4728,6 +4747,12 @@ ifdef BOARD_KERNEL_PAGESIZE
47284747
endif
47294748
echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/VENDOR_BOOT/vendor_cmdline
47304749
endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET
4750+
ifdef BOARD_CUSTOM_BOOTIMG
4751+
@# Prebuilt boot images
4752+
$(hide) mkdir -p $(zip_root)/BOOTABLE_IMAGES
4753+
$(hide) $(ACP) $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/BOOTABLE_IMAGES/
4754+
$(hide) $(ACP) $(INSTALLED_RECOVERYIMAGE_TARGET) $(zip_root)/BOOTABLE_IMAGES/
4755+
endif
47314756
ifdef BUILDING_SYSTEM_IMAGE
47324757
@# Contents of the system image
47334758
$(hide) $(call package_files-copy-root, \

0 commit comments

Comments
 (0)