From d9ac9b5ec37ddcdf414e92c61945c50facbbccbc Mon Sep 17 00:00:00 2001 From: althafvly Date: Tue, 14 May 2024 15:20:34 +0530 Subject: [PATCH] build: Use our keys for otacerts if it exists --- target/product/security/Android.mk | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/target/product/security/Android.mk b/target/product/security/Android.mk index ad25a9261c..f903191a8e 100644 --- a/target/product/security/Android.mk +++ b/target/product/security/Android.mk @@ -70,11 +70,17 @@ include $(BUILD_SYSTEM)/base_rules.mk extra_ota_keys := $(addsuffix .x509.pem,$(PRODUCT_EXTRA_OTA_KEYS)) -$(LOCAL_BUILT_MODULE): PRIVATE_CERT := $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem +ifneq (,$(wildcard user-keys/releasekey.x509.pem)) +DEFAULT_OTA_CERTIFICATE := user-keys/releasekey +else +DEFAULT_OTA_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE) +endif + +$(LOCAL_BUILT_MODULE): PRIVATE_CERT := $(DEFAULT_OTA_CERTIFICATE).x509.pem $(LOCAL_BUILT_MODULE): PRIVATE_EXTRA_OTA_KEYS := $(extra_ota_keys) $(LOCAL_BUILT_MODULE): \ $(SOONG_ZIP) \ - $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem \ + $(DEFAULT_OTA_CERTIFICATE).x509.pem \ $(extra_ota_keys) $(SOONG_ZIP) -o $@ -j -symlinks=false \ $(addprefix -f ,$(PRIVATE_CERT) $(PRIVATE_EXTRA_OTA_KEYS)) @@ -95,11 +101,17 @@ include $(BUILD_SYSTEM)/base_rules.mk extra_recovery_keys := $(addsuffix .x509.pem,$(PRODUCT_EXTRA_RECOVERY_KEYS)) -$(LOCAL_BUILT_MODULE): PRIVATE_CERT := $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem +ifneq (,$(wildcard user-keys/releasekey.x509.pem)) +DEFAULT_OTA_CERTIFICATE := user-keys/releasekey +else +DEFAULT_OTA_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE) +endif + +$(LOCAL_BUILT_MODULE): PRIVATE_CERT := $(DEFAULT_OTA_CERTIFICATE).x509.pem $(LOCAL_BUILT_MODULE): PRIVATE_EXTRA_RECOVERY_KEYS := $(extra_recovery_keys) $(LOCAL_BUILT_MODULE): \ $(SOONG_ZIP) \ - $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem \ + $(DEFAULT_OTA_CERTIFICATE).x509.pem \ $(extra_recovery_keys) $(SOONG_ZIP) -o $@ -j -symlinks=false \ $(addprefix -f ,$(PRIVATE_CERT) $(PRIVATE_EXTRA_RECOVERY_KEYS)) -- GitLab