Merge "releasetools: Move the AVB salt setup into common.LoadInfoDict()."
This commit is contained in:
commit
4b4c3d91b0
|
@ -46,7 +46,6 @@ Usage: add_img_to_target_files [flag] target_files
|
|||
from __future__ import print_function
|
||||
|
||||
import datetime
|
||||
import hashlib
|
||||
import os
|
||||
import shlex
|
||||
import shutil
|
||||
|
@ -668,17 +667,6 @@ def AddImagesToTargetFiles(filename):
|
|||
|
||||
has_recovery = (OPTIONS.info_dict.get("no_recovery") != "true")
|
||||
|
||||
if OPTIONS.info_dict.get("avb_enable") == "true":
|
||||
fp = None
|
||||
if "build.prop" in OPTIONS.info_dict:
|
||||
build_prop = OPTIONS.info_dict["build.prop"]
|
||||
if "ro.build.fingerprint" in build_prop:
|
||||
fp = build_prop["ro.build.fingerprint"]
|
||||
elif "ro.build.thumbprint" in build_prop:
|
||||
fp = build_prop["ro.build.thumbprint"]
|
||||
if fp:
|
||||
OPTIONS.info_dict["avb_salt"] = hashlib.sha256(fp).hexdigest()
|
||||
|
||||
# A map between partition names and their paths, which could be used when
|
||||
# generating AVB vbmeta image.
|
||||
partitions = dict()
|
||||
|
|
|
@ -31,12 +31,10 @@ import tempfile
|
|||
import threading
|
||||
import time
|
||||
import zipfile
|
||||
from hashlib import sha1, sha256
|
||||
|
||||
import blockimgdiff
|
||||
|
||||
from hashlib import sha1 as sha1
|
||||
|
||||
|
||||
class Options(object):
|
||||
def __init__(self):
|
||||
platform_search_path = {
|
||||
|
@ -259,6 +257,20 @@ def LoadInfoDict(input_file, input_dir=None):
|
|||
|
||||
d["build.prop"] = LoadBuildProp(read_helper, 'SYSTEM/build.prop')
|
||||
d["vendor.build.prop"] = LoadBuildProp(read_helper, 'VENDOR/build.prop')
|
||||
|
||||
# Set up the salt (based on fingerprint or thumbprint) that will be used when
|
||||
# adding AVB footer.
|
||||
if d.get("avb_enable") == "true":
|
||||
fp = None
|
||||
if "build.prop" in d:
|
||||
build_prop = d["build.prop"]
|
||||
if "ro.build.fingerprint" in build_prop:
|
||||
fp = build_prop["ro.build.fingerprint"]
|
||||
elif "ro.build.thumbprint" in build_prop:
|
||||
fp = build_prop["ro.build.thumbprint"]
|
||||
if fp:
|
||||
d["avb_salt"] = sha256(fp).hexdigest()
|
||||
|
||||
return d
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue