Merge "Silence superfluous build messages."
diff --git a/core/Makefile b/core/Makefile
index 1624678..4ef0d89 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -31,12 +31,13 @@
$(if $(filter $(unique_product_copy_files_pairs),$(cf)),,\
$(eval unique_product_copy_files_pairs += $(cf))))
unique_product_copy_files_destinations :=
+product_copy_files_ignored :=
$(foreach cf,$(unique_product_copy_files_pairs), \
$(eval _src := $(call word-colon,1,$(cf))) \
$(eval _dest := $(call word-colon,2,$(cf))) \
$(call check-product-copy-files,$(cf)) \
$(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \
- $(info PRODUCT_COPY_FILES $(cf) ignored.), \
+ $(eval product_copy_files_ignored += $(cf)), \
$(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
$(if $(filter %.xml,$(_dest)),\
$(eval $(call copy-xml-file-checked,$(_src),$(_fulldest))),\
@@ -45,6 +46,14 @@
$(eval $(call copy-one-file,$(_src),$(_fulldest))))) \
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \
$(eval unique_product_copy_files_destinations += $(_dest))))
+
+# Dump a list of overriden (and ignored PRODUCT_COPY_FILES entries)
+$(file >$(PRODUCT_OUT)/product_copy_files_ignored.txt,$(subst $(space),$(newline),$(strip $(product_copy_files_ignored))))
+ifdef dist_goal
+$(file >$(DIST_DIR)/logs/product_copy_files_ignored.txt,$(subst $(space),$(newline),$(strip $(product_copy_files_ignored))))
+endif
+
+product_copy_files_ignored :=
unique_product_copy_files_pairs :=
unique_product_copy_files_destinations :=
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index d16f5eb..f80d0ec 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -75,6 +75,11 @@
# Values for "certificate" in apkcerts that mean special things.
SPECIAL_CERT_STRINGS = ("PRESIGNED", "EXTERNAL")
+
+# The partitions allowed to be signed by AVB (Android verified boot 2.0).
+AVB_PARTITIONS = ('boot', 'recovery', 'system', 'vendor', 'dtbo')
+
+
class ErrorCode(object):
"""Define error_codes for failures that happen during the actual
update package installation.
@@ -727,10 +732,18 @@
def CheckSize(data, target, info_dict):
- """Check the data string passed against the max size limit, if
- any, for the given target. Raise exception if the data is too big.
- Print a warning if the data is nearing the maximum size."""
+ """Checks the data string passed against the max size limit.
+ For non-AVB images, raise exception if the data is too big. Print a warning
+ if the data is nearing the maximum size.
+
+ For AVB images, the actual image size should be identical to the limit.
+
+ Args:
+ data: A string that contains all the data for the partition.
+ target: The partition name. The ".img" suffix is optional.
+ info_dict: The dict to be looked up for relevant info.
+ """
if target.endswith(".img"):
target = target[:-4]
mount_point = "/" + target
@@ -750,14 +763,22 @@
return
size = len(data)
- pct = float(size) * 100.0 / limit
- msg = "%s size (%d) is %.2f%% of limit (%d)" % (target, size, pct, limit)
- if pct >= 99.0:
- raise ExternalError(msg)
- elif pct >= 95.0:
- print("\n WARNING: %s\n" % (msg,))
- elif OPTIONS.verbose:
- print(" ", msg)
+ # target could be 'userdata' or 'cache'. They should follow the non-AVB image
+ # path.
+ if info_dict.get("avb_enable") == "true" and target in AVB_PARTITIONS:
+ if size != limit:
+ raise ExternalError(
+ "Mismatching image size for %s: expected %d actual %d" % (
+ target, limit, size))
+ else:
+ pct = float(size) * 100.0 / limit
+ msg = "%s size (%d) is %.2f%% of limit (%d)" % (target, size, pct, limit)
+ if pct >= 99.0:
+ raise ExternalError(msg)
+ elif pct >= 95.0:
+ print("\n WARNING: %s\n" % (msg,))
+ elif OPTIONS.verbose:
+ print(" ", msg)
def ReadApkCerts(tf_zip):