Define otacerts_zip module in soong
To move the otacerts module from make to soong, define a new module
type otacerts_zip module. This module collects key files from
PRODUCT_DEFAULT_DEV_CERTIFICATE and PRODUCT_EXTRA_OTA_KEYS
(PRODUCT_EXTRA_RECOVERY_KEYS for recovery) to install the zipped file
in etc.
otacerts_zip module is available to recovery to install the
otacerts.zip file in the recovery partition.
Bug: 335364209
Test: Define "PRODUCT_DEFAULT_DEV_CERTIFICATE := \
build/make/target/product/security/testkey" and
m aosp_cf_system_x86_64
Change-Id: Ib5b671e9caef0403c6d9d69bfab29be248d7086c
diff --git a/android/config.go b/android/config.go
index cda01f0..d16377d 100644
--- a/android/config.go
+++ b/android/config.go
@@ -1055,6 +1055,22 @@
return defaultDir.Join(ctx, "testkey.x509.pem"), defaultDir.Join(ctx, "testkey.pk8")
}
+func (c *config) ExtraOtaKeys(ctx PathContext, recovery bool) []SourcePath {
+ var otaKeys []string
+ if recovery {
+ otaKeys = c.productVariables.ExtraOtaRecoveryKeys
+ } else {
+ otaKeys = c.productVariables.ExtraOtaKeys
+ }
+
+ otaPaths := make([]SourcePath, len(otaKeys))
+ for i, key := range otaKeys {
+ otaPaths[i] = PathForSource(ctx, key+".x509.pem")
+ }
+
+ return otaPaths
+}
+
func (c *config) BuildKeys() string {
defaultCert := String(c.productVariables.DefaultAppCertificate)
if defaultCert == "" || defaultCert == filepath.Join(testKeyDir, "testkey") {