Merge "Add LZ4 support to the release tools" am: b8d67f3722
am: d2cbd57b33
Original change: https://android-review.googlesource.com/c/platform/build/+/1329115 Change-Id: I91a65d982169c81409532561f6dae3ddb17b7398
This commit is contained in:
@@ -1191,7 +1191,7 @@ def BuildVBMeta(image_path, partitions, name, needed_partitions):
|
||||
AddAftlInclusionProof(image_path)
|
||||
|
||||
|
||||
def _MakeRamdisk(sourcedir, fs_config_file=None):
|
||||
def _MakeRamdisk(sourcedir, fs_config_file=None, lz4_ramdisks=False):
|
||||
ramdisk_img = tempfile.NamedTemporaryFile()
|
||||
|
||||
if fs_config_file is not None and os.access(fs_config_file, os.F_OK):
|
||||
@@ -1200,12 +1200,16 @@ def _MakeRamdisk(sourcedir, fs_config_file=None):
|
||||
else:
|
||||
cmd = ["mkbootfs", os.path.join(sourcedir, "RAMDISK")]
|
||||
p1 = Run(cmd, stdout=subprocess.PIPE)
|
||||
p2 = Run(["minigzip"], stdin=p1.stdout, stdout=ramdisk_img.file.fileno())
|
||||
if lz4_ramdisks:
|
||||
p2 = Run(["lz4", "-l", "-12" , "--favor-decSpeed"], stdin=p1.stdout,
|
||||
stdout=ramdisk_img.file.fileno())
|
||||
else:
|
||||
p2 = Run(["minigzip"], stdin=p1.stdout, stdout=ramdisk_img.file.fileno())
|
||||
|
||||
p2.wait()
|
||||
p1.wait()
|
||||
assert p1.returncode == 0, "mkbootfs of %s ramdisk failed" % (sourcedir,)
|
||||
assert p2.returncode == 0, "minigzip of %s ramdisk failed" % (sourcedir,)
|
||||
assert p2.returncode == 0, "compression of %s ramdisk failed" % (sourcedir,)
|
||||
|
||||
return ramdisk_img
|
||||
|
||||
@@ -1243,7 +1247,8 @@ def _BuildBootableImage(image_name, sourcedir, fs_config_file, info_dict=None,
|
||||
img = tempfile.NamedTemporaryFile()
|
||||
|
||||
if has_ramdisk:
|
||||
ramdisk_img = _MakeRamdisk(sourcedir, fs_config_file)
|
||||
use_lz4 = info_dict.get("lz4_ramdisks") == 'true'
|
||||
ramdisk_img = _MakeRamdisk(sourcedir, fs_config_file, lz4_ramdisks=use_lz4)
|
||||
|
||||
# use MKBOOTIMG from environ, or "mkbootimg" if empty or not set
|
||||
mkbootimg = os.getenv('MKBOOTIMG') or "mkbootimg"
|
||||
@@ -1427,7 +1432,8 @@ def _BuildVendorBootImage(sourcedir, info_dict=None):
|
||||
|
||||
img = tempfile.NamedTemporaryFile()
|
||||
|
||||
ramdisk_img = _MakeRamdisk(sourcedir)
|
||||
use_lz4 = info_dict.get("lz4_ramdisks") == 'true'
|
||||
ramdisk_img = _MakeRamdisk(sourcedir, lz4_ramdisks=use_lz4)
|
||||
|
||||
# use MKBOOTIMG from environ, or "mkbootimg" if empty or not set
|
||||
mkbootimg = os.getenv('MKBOOTIMG') or "mkbootimg"
|
||||
|
Reference in New Issue
Block a user