aboutsummaryrefslogtreecommitdiff
path: root/tools/releasetools/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/releasetools/common.py')
-rw-r--r--tools/releasetools/common.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 88362489fd..d91a713276 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -490,7 +490,6 @@ class BuildInfo(object):
return -1
props = [
- "ro.board.api_level",
"ro.board.first_api_level",
"ro.product.first_api_level",
]
@@ -955,6 +954,13 @@ def LoadInfoDict(input_file, repacking=False):
d["build.prop"] = d["system.build.prop"]
if d.get("avb_enable") == "true":
+ build_info = BuildInfo(d, use_legacy_id=True)
+ # Set up the salt for partitions without build.prop
+ if build_info.fingerprint:
+ if "fingerprint" not in d:
+ d["fingerprint"] = build_info.fingerprint
+ if "avb_salt" not in d:
+ d["avb_salt"] = sha256(build_info.fingerprint.encode()).hexdigest()
# Set the vbmeta digest if exists
try:
d["vbmeta_digest"] = read_helper("META/vbmeta_digest.txt").rstrip()
@@ -1517,7 +1523,7 @@ def GetAvbPartitionsArg(partitions,
AVB_ARG_NAME_CHAIN_PARTITION: []
}
- for partition, path in partitions.items():
+ for partition, path in sorted(partitions.items()):
avb_partition_arg = GetAvbPartitionArg(partition, path, info_dict)
if not avb_partition_arg:
continue
@@ -1605,7 +1611,7 @@ def BuildVBMeta(image_path, partitions, name, needed_partitions,
"avb_custom_vbmeta_images_partition_list", "").strip().split()]
avb_partitions = {}
- for partition, path in partitions.items():
+ for partition, path in sorted(partitions.items()):
if partition not in needed_partitions:
continue
assert (partition in AVB_PARTITIONS or
@@ -1965,7 +1971,7 @@ def GetBootableImage(name, prebuilt_name, unpack_dir, tree_subdir,
return None
-def _BuildVendorBootImage(sourcedir, partition_name, info_dict=None):
+def _BuildVendorBootImage(sourcedir, fs_config_file, partition_name, info_dict=None):
"""Build a vendor boot image from the specified sourcedir.
Take a ramdisk, dtb, and vendor_cmdline from the input (in 'sourcedir'), and
@@ -1981,7 +1987,7 @@ def _BuildVendorBootImage(sourcedir, partition_name, info_dict=None):
img = tempfile.NamedTemporaryFile()
ramdisk_format = GetRamdiskFormat(info_dict)
- ramdisk_img = _MakeRamdisk(sourcedir, ramdisk_format=ramdisk_format)
+ ramdisk_img = _MakeRamdisk(sourcedir, fs_config_file=fs_config_file, ramdisk_format=ramdisk_format)
# use MKBOOTIMG from environ, or "mkbootimg" if empty or not set
mkbootimg = os.getenv('MKBOOTIMG') or "mkbootimg"
@@ -2095,8 +2101,9 @@ def GetVendorBootImage(name, prebuilt_name, unpack_dir, tree_subdir,
if info_dict is None:
info_dict = OPTIONS.info_dict
+ fs_config = "META/" + tree_subdir.lower() + "_filesystem_config.txt"
data = _BuildVendorBootImage(
- os.path.join(unpack_dir, tree_subdir), "vendor_boot", info_dict)
+ os.path.join(unpack_dir, tree_subdir), os.path.join(unpack_dir, fs_config), "vendor_boot", info_dict)
if data:
return File(name, data)
return None
@@ -2120,7 +2127,7 @@ def GetVendorKernelBootImage(name, prebuilt_name, unpack_dir, tree_subdir,
info_dict = OPTIONS.info_dict
data = _BuildVendorBootImage(
- os.path.join(unpack_dir, tree_subdir), "vendor_kernel_boot", info_dict)
+ os.path.join(unpack_dir, tree_subdir), None, "vendor_kernel_boot", info_dict)
if data:
return File(name, data)
return None