Merge "Build repeatable system images with mke2fs."
This commit is contained in:
commit
404af2ca4b
|
@ -59,6 +59,7 @@ import shlex
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import uuid
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
import build_image
|
import build_image
|
||||||
|
@ -258,6 +259,19 @@ def CreateImage(input_dir, info_dict, what, output_file, block_list=None):
|
||||||
if block_list:
|
if block_list:
|
||||||
image_props["block_list"] = block_list.name
|
image_props["block_list"] = block_list.name
|
||||||
|
|
||||||
|
# Use repeatable ext4 FS UUID and hash_seed UUID (based on partition name and
|
||||||
|
# build fingerprint).
|
||||||
|
uuid_seed = what + "-"
|
||||||
|
if "build.prop" in info_dict:
|
||||||
|
build_prop = info_dict["build.prop"]
|
||||||
|
if "ro.build.fingerprint" in build_prop:
|
||||||
|
uuid_seed += build_prop["ro.build.fingerprint"]
|
||||||
|
elif "ro.build.thumbprint" in build_prop:
|
||||||
|
uuid_seed += build_prop["ro.build.thumbprint"]
|
||||||
|
image_props["uuid"] = str(uuid.uuid5(uuid.NAMESPACE_URL, uuid_seed))
|
||||||
|
hash_seed = "hash_seed-" + uuid_seed
|
||||||
|
image_props["hash_seed"] = str(uuid.uuid5(uuid.NAMESPACE_URL, hash_seed))
|
||||||
|
|
||||||
succ = build_image.BuildImage(os.path.join(temp_dir, what),
|
succ = build_image.BuildImage(os.path.join(temp_dir, what),
|
||||||
image_props, output_file.name)
|
image_props, output_file.name)
|
||||||
assert succ, "build " + what + ".img image failed"
|
assert succ, "build " + what + ".img image failed"
|
||||||
|
|
|
@ -483,6 +483,12 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
|
||||||
build_command.extend(["-e", prop_dict["flash_erase_block_size"]])
|
build_command.extend(["-e", prop_dict["flash_erase_block_size"]])
|
||||||
if "flash_logical_block_size" in prop_dict:
|
if "flash_logical_block_size" in prop_dict:
|
||||||
build_command.extend(["-o", prop_dict["flash_logical_block_size"]])
|
build_command.extend(["-o", prop_dict["flash_logical_block_size"]])
|
||||||
|
# Specify UUID and hash_seed if using mke2fs.
|
||||||
|
if prop_dict["ext_mkuserimg"] == "mkuserimg_mke2fs.sh":
|
||||||
|
if "uuid" in prop_dict:
|
||||||
|
build_command.extend(["-U", prop_dict["uuid"]])
|
||||||
|
if "hash_seed" in prop_dict:
|
||||||
|
build_command.extend(["-S", prop_dict["hash_seed"]])
|
||||||
if "selinux_fc" in prop_dict:
|
if "selinux_fc" in prop_dict:
|
||||||
build_command.append(prop_dict["selinux_fc"])
|
build_command.append(prop_dict["selinux_fc"])
|
||||||
elif fs_type.startswith("squash"):
|
elif fs_type.startswith("squash"):
|
||||||
|
|
Loading…
Reference in New Issue