diff --git a/Android.mk b/Android.mk index 3af7591d832903369ae2c8d7a157dd3b56f4139d..380f5d7ead7e54917881aafe70d25d8cf1c3bf05 100644 --- a/Android.mk +++ b/Android.mk @@ -179,7 +179,7 @@ ALL_MAC_PERMS_FILES := $(call build_policy, $(LOCAL_MODULE)) $(LOCAL_BUILT_MODULE) : $(mac_perms_keys.tmp) $(HOST_OUT_EXECUTABLES)/insertkeys.py $(ALL_MAC_PERMS_FILES) @mkdir -p $(dir $@) - $(hide) $(HOST_OUT_EXECUTABLES)/insertkeys.py -t $(TARGET_BUILD_VARIANT) -c $(TOP) $< -o $@ $(ALL_MAC_PERMS_FILES) + $(hide) $(HOST_OUT_EXECUTABLES)/insertkeys.py -t $(TARGET_BUILD_VARIANT) -d $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE)) -c $(TOP) $< -o $@ $(ALL_MAC_PERMS_FILES) mac_perms_keys.tmp := ################################## diff --git a/keys.conf b/keys.conf index c002897909052cd4c2ea5fd1a85b50ee7894a1fc..cca95e960b0ee77ba67bcc93d17907a865966332 100644 --- a/keys.conf +++ b/keys.conf @@ -9,17 +9,17 @@ # [@PLATFORM] -ALL : build/target/product/security/platform.x509.pem +ALL : platform.x509.pem [@MEDIA] -ALL : build/target/product/security/media.x509.pem +ALL : media.x509.pem [@SHARED] -ALL : build/target/product/security/shared.x509.pem +ALL : shared.x509.pem # Example of ALL TARGET_BUILD_VARIANTS [@RELEASE] -ENG : build/target/product/security/testkey.x509.pem -USER : build/target/product/security/testkey.x509.pem -USERDEBUG : build/target/product/security/testkey.x509.pem +ENG : testkey.x509.pem +USER : testkey.x509.pem +USERDEBUG : testkey.x509.pem diff --git a/tools/insertkeys.py b/tools/insertkeys.py index 509c43fa5c32fa2a599eb5658ae9707d3d1c2943..cccb92f1ded7b35fadaaf6a1a1962864ef42316a 100755 --- a/tools/insertkeys.py +++ b/tools/insertkeys.py @@ -65,7 +65,7 @@ class ParseConfig(ConfigParser.ConfigParser): # This must be lowercase OPTION_WILDCARD_TAG = "all" - def generateKeyMap(self, target_build_variant): + def generateKeyMap(self, target_build_variant, key_directory): keyMap = dict() @@ -87,7 +87,7 @@ class ParseConfig(ConfigParser.ConfigParser): if tag in keyMap: sys.exit("Duplicate tag detected " + tag) - path = self.get(tag, option) + path = os.path.join(key_directory, self.get(tag, option)) keyMap[tag] = GenerateKeys(path) @@ -188,6 +188,9 @@ if __name__ == "__main__": parser.add_option("-t", "--target-build-variant", default="eng", dest="target_build_variant", help="Specify the TARGET_BUILD_VARIANT, defaults to eng") + parser.add_option("-d", "--key-directory", default="", dest="key_directory", + help="Specify a parent directory for keys") + (options, args) = parser.parse_args() if len(args) < 2: @@ -205,7 +208,7 @@ if __name__ == "__main__": logging.info("Setting output file to: " + options.output_file) # Generate the key list - key_map = config.generateKeyMap(options.target_build_variant.lower()) + key_map = config.generateKeyMap(options.target_build_variant.lower(), options.key_directory) logging.info("Generate key map:") for k in key_map: logging.info(k + " : " + str(key_map[k]))