Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4558,6 +4558,9 @@ endif
ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
$(hide) echo "full_recovery_image=true" >> $@
endif
ifdef BUILDING_VENDOR_IMAGE
$(hide) echo "board_builds_vendorimage=true" >> $@
endif
ifdef BOARD_USES_VENDORIMAGE
$(hide) echo "board_uses_vendorimage=true" >> $@
endif
Expand Down
22 changes: 14 additions & 8 deletions tools/releasetools/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3481,12 +3481,10 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img,
# In this case, the output sink is rooted at VENDOR
recovery_img_path = "etc/recovery.img"
recovery_resource_dat_path = "VENDOR/etc/recovery-resource.dat"
sh_dir = "bin"
else:
# In this case the output sink is rooted at SYSTEM
recovery_img_path = "vendor/etc/recovery.img"
recovery_resource_dat_path = "SYSTEM/vendor/etc/recovery-resource.dat"
sh_dir = "vendor/bin"

if full_recovery_image:
output_sink(recovery_img_path, recovery_img.data)
Expand Down Expand Up @@ -3569,11 +3567,7 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img,

# 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.
sh_location = os.path.join(sh_dir, "install-recovery.sh")

logger.info("putting script in %s", sh_location)

output_sink(sh_location, sh.encode())
output_sink("bin/install-recovery.sh", sh.encode())


class DynamicPartitionUpdate(object):
Expand Down Expand Up @@ -3612,10 +3606,11 @@ def __init__(self, src_size=None, tgt_size=None):

class DynamicPartitionsDifference(object):
def __init__(self, info_dict, block_diffs, progress_dict=None,
source_info_dict=None):
source_info_dict=None, build_without_vendor=False):
if progress_dict is None:
progress_dict = {}

self._build_without_vendor = build_without_vendor
self._remove_all_before_apply = False
if source_info_dict is None:
self._remove_all_before_apply = True
Expand Down Expand Up @@ -3740,6 +3735,17 @@ def append(line):
def comment(line):
self._op_list.append("# %s" % line)

if self._build_without_vendor:
comment('System-only build, keep original vendor partition')
# When building without vendor, we do not want to override
# any partition already existing. In this case, we can only
# resize, but not remove / create / re-create any other
# partition.
for p, u in self._partition_updates.items():
comment('Resize partition %s to %s' % (p, u.tgt_size))
append('resize %s %s' % (p, u.tgt_size))
return

if self._remove_all_before_apply:
comment('Remove all existing dynamic partitions and groups before '
'applying full OTA')
Expand Down
11 changes: 8 additions & 3 deletions tools/releasetools/make_recovery_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,18 @@ def main(argv):

board_uses_vendorimage = OPTIONS.info_dict.get(
"board_uses_vendorimage") == "true"
board_builds_vendorimage = OPTIONS.info_dict.get(
"board_builds_vendorimage") == "true"
target_files_dir = None

if board_uses_vendorimage:
if board_builds_vendorimage:
target_files_dir = "VENDOR"
else:
target_files_dir = "SYSTEM"
elif not board_uses_vendorimage:
target_files_dir = "SYSTEM/vendor"

def output_sink(fn, data):
if target_files_dir is None:
return
with open(os.path.join(output_dir, target_files_dir,
*fn.split("/")), "wb") as f:
f.write(data)
Expand Down
12 changes: 9 additions & 3 deletions tools/releasetools/non_ab_ota.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ def WriteFullOTAPackage(input_zip, output_file):
dynamic_partitions_diff = common.DynamicPartitionsDifference(
info_dict=OPTIONS.info_dict,
block_diffs=block_diff_dict.values(),
progress_dict=progress_dict)
progress_dict=progress_dict,
build_without_vendor=(not HasPartition(input_zip, "vendor")))
dynamic_partitions_diff.WriteScript(script, output_zip,
write_verify_script=OPTIONS.verify)
else:
Expand Down Expand Up @@ -672,12 +673,17 @@ def _WriteRecoveryImageToBoot(script, output_zip):

def HasRecoveryPatch(target_files_zip, info_dict):
board_uses_vendorimage = info_dict.get("board_uses_vendorimage") == "true"
board_builds_vendorimage = info_dict.get("board_builds_vendorimage") == "true"
target_files_dir = None

if board_uses_vendorimage:
if board_builds_vendorimage:
target_files_dir = "VENDOR"
else:
elif not board_uses_vendorimage:
target_files_dir = "SYSTEM/vendor"

if target_files_dir is None:
return True

patch = "%s/recovery-from-boot.p" % target_files_dir
img = "%s/etc/recovery.img" % target_files_dir

Expand Down