From 5d9bae69daceb5a8a8acc72e1ea72a7702fb7ba5 Mon Sep 17 00:00:00 2001 From: Bruno Martins Date: Tue, 14 Nov 2023 14:02:35 +0000 Subject: [PATCH] build: Introduce android-info-extra.txt support This allows adding android-info-extra.txt to OTA packaging folder in case it exists in the target device tree, so that it can then be used in conjunction with custom releasetools. Historically, devices used to do assertions based on the modem version or even trusted zone version in order to prevent flashing builds if certain conditions were not met. That however, breaks `fastboot flashall` command since it looks for the requirements set in board-info.txt. With this, targets can define whatever non-standard requirements in the newly introduced android-info extra file, keeping OTA assertions in place and `fastboot flashall` command working without having to pass `--force` argument. Change-Id: I029d778b44be4d9d877701d05124451052a4b73c Signed-off-by: RITEFANG <1721985272@qq.com> --- core/Makefile | 3 +++ target/board/Android.mk | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/core/Makefile b/core/Makefile index 876e1d878e..d8ad169d50 100644 --- a/core/Makefile +++ b/core/Makefile @@ -6554,6 +6554,7 @@ $(BUILT_TARGET_FILES_DIR): \ $(INSTALLED_PVMFW_EMBEDDED_AVBKEY_TARGET) \ $(INSTALLED_CUSTOMIMAGES_TARGET) \ $(INSTALLED_ANDROID_INFO_TXT_TARGET) \ + $(INSTALLED_ANDROID_INFO_EXTRA_TXT_TARGET) \ $(INSTALLED_RECOVERY_KERNEL_TARGET) \ $(INSTALLED_KERNEL_TARGET) \ $(INSTALLED_RAMDISK_TARGET) \ @@ -6791,6 +6792,7 @@ endif @# Extra contents of the OTA package $(hide) mkdir -p $(zip_root)/OTA $(hide) cp $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/ + $(hide) cp $(INSTALLED_ANDROID_INFO_EXTRA_TXT_TARGET) $(zip_root)/OTA/ ifdef BUILDING_RAMDISK_IMAGE ifeq (true,$(BOARD_IMG_USE_RAMDISK)) @# Contents of the ramdisk image @@ -7090,6 +7092,7 @@ $(call declare-container-license-deps,$(BUILT_TARGET_FILES_PACKAGE), $(INSTALLED $(INSTALLED_PVMFW_EMBEDDED_AVBKEY_TARGET) \ $(INSTALLED_CUSTOMIMAGES_TARGET) \ $(INSTALLED_ANDROID_INFO_TXT_TARGET) \ + $(INSTALLED_ANDROID_INFO_EXTRA_TXT_TARGET) \ $(INSTALLED_KERNEL_TARGET) \ $(INSTALLED_RAMDISK_TARGET) \ $(INSTALLED_DTBIMAGE_TARGET) \ diff --git a/target/board/Android.mk b/target/board/Android.mk index 8133af9a7f..4fbfeef2f2 100644 --- a/target/board/Android.mk +++ b/target/board/Android.mk @@ -49,6 +49,23 @@ endif $(call declare-0p-target,$(INSTALLED_ANDROID_INFO_TXT_TARGET)) +# Similarly to above, generate a file containing extra info +# to be used only with custom releasetools +INSTALLED_ANDROID_INFO_EXTRA_TXT_TARGET := $(PRODUCT_OUT)/android-info-extra.txt +android_info_extra_txt := $(TARGET_ANDROID_INFO_EXTRA_FILE) +ifndef android_info_extra_txt +android_info_extra_txt := $(wildcard $(TARGET_DEVICE_DIR)/android-info-extra.txt) +endif +$(INSTALLED_ANDROID_INFO_EXTRA_TXT_TARGET): $(android_info_extra_txt) + $(call pretty,"Generated: ($@)") +ifdef android_info_extra_txt + $(hide) grep -v '#' $< > $@ +else + $(hide) echo "" > $@ +endif + +$(call declare-0p-target,$(INSTALLED_ANDROID_INFO_EXTRA_TXT_TARGET)) + # Copy compatibility metadata to the device. # Device Manifest