Overwrite certs in otacerts.zip folder

Viewed 19

Apologies for wrong question as I am very new to Android and TIA for your response.

I am trying to override the otacerts.zip which contains the default testkeys with the one I generated. I copied the newly generated .x509.pem and .pk8 files under /vendors/newkey. I also created an Android.mk under /vendor/keys with lines copied from Android.mk found under /build/target/product/security. Currently my Android.mk looks like this:


#######################################
# This is to override the otacerts.zip
include $(CLEAR_VARS)

LOCAL_MODULE := new_otacerts
LOCAL_OVERRIDES_MODULE := otacerts
# LOCAL_LICENSE_KINDS := legacy_restricted
# LOCAL_LICENSE_CONDITIONS := restricted
# LOCAL_MODULE_CLASS := ETC
# LOCAL_MODULE_STEM := otacerts.zip
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/security
LOCAL_CERTIFICATE := ./vendor/keys/newkey
include $(BUILD_SYSTEM)/base_rules.mk
$(LOCAL_BUILT_MODULE): PRIVATE_CERT := $(LOCAL_CERTIFICATE).x509.pem
$(LOCAL_BUILT_MODULE): $(SOONG_ZIP) $(LOCAL_CERTIFICATE).x509.pem
    $(SOONG_ZIP) -o $@ -j -symlinks=false -f $(PRIVATE_CERT) 

After running the above makefile I get error:

FAILED: ninja: unknown target 'MODULES-IN-vendor-keys'
18:03:17 ninja failed with: exit status 1

#### failed to build some targets (05:42 (mm:ss)) ####

Is it possible to override otacerts.zip in this way?

P.S: I have already tried modifying the LOCAL_CERTIFICATE path in Android.mk in /build/target/product/security and it worked. I had the new otacerts.zip with my keys. But I do not want to use that approach. I want to know if there is any other way to override the otacerts.zip with my newly generated keys.

0 Answers
Related