forked from openkylin/platform_build
save file block allocations in target_files
make_ext4fs can now output a file listing the blocks used for each file in the image. Request this file and save it in the target_files; it will be used for future improvements to block OTAs. Bug: 16984795 Change-Id: Id1e60465e3b5a9d126a7934b4d089cf34d8fec44
This commit is contained in:
parent
7a864ea196
commit
f21cb5a219
|
@ -49,23 +49,38 @@ OPTIONS = common.OPTIONS
|
|||
def AddSystem(output_zip, sparse=True, prefix="IMAGES/"):
|
||||
"""Turn the contents of SYSTEM into a system image and store it in
|
||||
output_zip."""
|
||||
data = BuildSystem(OPTIONS.input_tmp, OPTIONS.info_dict, sparse=sparse)
|
||||
block_list = tempfile.NamedTemporaryFile()
|
||||
data = BuildSystem(OPTIONS.input_tmp, OPTIONS.info_dict, sparse=sparse,
|
||||
block_list=block_list.name)
|
||||
common.ZipWriteStr(output_zip, prefix + "system.img", data)
|
||||
with open(block_list.name, "rb") as f:
|
||||
block_list_data = f.read()
|
||||
common.ZipWriteStr(output_zip, prefix + "system.map", block_list_data)
|
||||
block_list.close()
|
||||
|
||||
def BuildSystem(input_dir, info_dict, sparse=True, map_file=None):
|
||||
def BuildSystem(input_dir, info_dict, sparse=True, map_file=None,
|
||||
block_list=None):
|
||||
return CreateImage(input_dir, info_dict, "system",
|
||||
sparse=sparse, map_file=map_file)
|
||||
sparse=sparse, map_file=map_file, block_list=block_list)
|
||||
|
||||
def AddVendor(output_zip, sparse=True, prefix="IMAGES/"):
|
||||
data = BuildVendor(OPTIONS.input_tmp, OPTIONS.info_dict, sparse=sparse)
|
||||
block_list = tempfile.NamedTemporaryFile()
|
||||
data = BuildVendor(OPTIONS.input_tmp, OPTIONS.info_dict, sparse=sparse,
|
||||
block_list=block_list.name)
|
||||
common.ZipWriteStr(output_zip, prefix + "vendor.img", data)
|
||||
with open(block_list.name, "rb") as f:
|
||||
block_list_data = f.read()
|
||||
common.ZipWriteStr(output_zip, prefix + "vendor.map", block_list_data)
|
||||
block_list.close()
|
||||
|
||||
def BuildVendor(input_dir, info_dict, sparse=True, map_file=None):
|
||||
def BuildVendor(input_dir, info_dict, sparse=True, map_file=None,
|
||||
block_list=None):
|
||||
return CreateImage(input_dir, info_dict, "vendor",
|
||||
sparse=sparse, map_file=map_file)
|
||||
sparse=sparse, map_file=map_file, block_list=block_list)
|
||||
|
||||
|
||||
def CreateImage(input_dir, info_dict, what, sparse=True, map_file=None):
|
||||
def CreateImage(input_dir, info_dict, what, sparse=True, map_file=None,
|
||||
block_list=None):
|
||||
print "creating " + what + ".img..."
|
||||
|
||||
img = tempfile.NamedTemporaryFile()
|
||||
|
@ -104,7 +119,8 @@ def CreateImage(input_dir, info_dict, what, sparse=True, map_file=None):
|
|||
succ = build_image.BuildImage(os.path.join(input_dir, what),
|
||||
image_props, img.name,
|
||||
fs_config=fs_config,
|
||||
fc_config=fc_config)
|
||||
fc_config=fc_config,
|
||||
block_list=block_list)
|
||||
assert succ, "build " + what + ".img image failed"
|
||||
|
||||
mapdata = None
|
||||
|
|
|
@ -209,7 +209,8 @@ def MakeVerityEnabledImage(out_file, prop_dict):
|
|||
|
||||
def BuildImage(in_dir, prop_dict, out_file,
|
||||
fs_config=None,
|
||||
fc_config=None):
|
||||
fc_config=None,
|
||||
block_list=None):
|
||||
"""Build an image to out_file from in_dir with property prop_dict.
|
||||
|
||||
Args:
|
||||
|
@ -252,6 +253,8 @@ def BuildImage(in_dir, prop_dict, out_file,
|
|||
build_command.extend(["-T", str(prop_dict["timestamp"])])
|
||||
if fs_config is not None:
|
||||
build_command.extend(["-C", fs_config])
|
||||
if block_list is not None:
|
||||
build_command.extend(["-B", block_list])
|
||||
if fc_config is not None:
|
||||
build_command.append(fc_config)
|
||||
elif "selinux_fc" in prop_dict:
|
||||
|
|
|
@ -90,6 +90,7 @@ def main(argv):
|
|||
if images:
|
||||
for i in images:
|
||||
if bootable_only and i not in ("boot.img", "recovery.img"): continue
|
||||
if not i.endswith(".img"): continue
|
||||
with open(os.path.join(images_path, i), "r") as f:
|
||||
common.ZipWriteStr(output_zip, i, f.read())
|
||||
done = True
|
||||
|
|
Loading…
Reference in New Issue