Moving recovery resources from /system to /vendor
This change is part of a topic that moves the recovery resources from the system partition to the vendor partition, if it exists, or the vendor directory on the system partition otherwise. The recovery resources are moving from the system image to the vendor partition so that a single system image may be used with either an A/B or a non-A/B vendor image. The topic removes a delta in the system image that prevented such reuse in the past. The recovery resources that are moving are involved with updating the recovery partition after an update. In a non-A/B configuration, the system boots from the recovery partition, updates the other partitions (system, vendor, etc.) Then, the next time the system boots normally, a script updates the recovery partition (if necessary). This script, the executables it invokes, and the data files that it uses were previously on the system partition. The resources that are moving include the following. * install-recovery.sh * applypatch * recovery-resource.dat (if present) * recovery-from-boot.p (if present) This change includes the platform build system and release tools changes to move the recovery resources from system to vendor (or /system/vendor). The release tools need to know where to generate the recovery patch, and they discover this from misc_info.txt variable board_uses_vendorimage, which the platform build system generates. We remove applypatch from PRODUCT_PACKAGES, but it is added back as a required module in target/product/base_vendor.mk. Several release tools rely on the misc_info.txt board_uses_vendorimage variable to know how to generate and detect the recovery patch. This change partially removes the --rebuild_recovery flag from the merge_target_files.py script. The flag will be fully removed in a follow-on change. Bug: 68319577 Test: Ensure that recovery partition is updated correctly. Change-Id: Ia4045bd67ffb3d899efa8d20dab4c4299b87ee5f
This commit is contained in:
@@ -68,8 +68,7 @@ Usage: merge_target_files.py [args]
|
||||
files package and saves it at this path.
|
||||
|
||||
--rebuild_recovery
|
||||
Rebuild the recovery patch used by non-A/B devices and write it to the
|
||||
system image.
|
||||
Deprecated; does nothing.
|
||||
|
||||
--keep-tmp
|
||||
Keep tempoary files for debugging purposes.
|
||||
@@ -106,6 +105,7 @@ OPTIONS.output_item_list = None
|
||||
OPTIONS.output_ota = None
|
||||
OPTIONS.output_img = None
|
||||
OPTIONS.output_super_empty = None
|
||||
# TODO(b/132730255): Remove this option.
|
||||
OPTIONS.rebuild_recovery = False
|
||||
OPTIONS.keep_tmp = False
|
||||
|
||||
@@ -372,32 +372,6 @@ def process_ab_partitions_txt(framework_target_files_temp_dir,
|
||||
write_sorted_data(data=output_ab_partitions, path=output_ab_partitions_txt)
|
||||
|
||||
|
||||
def append_recovery_to_filesystem_config(output_target_files_temp_dir):
|
||||
"""Performs special processing for META/filesystem_config.txt.
|
||||
|
||||
This function appends recovery information to META/filesystem_config.txt so
|
||||
that recovery patch regeneration will succeed.
|
||||
|
||||
Args:
|
||||
output_target_files_temp_dir: The name of a directory that will be used to
|
||||
create the output target files package after all the special cases are
|
||||
processed. We find filesystem_config.txt here.
|
||||
"""
|
||||
|
||||
filesystem_config_txt = os.path.join(output_target_files_temp_dir, 'META',
|
||||
'filesystem_config.txt')
|
||||
|
||||
with open(filesystem_config_txt, 'a') as f:
|
||||
# TODO(bpeckham) this data is hard coded. It should be generated
|
||||
# programmatically.
|
||||
f.write('system/bin/install-recovery.sh 0 0 750 '
|
||||
'selabel=u:object_r:install_recovery_exec:s0 capabilities=0x0\n')
|
||||
f.write('system/recovery-from-boot.p 0 0 644 '
|
||||
'selabel=u:object_r:system_file:s0 capabilities=0x0\n')
|
||||
f.write('system/etc/recovery.img 0 0 440 '
|
||||
'selabel=u:object_r:install_recovery_exec:s0 capabilities=0x0\n')
|
||||
|
||||
|
||||
def process_misc_info_txt(framework_target_files_temp_dir,
|
||||
vendor_target_files_temp_dir,
|
||||
output_target_files_temp_dir,
|
||||
@@ -594,7 +568,7 @@ def copy_file_contexts(framework_target_files_dir, vendor_target_files_dir,
|
||||
def process_special_cases(framework_target_files_temp_dir,
|
||||
vendor_target_files_temp_dir,
|
||||
output_target_files_temp_dir,
|
||||
framework_misc_info_keys, rebuild_recovery):
|
||||
framework_misc_info_keys):
|
||||
"""Performs special-case processing for certain target files items.
|
||||
|
||||
Certain files in the output target files package require special-case
|
||||
@@ -611,8 +585,6 @@ def process_special_cases(framework_target_files_temp_dir,
|
||||
framework_misc_info_keys: A list of keys to obtain from the framework
|
||||
instance of META/misc_info.txt. The remaining keys from the vendor
|
||||
instance.
|
||||
rebuild_recovery: If true, rebuild the recovery patch used by non-A/B
|
||||
devices and write it to the system image.
|
||||
"""
|
||||
|
||||
if 'ab_update' in framework_misc_info_keys:
|
||||
@@ -621,10 +593,6 @@ def process_special_cases(framework_target_files_temp_dir,
|
||||
vendor_target_files_temp_dir=vendor_target_files_temp_dir,
|
||||
output_target_files_temp_dir=output_target_files_temp_dir)
|
||||
|
||||
if rebuild_recovery:
|
||||
append_recovery_to_filesystem_config(
|
||||
output_target_files_temp_dir=output_target_files_temp_dir)
|
||||
|
||||
copy_file_contexts(
|
||||
framework_target_files_dir=framework_target_files_temp_dir,
|
||||
vendor_target_files_dir=vendor_target_files_temp_dir,
|
||||
@@ -757,8 +725,7 @@ def create_merged_package(temp_dir, framework_target_files, framework_item_list,
|
||||
framework_target_files_temp_dir=framework_target_files_temp_dir,
|
||||
vendor_target_files_temp_dir=vendor_target_files_temp_dir,
|
||||
output_target_files_temp_dir=output_target_files_temp_dir,
|
||||
framework_misc_info_keys=framework_misc_info_keys,
|
||||
rebuild_recovery=rebuild_recovery)
|
||||
framework_misc_info_keys=framework_misc_info_keys)
|
||||
|
||||
return output_target_files_temp_dir
|
||||
|
||||
@@ -779,6 +746,7 @@ def generate_images(target_files_dir, rebuild_recovery):
|
||||
|
||||
add_img_args = ['--verbose']
|
||||
add_img_args.append('--add_missing')
|
||||
# TODO(b/132730255): Remove this if statement.
|
||||
if rebuild_recovery:
|
||||
add_img_args.append('--rebuild_recovery')
|
||||
add_img_args.append(target_files_dir)
|
||||
@@ -1016,7 +984,7 @@ def main():
|
||||
OPTIONS.output_img = a
|
||||
elif o == '--output-super-empty':
|
||||
OPTIONS.output_super_empty = a
|
||||
elif o == '--rebuild_recovery':
|
||||
elif o == '--rebuild_recovery': # TODO(b/132730255): Warn
|
||||
OPTIONS.rebuild_recovery = True
|
||||
elif o == '--keep-tmp':
|
||||
OPTIONS.keep_tmp = True
|
||||
|
Reference in New Issue
Block a user