Remove device-specific bits if recovery_as_boot
On legacy devices (launched with R and below), if device:
- has a vendor_boot partition, and
- uses recovery_as_boot
Then, when building the recovery/boot partition, the
device-specific bits, including dtb/kernel base/pagesize should
be moved to vendor_boot.
Previously, it is incorrectly assumed that A/B => recovery_as_boot.
In reality, we do have A/B devices with a dedicated recovery partition.
Note that for devices that uses GKI (BOARD_USES_GENERIC_KERNEL_IMAGE),
recovery_as_boot is never set to true. Instead, recovery resources
are moved to vendor_boot. On these devices, the conditional
'vendor_boot && recovery-as-boot' is always false. Hence:
- If the device has a dedicated recovery partition, it should use V3 header,
and dtb/base/pagesize won't be in recovery header.
- If device does not have a dedicated recovery partition, the recovery
image won't be built.
Test: builds
Change-Id: I0db2af20470cbe8a21044a984cccf264590aaccf
diff --git a/core/Makefile b/core/Makefile
index 83328bb..7d02120 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1890,7 +1890,7 @@
$(copy-file-to-target)
endif
-ifeq (truetrue,$(strip $(BUILDING_VENDOR_BOOT_IMAGE))$(strip $(AB_OTA_UPDATER)))
+ifeq (truetrue,$(strip $(BUILDING_VENDOR_BOOT_IMAGE))$(strip $(BOARD_USES_RECOVERY_AS_BOOT)))
INTERNAL_RECOVERYIMAGE_ARGS := --ramdisk $(recovery_ramdisk)
ifneq (true,$(BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE))
@@ -1899,7 +1899,7 @@
endif # GENERIC_KERNEL_CMDLINE != ""
endif # BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE != true
-else # not (BUILDING_VENDOR_BOOT_IMAGE and AB_OTA_UPDATER)
+else # not (BUILDING_VENDOR_BOOT_IMAGE and BOARD_USES_RECOVERY_AS_BOOT)
INTERNAL_RECOVERYIMAGE_ARGS := \
$(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
--ramdisk $(recovery_ramdisk)
@@ -1928,7 +1928,7 @@
ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
INTERNAL_RECOVERYIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
endif
-endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET not defined
+endif # (BUILDING_VENDOR_BOOT_IMAGE and BOARD_USES_RECOVERY_AS_BOOT)
ifndef BOARD_RECOVERY_MKBOOTIMG_ARGS
BOARD_RECOVERY_MKBOOTIMG_ARGS := $(BOARD_MKBOOTIMG_ARGS)
endif
@@ -4490,11 +4490,11 @@
cp $(firstword $(INSTALLED_KERNEL_TARGET)) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/kernel
endif
endif
-ifeq (truetrue,$(strip $(BUILDING_VENDOR_BOOT_IMAGE))$(strip $(AB_OTA_UPDATER)))
+ifeq (truetrue,$(strip $(BUILDING_VENDOR_BOOT_IMAGE))$(strip $(BOARD_USES_RECOVERY_AS_BOOT)))
ifneq (true,$(BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE))
echo "$(GENERIC_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
endif # BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE != true
-else # not (BUILDING_VENDOR_BOOT_IMAGE and AB_OTA_UPDATER)
+else # not (BUILDING_VENDOR_BOOT_IMAGE and BOARD_USES_RECOVERY_AS_BOOT)
ifdef INSTALLED_2NDBOOTLOADER_TARGET
cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second
endif
@@ -4522,7 +4522,7 @@
ifdef BOARD_KERNEL_PAGESIZE
echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize
endif
-endif # not (BUILDING_VENDOR_BOOT_IMAGE and AB_OTA_UPDATER)
+endif # not (BUILDING_VENDOR_BOOT_IMAGE and BOARD_USES_RECOVERY_AS_BOOT)
endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true
@# Components of the boot image
$(hide) mkdir -p $(zip_root)/BOOT