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
5 changes: 5 additions & 0 deletions core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2124,6 +2124,8 @@ ifdef BUILDING_RECOVERY_IMAGE

INTERNAL_RECOVERYIMAGE_FILES := $(filter $(TARGET_RECOVERY_OUT)/%, \
$(ALL_DEFAULT_INSTALLED_MODULES))
INTERNAL_RECOVERYIMAGE_FILES += $(filter $(PRODUCT_OUT)/install/%, \
$(ALL_DEFAULT_INSTALLED_MODULES))

INSTALLED_FILES_FILE_RECOVERY := $(PRODUCT_OUT)/installed-files-recovery.txt
INSTALLED_FILES_JSON_RECOVERY := $(INSTALLED_FILES_FILE_RECOVERY:.txt=.json)
Expand Down Expand Up @@ -5747,6 +5749,9 @@ ifneq (true,$(BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT))
$(hide) $(call package_files-copy-root, \
$(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/$(PRIVATE_RECOVERY_OUT)/RAMDISK)
endif
@# OTA install helpers
$(hide) $(call package_files-copy-root, \
$(PRODUCT_OUT)/install,$(zip_root)/INSTALL)
ifdef INSTALLED_KERNEL_TARGET
ifneq (,$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/
Expand Down
20 changes: 20 additions & 0 deletions tools/releasetools/edify_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ def Mount(self, mount_point, mount_options_by_format=""):
p.mount_point, mount_flags))
self.mounts.add(p.mount_point)

def UnpackPackageDir(self, src, dst):
"""Unpack a given directory from the OTA package into the given
destination directory."""
self.script.append('package_extract_dir("%s", "%s");' % (src, dst))

def Comment(self, comment):
"""Write a comment into the update script."""
self.script.append("")
Expand Down Expand Up @@ -383,6 +388,21 @@ def _CheckSecondTokenNotSlotSuffixed(self, s, fn):
assert not entry.slotselect, \
"Use %s because %s is slot suffixed" % (fn, lst[1])

def SetPermissionsRecursive(self, fn, uid, gid, dmode, fmode, selabel,
capabilities):
"""Recursively set path ownership and permissions."""
if capabilities is None:
capabilities = "0x0"
cmd = 'set_metadata_recursive("%s", "uid", %d, "gid", %d, ' \
'"dmode", 0%o, "fmode", 0%o' \
% (fn, uid, gid, dmode, fmode)
if not fn.startswith("/tmp"):
cmd += ', "capabilities", "%s"' % capabilities
if selabel is not None:
cmd += ', "selabel", "%s"' % selabel
cmd += ');'
self.script.append(cmd)

def WriteRawImage(self, mount_point, fn, mapfn=None):
"""Write the given package file into the partition for the given
mount point."""
Expand Down
14 changes: 14 additions & 0 deletions tools/releasetools/non_ab_ota.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ def GetIncrementalBlockDifferenceForPartition(name):
return block_diff_dict


def CopyInstallTools(output_zip):
install_path = os.path.join(OPTIONS.input_tmp, "INSTALL")
for root, subdirs, files in os.walk(install_path):
for f in files:
install_source = os.path.join(root, f)
install_target = os.path.join("install", os.path.relpath(root, install_path), f)
output_zip.write(install_source, install_target)


def WriteFullOTAPackage(input_zip, output_file):
target_info = common.BuildInfo(OPTIONS.info_dict, OPTIONS.oem_dicts)

Expand Down Expand Up @@ -220,6 +229,11 @@ def WriteFullOTAPackage(input_zip, output_file):
script.Print(" ")
device_specific.FullOTA_InstallBegin()

CopyInstallTools(output_zip)
script.UnpackPackageDir("install", "/tmp/install")
script.SetPermissionsRecursive("/tmp/install", 0, 0, 0o755, 0o644, None, None)
script.SetPermissionsRecursive("/tmp/install/bin", 0, 0, 0o755, 0o755, None, None)

# All other partitions as well as the data wipe use 10% of the progress, and
# the update of the system partition takes the remaining progress.
system_progress = 0.9 - (len(block_diff_dict) - 1) * 0.1
Expand Down
2 changes: 1 addition & 1 deletion tools/releasetools/ota_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

METADATA_NAME = 'META-INF/com/android/metadata'
METADATA_PROTO_NAME = 'META-INF/com/android/metadata.pb'
UNZIP_PATTERN = ['IMAGES/*', 'META/*', 'OTA/*', 'RADIO/*']
UNZIP_PATTERN = ['IMAGES/*', 'INSTALL/*', 'META/*', 'OTA/*', 'RADIO/*']
SECURITY_PATCH_LEVEL_PROP_NAME = "ro.build.version.security_patch"


Expand Down