releasetools: Make recovery patch use bsdiff exclusively
It seems like switching from minigzip to toybox gzip (bug: 288169261) makes imgdiff fail in in this way: * W imgdiff : imgdiff.cpp:1435 Failed to reconstruct target deflate chunk 3 []; treating as normal * E imgdiff : imgdiff.cpp:1390 Failed to set bonus data Test: Sign non-AB target files package Change-Id: I29f1d8f1168347141d80860e8ed02e19b0031447 Signed-off-by: RITEFANG <1721985272@qq.com>
This commit is contained in:
@@ -3833,11 +3833,9 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img,
|
|||||||
if board_builds_vendorimage:
|
if board_builds_vendorimage:
|
||||||
# In this case, the output sink is rooted at VENDOR
|
# In this case, the output sink is rooted at VENDOR
|
||||||
recovery_img_path = "etc/recovery.img"
|
recovery_img_path = "etc/recovery.img"
|
||||||
recovery_resource_dat_path = "VENDOR/etc/recovery-resource.dat"
|
|
||||||
elif not board_uses_vendorimage:
|
elif not board_uses_vendorimage:
|
||||||
# In this case the output sink is rooted at SYSTEM
|
# In this case the output sink is rooted at SYSTEM
|
||||||
recovery_img_path = "vendor/etc/recovery.img"
|
recovery_img_path = "vendor/etc/recovery.img"
|
||||||
recovery_resource_dat_path = "SYSTEM/vendor/etc/recovery-resource.dat"
|
|
||||||
else:
|
else:
|
||||||
logger.warning('Recovery patch generation is disable when prebuilt vendor image is used.')
|
logger.warning('Recovery patch generation is disable when prebuilt vendor image is used.')
|
||||||
return None
|
return None
|
||||||
@@ -3846,24 +3844,7 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img,
|
|||||||
output_sink(recovery_img_path, recovery_img.data)
|
output_sink(recovery_img_path, recovery_img.data)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
include_recovery_dtbo = info_dict.get("include_recovery_dtbo") == "true"
|
d = Difference(recovery_img, boot_img)
|
||||||
include_recovery_acpio = info_dict.get("include_recovery_acpio") == "true"
|
|
||||||
path = os.path.join(input_dir, recovery_resource_dat_path)
|
|
||||||
# Use bsdiff to handle mismatching entries (Bug: 72731506)
|
|
||||||
if include_recovery_dtbo or include_recovery_acpio:
|
|
||||||
diff_program = ["bsdiff"]
|
|
||||||
bonus_args = ""
|
|
||||||
assert not os.path.exists(path)
|
|
||||||
else:
|
|
||||||
diff_program = ["imgdiff"]
|
|
||||||
if os.path.exists(path):
|
|
||||||
diff_program.append("-b")
|
|
||||||
diff_program.append(path)
|
|
||||||
bonus_args = "--bonus /vendor/etc/recovery-resource.dat"
|
|
||||||
else:
|
|
||||||
bonus_args = ""
|
|
||||||
|
|
||||||
d = Difference(recovery_img, boot_img, diff_program=diff_program)
|
|
||||||
_, _, patch = d.ComputePatch()
|
_, _, patch = d.ComputePatch()
|
||||||
output_sink("recovery-from-boot.p", patch)
|
output_sink("recovery-from-boot.p", patch)
|
||||||
|
|
||||||
@@ -3901,7 +3882,7 @@ fi
|
|||||||
else:
|
else:
|
||||||
sh = """#!/vendor/bin/sh
|
sh = """#!/vendor/bin/sh
|
||||||
if ! applypatch --check %(recovery_type)s:%(recovery_device)s:%(recovery_size)d:%(recovery_sha1)s; then
|
if ! applypatch --check %(recovery_type)s:%(recovery_device)s:%(recovery_size)d:%(recovery_sha1)s; then
|
||||||
applypatch %(bonus_args)s \\
|
applypatch \\
|
||||||
--patch /vendor/recovery-from-boot.p \\
|
--patch /vendor/recovery-from-boot.p \\
|
||||||
--source %(boot_type)s:%(boot_device)s:%(boot_size)d:%(boot_sha1)s \\
|
--source %(boot_type)s:%(boot_device)s:%(boot_size)d:%(boot_sha1)s \\
|
||||||
--target %(recovery_type)s:%(recovery_device)s:%(recovery_size)d:%(recovery_sha1)s && \\
|
--target %(recovery_type)s:%(recovery_device)s:%(recovery_size)d:%(recovery_sha1)s && \\
|
||||||
@@ -3917,8 +3898,7 @@ fi
|
|||||||
'boot_type': boot_type,
|
'boot_type': boot_type,
|
||||||
'boot_device': boot_device + '$(getprop ro.boot.slot_suffix)',
|
'boot_device': boot_device + '$(getprop ro.boot.slot_suffix)',
|
||||||
'recovery_type': recovery_type,
|
'recovery_type': recovery_type,
|
||||||
'recovery_device': recovery_device + '$(getprop ro.boot.slot_suffix)',
|
'recovery_device': recovery_device + '$(getprop ro.boot.slot_suffix)'}
|
||||||
'bonus_args': bonus_args}
|
|
||||||
|
|
||||||
# The install script location moved from /system/etc to /system/bin in the L
|
# The install script location moved from /system/etc to /system/bin in the L
|
||||||
# release. In the R release it is in VENDOR/bin or SYSTEM/vendor/bin.
|
# release. In the R release it is in VENDOR/bin or SYSTEM/vendor/bin.
|
||||||
|
Reference in New Issue
Block a user