Enable non-v3 recovery image with v3 boot image

Add support for building a non-v3 recovery image along with a
v3 boot.img and vendor_boot image.

Bug: 150825361
Change-Id: I80d4e71ff09b83dd1c7f9accb4de99a30f95f4bf
This commit is contained in:
Steve Muckle 2020-03-16 19:13:46 -07:00
parent 65ca0eec96
commit f84668e1da
3 changed files with 17 additions and 15 deletions

View File

@ -2121,13 +2121,13 @@ $(INSTALLED_RECOVERY_BUILD_PROP_TARGET): \
$(hide) cat $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET) >> $@
$(call append-recovery-ui-properties,$(PRIVATE_RECOVERY_UI_PROPERTIES),$@)
ifdef INSTALLED_VENDOR_BOOTIMAGE_TARGET
ifeq (truetrue,$(strip $(BUILDING_VENDOR_BOOT_IMAGE))$(strip $(AB_OTA_UPDATER)))
INTERNAL_RECOVERYIMAGE_ARGS := \
--kernel $(recovery_kernel) --ramdisk $(recovery_ramdisk)
ifdef GENERIC_KERNEL_CMDLINE
INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(GENERIC_KERNEL_CMDLINE)"
endif
else # INSTALLED_VENDOR_BOOTIMAGE_TARGET not defined
else # not (BUILDING_VENDOR_BOOT_IMAGE and AB_OTA_UPDATER)
INTERNAL_RECOVERYIMAGE_ARGS := \
$(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
--ramdisk $(recovery_ramdisk)
@ -2155,6 +2155,9 @@ ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
INTERNAL_RECOVERYIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
endif
endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET not defined
ifndef BOARD_RECOVERY_MKBOOTIMG_ARGS
BOARD_RECOVERY_MKBOOTIMG_ARGS := $(BOARD_MKBOOTIMG_ARGS)
endif
$(recovery_ramdisk): $(MKBOOTFS) $(MINIGZIP) \
$(INTERNAL_ROOT_FILES) \
@ -2198,10 +2201,10 @@ $(recovery_ramdisk): $(MKBOOTFS) $(MINIGZIP) \
define build-recoveryimage-target
$(if $(filter true,$(PRODUCT_SUPPORTS_VBOOT)), \
$(MKBOOTIMG) --kernel $(2) $(MKBOOTIMG_KERNEL_ARG) $(INTERNAL_RECOVERYIMAGE_ARGS) \
$(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) \
$(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_RECOVERY_MKBOOTIMG_ARGS) \
--output $(1).unsigned, \
$(MKBOOTIMG) --kernel $(2) $(MKBOOTIMG_KERNEL_ARG) $(INTERNAL_RECOVERYIMAGE_ARGS) \
$(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) \
$(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_RECOVERY_MKBOOTIMG_ARGS) \
--output $(1))
$(if $(filter true,$(PRODUCT_SUPPORTS_BOOT_SIGNER)),\
$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
@ -4194,6 +4197,7 @@ ifdef PRODUCT_EXTRA_RECOVERY_KEYS
$(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $@
endif
$(hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $@
$(hide) echo 'recovery_mkbootimg_args=$(BOARD_RECOVERY_MKBOOTIMG_ARGS)' >> $@
$(hide) echo 'mkbootimg_version_args=$(INTERNAL_MKBOOTIMG_VERSION_ARGS)' >> $@
$(hide) echo "multistage_support=1" >> $@
$(hide) echo "blockimgdiff_versions=3,4" >> $@
@ -4504,9 +4508,9 @@ ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_
ifdef INSTALLED_KERNEL_TARGET
cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/
endif
ifdef INSTALLED_VENDOR_BOOTIMAGE_TARGET
ifeq (truetrue,$(strip $(BUILDING_VENDOR_BOOT_IMAGE))$(strip $(AB_OTA_UPDATER)))
echo "$(GENERIC_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
else # INSTALLED_VENDOR_BOOTIMAGE_TARGET not defined
else # not (BUILDING_VENDOR_BOOT_IMAGE and AB_OTA_UPDATER)
ifdef INSTALLED_2NDBOOTLOADER_TARGET
cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second
endif

View File

@ -365,11 +365,6 @@ ifdef BOARD_BOOT_HEADER_VERSION
ifneq ($(TARGET_NO_VENDOR_BOOT),true)
BUILDING_VENDOR_BOOT_IMAGE := true
endif
ifdef BUILDING_RECOVERY_IMAGE
ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
$(error Boot header version >=3 requires recovery as boot)
endif
endif
endif
endif
.KATI_READONLY := BUILDING_VENDOR_BOOT_IMAGE

View File

@ -1104,7 +1104,13 @@ def _BuildBootableImage(sourcedir, fs_config_file, info_dict=None,
cmd.append("--pagesize")
cmd.append(open(fn).read().rstrip("\n"))
args = info_dict.get("mkbootimg_args")
# "boot" or "recovery", without extension.
partition_name = os.path.basename(sourcedir).lower()
if partition_name == "recovery":
args = info_dict.get("recovery_mkbootimg_args")
else:
args = info_dict.get("mkbootimg_args")
if args and args.strip():
cmd.extend(shlex.split(args))
@ -1122,9 +1128,6 @@ def _BuildBootableImage(sourcedir, fs_config_file, info_dict=None,
else:
cmd.extend(["--output", img.name])
# "boot" or "recovery", without extension.
partition_name = os.path.basename(sourcedir).lower()
if partition_name == "recovery":
if info_dict.get("include_recovery_dtbo") == "true":
fn = os.path.join(sourcedir, "recovery_dtbo")