Merge "Add options to sign the prebuilt custom images."
diff --git a/core/Makefile b/core/Makefile
index bbe6af0..35d744a 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -493,7 +493,7 @@
# directory).
event_log_tags_src := \
$(sort $(foreach m,\
- $(PRODUCT_PACKAGES) \
+ $(call resolve-bitness-for-modules,TARGET,$(PRODUCT_PACKAGES)) \
$(call module-names-for-tag-list,user), \
$(ALL_MODULES.$(m).EVENT_LOG_TAGS)) \
$(filter-out vendor/% device/% out/%,$(all_event_log_tags_src)))
diff --git a/core/main.mk b/core/main.mk
index 21ec6f9..9c52b01 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1184,15 +1184,17 @@
# Some modules produce only host installed files when building with TARGET_BUILD_APPS
ifeq ($(TARGET_BUILD_APPS),)
- _modules := $(foreach m,$(PRODUCT_PACKAGES) \
- $(PRODUCT_PACKAGES_DEBUG) \
- $(PRODUCT_PACKAGES_DEBUG_ASAN) \
- $(PRODUCT_PACKAGES_ENG) \
- $(PRODUCT_PACKAGES_TESTS),\
+ _modules := $(call resolve-bitness-for-modules,TARGET, \
+ $(PRODUCT_PACKAGES) \
+ $(PRODUCT_PACKAGES_DEBUG) \
+ $(PRODUCT_PACKAGES_DEBUG_ASAN) \
+ $(PRODUCT_PACKAGES_ENG) \
+ $(PRODUCT_PACKAGES_TESTS))
+ _host_modules := $(foreach m,$(_modules), \
$(if $(ALL_MODULES.$(m).INSTALLED),\
$(if $(filter-out $(HOST_OUT_ROOT)/%,$(ALL_MODULES.$(m).INSTALLED)),,\
$(m))))
- $(call maybe-print-list-and-error,$(sort $(_modules)),\
+ $(call maybe-print-list-and-error,$(sort $(_host_modules)),\
Host modules should be in PRODUCT_HOST_PACKAGES$(comma) not PRODUCT_PACKAGES)
endif
diff --git a/core/soong_android_app_set.mk b/core/soong_android_app_set.mk
index e84371c..4c27e53 100644
--- a/core/soong_android_app_set.mk
+++ b/core/soong_android_app_set.mk
@@ -24,8 +24,10 @@
endef
$(eval $(call extract-master-from-apk-set,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_APK_SET_MASTER_FILE)))
+# unzip returns 11 it there was nothing to extract, which is expected,
+# $(LOCAL_APK_SET_MASTER_FILE) has is already there.
LOCAL_POST_INSTALL_CMD := unzip -qo -j -d $(dir $(LOCAL_INSTALLED_MODULE)) \
- $(LOCAL_PREBUILT_MODULE_FILE) -x $(LOCAL_APK_SET_MASTER_FILE)
+ $(LOCAL_PREBUILT_MODULE_FILE) -x $(LOCAL_APK_SET_MASTER_FILE) || [[ $$? -eq 11 ]]
$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
diff --git a/core/tasks/tools/compatibility.mk b/core/tasks/tools/compatibility.mk
index 87582a5..89b0b9b 100644
--- a/core/tasks/tools/compatibility.mk
+++ b/core/tasks/tools/compatibility.mk
@@ -30,6 +30,7 @@
test_artifacts := $(COMPATIBILITY.$(test_suite_name).FILES)
test_tools := $(HOST_OUT_JAVA_LIBRARIES)/hosttestlib.jar \
$(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar \
+ $(HOST_OUT_JAVA_LIBRARIES)/tradefed-test-framework.jar \
$(HOST_OUT_JAVA_LIBRARIES)/loganalysis.jar \
$(HOST_OUT_JAVA_LIBRARIES)/compatibility-host-util.jar \
$(HOST_OUT_JAVA_LIBRARIES)/compatibility-host-util-tests.jar \
diff --git a/target/board/BoardConfigEmuCommon.mk b/target/board/BoardConfigEmuCommon.mk
index a2e5518..e9fb096 100644
--- a/target/board/BoardConfigEmuCommon.mk
+++ b/target/board/BoardConfigEmuCommon.mk
@@ -33,8 +33,6 @@
# emulator needs super.img
BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT := true
- BOARD_EXT4_SHARE_DUP_BLOCKS := true
-
# 3G + header
BOARD_SUPER_PARTITION_SIZE := 3229614080
BOARD_SUPER_PARTITION_GROUPS := emulator_dynamic_partitions
diff --git a/target/board/BoardConfigMainlineCommon.mk b/target/board/BoardConfigMainlineCommon.mk
index c57968e..bf015e5 100644
--- a/target/board/BoardConfigMainlineCommon.mk
+++ b/target/board/BoardConfigMainlineCommon.mk
@@ -6,6 +6,8 @@
TARGET_NO_BOOTLOADER := true
TARGET_NO_RECOVERY := true
+BOARD_EXT4_SHARE_DUP_BLOCKS := true
+
TARGET_USERIMAGES_USE_EXT4 := true
# Mainline devices must have /system_ext, /vendor and /product partitions.
diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk
index 16c6c6d..2963ee4 100644
--- a/target/board/generic_arm64/BoardConfig.mk
+++ b/target/board/generic_arm64/BoardConfig.mk
@@ -54,8 +54,6 @@
include build/make/target/board/BoardConfigGsiCommon.mk
-BOARD_EXT4_SHARE_DUP_BLOCKS := true
-
TARGET_NO_KERNEL := false
TARGET_NO_VENDOR_BOOT := true
BOARD_USES_RECOVERY_AS_BOOT := true
diff --git a/tools/releasetools/apex_utils.py b/tools/releasetools/apex_utils.py
index ae9b793..1c61938 100644
--- a/tools/releasetools/apex_utils.py
+++ b/tools/releasetools/apex_utils.py
@@ -169,7 +169,7 @@
def SignApexPayload(avbtool, payload_file, payload_key_path, payload_key_name,
- algorithm, salt, no_hashtree, signing_args=None):
+ algorithm, salt, hash_algorithm, no_hashtree, signing_args=None):
"""Signs a given payload_file with the payload key."""
# Add the new footer. Old footer, if any, will be replaced by avbtool.
cmd = [avbtool, 'add_hashtree_footer',
@@ -178,7 +178,8 @@
'--key', payload_key_path,
'--prop', 'apex.key:{}'.format(payload_key_name),
'--image', payload_file,
- '--salt', salt]
+ '--salt', salt,
+ '--hash_algorithm', hash_algorithm]
if no_hashtree:
cmd.append('--no_hashtree')
if signing_args:
@@ -235,11 +236,11 @@
'Failed to get APEX payload info for {}:\n{}'.format(
payload_path, e))
- # Extract the Algorithm / Salt / Prop info / Tree size from payload (i.e. an
- # image signed with avbtool). For example,
+ # Extract the Algorithm / Hash Algorithm / Salt / Prop info / Tree size from
+ # payload (i.e. an image signed with avbtool). For example,
# Algorithm: SHA256_RSA4096
PAYLOAD_INFO_PATTERN = (
- r'^\s*(?P<key>Algorithm|Salt|Prop|Tree Size)\:\s*(?P<value>.*?)$')
+ r'^\s*(?P<key>Algorithm|Hash Algorithm|Salt|Prop|Tree Size)\:\s*(?P<value>.*?)$')
payload_info_matcher = re.compile(PAYLOAD_INFO_PATTERN)
payload_info = {}
@@ -273,7 +274,7 @@
payload_info[key] = value
# Sanity check.
- for key in ('Algorithm', 'Salt', 'apex.key'):
+ for key in ('Algorithm', 'Salt', 'apex.key', 'Hash Algorithm'):
if key not in payload_info:
raise ApexInfoError(
'Failed to find {} prop in {}'.format(key, payload_path))
@@ -326,6 +327,7 @@
payload_info['apex.key'],
payload_info['Algorithm'],
payload_info['Salt'],
+ payload_info['Hash Algorithm'],
no_hashtree,
signing_args)
diff --git a/tools/releasetools/test_apex_utils.py b/tools/releasetools/test_apex_utils.py
index e19bc90..7b4a4b0 100644
--- a/tools/releasetools/test_apex_utils.py
+++ b/tools/releasetools/test_apex_utils.py
@@ -50,11 +50,12 @@
payload_file = self._GetTestPayload()
apex_utils.SignApexPayload(
'avbtool', payload_file, self.payload_key, 'testkey', 'SHA256_RSA2048',
- self.SALT, no_hashtree=True)
+ self.SALT, 'sha256', no_hashtree=True)
payload_info = apex_utils.ParseApexPayloadInfo('avbtool', payload_file)
self.assertEqual('SHA256_RSA2048', payload_info['Algorithm'])
self.assertEqual(self.SALT, payload_info['Salt'])
self.assertEqual('testkey', payload_info['apex.key'])
+ self.assertEqual('sha256', payload_info['Hash Algorithm'])
self.assertEqual('0 bytes', payload_info['Tree Size'])
@test_utils.SkipIfExternalToolsUnavailable()
@@ -62,7 +63,7 @@
payload_file = self._GetTestPayload()
apex_utils.SignApexPayload(
'avbtool', payload_file, self.payload_key, 'testkey', 'SHA256_RSA2048',
- self.SALT, no_hashtree=True)
+ self.SALT, 'sha256', no_hashtree=True)
apex_utils.VerifyApexPayload(
'avbtool', payload_file, self.payload_key, True)
@@ -71,7 +72,7 @@
payload_file = self._GetTestPayload()
apex_utils.SignApexPayload(
'avbtool', payload_file, self.payload_key, 'testkey', 'SHA256_RSA2048',
- self.SALT, no_hashtree=False)
+ self.SALT, 'sha256', no_hashtree=False)
apex_utils.VerifyApexPayload('avbtool', payload_file, self.payload_key)
payload_info = apex_utils.ParseApexPayloadInfo('avbtool', payload_file)
self.assertEqual('4096 bytes', payload_info['Tree Size'])
@@ -81,7 +82,7 @@
payload_file = self._GetTestPayload()
apex_utils.SignApexPayload(
'avbtool', payload_file, self.payload_key, 'testkey', 'SHA256_RSA2048',
- self.SALT, no_hashtree=True)
+ self.SALT, 'sha256', no_hashtree=True)
apex_utils.VerifyApexPayload('avbtool', payload_file, self.payload_key,
no_hashtree=True)
payload_info = apex_utils.ParseApexPayloadInfo('avbtool', payload_file)
@@ -98,7 +99,7 @@
'avbtool',
payload_file,
self.payload_key,
- 'testkey', 'SHA256_RSA2048', self.SALT,
+ 'testkey', 'SHA256_RSA2048', self.SALT, 'sha256',
True,
payload_signer_args)
apex_utils.VerifyApexPayload(
@@ -115,6 +116,7 @@
'testkey',
'SHA256_RSA2048',
self.SALT,
+ 'sha256',
no_hashtree=True)
@test_utils.SkipIfExternalToolsUnavailable()
@@ -122,7 +124,7 @@
payload_file = self._GetTestPayload()
apex_utils.SignApexPayload(
'avbtool', payload_file, self.payload_key, 'testkey', 'SHA256_RSA2048',
- self.SALT, True)
+ self.SALT, 'sha256', True)
apex_utils.VerifyApexPayload(
'avbtool', payload_file, self.payload_key, True)
self.assertRaises(