Merge "Add the nfc_extras shared lib to mainline."
diff --git a/core/config.mk b/core/config.mk
index b34bd2b..483bc77 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -48,19 +48,6 @@
# Prevent accidentally changing these variables
.KATI_READONLY := SHELL empty space comma newline pound backslash
-# this turns off the suffix rules built into make
-.SUFFIXES:
-
-# this turns off the RCS / SCCS implicit rules of GNU Make
-% : RCS/%,v
-% : RCS/%
-% : %,v
-% : s.%
-% : SCCS/s.%
-
-# If a rule fails, delete $@.
-.DELETE_ON_ERROR:
-
# Mark variables that should be coming as environment variables from soong_ui
# as readonly
.KATI_READONLY := OUT_DIR TMPDIR BUILD_DATETIME_FILE
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index a0f7459..1bce60e 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -112,12 +112,12 @@
simg = sparse_img.SparseImage(imgname)
care_map_ranges = simg.care_map
- key = which + "_adjusted_partition_size"
- adjusted_blocks = OPTIONS.info_dict.get(key)
- if adjusted_blocks:
- assert adjusted_blocks > 0, "blocks should be positive for " + which
- care_map_ranges = care_map_ranges.intersect(rangelib.RangeSet(
- "0-%d" % (adjusted_blocks,)))
+ key = which + "_image_blocks"
+ image_blocks = OPTIONS.info_dict.get(key)
+ if image_blocks:
+ assert image_blocks > 0, "blocks for {} must be positive".format(which)
+ care_map_ranges = care_map_ranges.intersect(
+ rangelib.RangeSet("0-{}".format(image_blocks)))
return [which, care_map_ranges.to_string_raw()]
@@ -316,18 +316,18 @@
if block_list:
block_list.Write()
- # Set the 'adjusted_partition_size' that excludes the verity blocks of the
- # given image. When avb is enabled, this size is the max image size returned
- # by the avb tool.
+ # Set the '_image_blocks' that excludes the verity metadata blocks of the
+ # given image. When AVB is enabled, this size is the max image size returned
+ # by the AVB tool.
is_verity_partition = "verity_block_device" in image_props
verity_supported = (image_props.get("verity") == "true" or
image_props.get("avb_enable") == "true")
is_avb_enable = image_props.get("avb_hashtree_enable") == "true"
if verity_supported and (is_verity_partition or is_avb_enable):
- adjusted_blocks_value = image_props.get("partition_size")
- if adjusted_blocks_value:
- adjusted_blocks_key = what + "_adjusted_partition_size"
- info_dict[adjusted_blocks_key] = int(adjusted_blocks_value)/4096 - 1
+ image_size = image_props.get("image_size")
+ if image_size:
+ image_blocks_key = what + "_image_blocks"
+ info_dict[image_blocks_key] = int(image_size) / 4096 - 1
def AddUserdata(output_zip):
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 1904085..c422280 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -373,7 +373,7 @@
True on success, False otherwise.
"""
# get properties
- image_size = int(prop_dict["partition_size"])
+ image_size = int(prop_dict["image_size"])
block_dev = prop_dict["verity_block_device"]
signer_key = prop_dict["verity_key"] + ".pk8"
if OPTIONS.verity_signer_path is not None:
@@ -404,10 +404,10 @@
return False
# build the full verified image
- target_size = int(prop_dict["original_partition_size"])
+ partition_size = int(prop_dict["partition_size"])
verity_size = int(prop_dict["verity_size"])
- padding_size = target_size - image_size - verity_size
+ padding_size = partition_size - image_size - verity_size
assert padding_size >= 0
if not BuildVerifiedImage(out_file,
@@ -564,25 +564,25 @@
if OPTIONS.verbose:
print("Allocating %d MB for %s." % (size // BYTES_IN_MB, out_file))
- # Adjust the partition size to make room for the hashes if this is to be
- # verified.
+ prop_dict["image_size"] = prop_dict["partition_size"]
+
+ # Adjust the image size to make room for the hashes if this is to be verified.
if verity_supported and is_verity_partition:
partition_size = int(prop_dict.get("partition_size"))
- (adjusted_size, verity_size) = AdjustPartitionSizeForVerity(
+ image_size, verity_size = AdjustPartitionSizeForVerity(
partition_size, verity_fec_supported)
- if not adjusted_size:
+ if not image_size:
return False
- prop_dict["partition_size"] = str(adjusted_size)
- prop_dict["original_partition_size"] = str(partition_size)
+ prop_dict["image_size"] = str(image_size)
prop_dict["verity_size"] = str(verity_size)
- # Adjust partition size for AVB hash footer or AVB hashtree footer.
avb_footer_type = ''
if prop_dict.get("avb_hash_enable") == "true":
avb_footer_type = 'hash'
elif prop_dict.get("avb_hashtree_enable") == "true":
avb_footer_type = 'hashtree'
+ # Adjust the image size for AVB hash footer or AVB hashtree footer.
if avb_footer_type:
avbtool = prop_dict["avb_avbtool"]
partition_size = prop_dict["partition_size"]
@@ -593,8 +593,7 @@
if max_image_size <= 0:
print("AVBCalcMaxImageSize is <= 0: %d" % max_image_size)
return False
- prop_dict["partition_size"] = str(max_image_size)
- prop_dict["original_partition_size"] = partition_size
+ prop_dict["image_size"] = str(max_image_size)
if fs_type.startswith("ext"):
build_command = [prop_dict["ext_mkuserimg"]]
@@ -603,7 +602,7 @@
run_e2fsck = True
build_command.extend([in_dir, out_file, fs_type,
prop_dict["mount_point"]])
- build_command.append(prop_dict["partition_size"])
+ build_command.append(prop_dict["image_size"])
if "journal_size" in prop_dict:
build_command.extend(["-j", prop_dict["journal_size"]])
if "timestamp" in prop_dict:
@@ -662,7 +661,7 @@
build_command.extend(["-a"])
elif fs_type.startswith("f2fs"):
build_command = ["mkf2fsuserimg.sh"]
- build_command.extend([out_file, prop_dict["partition_size"]])
+ build_command.extend([out_file, prop_dict["image_size"]])
if fs_config:
build_command.extend(["-C", fs_config])
build_command.extend(["-f", in_dir])
@@ -691,18 +690,13 @@
in_dir, du_str,
int(prop_dict.get("partition_reserved_size", 0)),
int(prop_dict.get("partition_reserved_size", 0)) // BYTES_IN_MB))
- if "original_partition_size" in prop_dict:
- print(
- "The max size for filsystem files is {} bytes ({} MB), out of a "
- "total image size of {} bytes ({} MB).".format(
- int(prop_dict["partition_size"]),
- int(prop_dict["partition_size"]) // BYTES_IN_MB,
- int(prop_dict["original_partition_size"]),
- int(prop_dict["original_partition_size"]) // BYTES_IN_MB))
- else:
- print("The max image size is {} bytes ({} MB).".format(
- int(prop_dict["partition_size"]),
- int(prop_dict["partition_size"]) // BYTES_IN_MB))
+ print(
+ "The max image size for filsystem files is {} bytes ({} MB), out of a "
+ "total partition size of {} bytes ({} MB).".format(
+ int(prop_dict["image_size"]),
+ int(prop_dict["image_size"]) // BYTES_IN_MB,
+ int(prop_dict["partition_size"]),
+ int(prop_dict["partition_size"]) // BYTES_IN_MB))
return False
# Check if there's enough headroom space available for ext4 image.
@@ -712,14 +706,14 @@
if not fs_spans_partition:
mount_point = prop_dict.get("mount_point")
- partition_size = int(prop_dict.get("partition_size"))
- image_size = GetSimgSize(out_file)
- if image_size > partition_size:
+ image_size = int(prop_dict["image_size"])
+ sparse_image_size = GetSimgSize(out_file)
+ if sparse_image_size > image_size:
print("Error: %s image size of %d is larger than partition size of "
- "%d" % (mount_point, image_size, partition_size))
+ "%d" % (mount_point, sparse_image_size, image_size))
return False
if verity_supported and is_verity_partition:
- ZeroPadSimg(out_file, partition_size - image_size)
+ ZeroPadSimg(out_file, image_size - sparse_image_size)
# Create the verified image if this is to be verified.
if verity_supported and is_verity_partition:
@@ -729,7 +723,7 @@
# Add AVB HASH or HASHTREE footer (metadata).
if avb_footer_type:
avbtool = prop_dict["avb_avbtool"]
- original_partition_size = prop_dict["original_partition_size"]
+ partition_size = prop_dict["partition_size"]
partition_name = prop_dict["partition_name"]
# key_path and algorithm are only available when chain partition is used.
key_path = prop_dict.get("avb_key_path")
@@ -738,7 +732,7 @@
# avb_add_hash_footer_args or avb_add_hashtree_footer_args
additional_args = prop_dict["avb_add_" + avb_footer_type + "_footer_args"]
if not AVBAddFooter(out_file, avbtool, avb_footer_type,
- original_partition_size, partition_name, key_path,
+ partition_size, partition_name, key_path,
algorithm, salt, additional_args):
return False
@@ -988,23 +982,18 @@
return True
return False
- if "original_partition_size" in image_prop:
- size_property = "original_partition_size"
- else:
- size_property = "partition_size"
-
if mount_point == "system":
- copy_prop(size_property, "system_size")
+ copy_prop("partition_size", "system_size")
elif mount_point == "system_other":
- copy_prop(size_property, "system_size")
+ copy_prop("partition_size", "system_size")
elif mount_point == "vendor":
- copy_prop(size_property, "vendor_size")
+ copy_prop("partition_size", "vendor_size")
elif mount_point == "odm":
- copy_prop(size_property, "odm_size")
+ copy_prop("partition_size", "odm_size")
elif mount_point == "product":
- copy_prop(size_property, "product_size")
+ copy_prop("partition_size", "product_size")
elif mount_point == "product_services":
- copy_prop(size_property, "product_services_size")
+ copy_prop("partition_size", "product_services_size")
return d
diff --git a/tools/releasetools/test_add_img_to_target_files.py b/tools/releasetools/test_add_img_to_target_files.py
index 82e4683..a73746e 100644
--- a/tools/releasetools/test_add_img_to_target_files.py
+++ b/tools/releasetools/test_add_img_to_target_files.py
@@ -369,7 +369,7 @@
(0xCAC3, 4),
(0xCAC1, 6)])
OPTIONS.info_dict = {
- 'system_adjusted_partition_size' : 12,
+ 'system_image_blocks' : 12,
}
name, care_map = GetCareMap('system', sparse_image)
self.assertEqual('system', name)
@@ -384,6 +384,6 @@
(0xCAC3, 4),
(0xCAC1, 6)])
OPTIONS.info_dict = {
- 'system_adjusted_partition_size' : -12,
+ 'system_image_blocks' : -12,
}
self.assertRaises(AssertionError, GetCareMap, 'system', sparse_image)
diff --git a/tools/releasetools/test_validate_target_files.py b/tools/releasetools/test_validate_target_files.py
index 3ba89a1..c7dbffc 100644
--- a/tools/releasetools/test_validate_target_files.py
+++ b/tools/releasetools/test_validate_target_files.py
@@ -116,13 +116,13 @@
def _generate_system_image(self, output_file):
verity_fec = True
partition_size = 1024 * 1024
- adjusted_size, verity_size = build_image.AdjustPartitionSizeForVerity(
+ image_size, verity_size = build_image.AdjustPartitionSizeForVerity(
partition_size, verity_fec)
# Use an empty root directory.
system_root = common.MakeTempDir()
cmd = ['mkuserimg_mke2fs', '-s', system_root, output_file, 'ext4',
- '/system', str(adjusted_size), '-j', '0']
+ '/system', str(image_size), '-j', '0']
proc = common.Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdoutdata, _ = proc.communicate()
self.assertEqual(
@@ -132,8 +132,8 @@
# Append the verity metadata.
prop_dict = {
- 'original_partition_size' : str(partition_size),
- 'partition_size' : str(adjusted_size),
+ 'partition_size' : str(partition_size),
+ 'image_size' : str(image_size),
'verity_block_device' : '/dev/block/system',
'verity_key' : os.path.join(self.testdata_dir, 'testkey'),
'verity_signer_cmd' : 'verity_signer',