Merge changes I1d1ec878,I25c1dc20 am: 27cbdd9809
am: 9f48b3cf4a
am: c4e0737684
Original change: https://android-review.googlesource.com/c/platform/build/+/1991151 Change-Id: I40be1b37fe15f9f200fe71c67f023c54e9671dbc
This commit is contained in:
commit
2e6596e47f
1 changed files with 58 additions and 54 deletions
|
@ -127,7 +127,7 @@ import ota_from_target_files
|
|||
import sparse_img
|
||||
import verity_utils
|
||||
|
||||
from common import AddCareMapForAbOta, ExternalError, PARTITIONS_WITH_CARE_MAP
|
||||
from common import ExternalError
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -826,10 +826,6 @@ def generate_care_map(partitions, output_target_files_dir):
|
|||
image_size = verity_image_builder.CalculateMaxImageSize(partition_size)
|
||||
OPTIONS.info_dict[image_size_prop] = image_size
|
||||
|
||||
AddCareMapForAbOta(
|
||||
os.path.join(output_target_files_dir, 'META', 'care_map.pb'),
|
||||
PARTITIONS_WITH_CARE_MAP, partition_image_map)
|
||||
|
||||
|
||||
def process_special_cases(temp_dir, framework_meta, vendor_meta,
|
||||
output_target_files_temp_dir,
|
||||
|
@ -843,11 +839,12 @@ def process_special_cases(temp_dir, framework_meta, vendor_meta,
|
|||
|
||||
Args:
|
||||
temp_dir: Location containing an 'output' directory where target files have
|
||||
been extracted, e.g. <temp_dir>/output/SYSTEM, <temp_dir>/output/IMAGES, etc.
|
||||
been extracted, e.g. <temp_dir>/output/SYSTEM, <temp_dir>/output/IMAGES,
|
||||
etc.
|
||||
framework_meta: The name of a directory containing the special items
|
||||
extracted from the framework target files package.
|
||||
vendor_meta: The name of a directory containing the special items
|
||||
extracted from the vendor target files package.
|
||||
vendor_meta: The name of a directory containing the special items extracted
|
||||
from the vendor target files package.
|
||||
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.
|
||||
|
@ -858,9 +855,7 @@ def process_special_cases(temp_dir, framework_meta, vendor_meta,
|
|||
partitions. Used to filter apexkeys.txt and apkcerts.txt.
|
||||
vendor_partition_set: Partitions that are considered vendor partitions. Used
|
||||
to filter apexkeys.txt and apkcerts.txt.
|
||||
|
||||
The following are only used if dexpreopt is applied:
|
||||
|
||||
Args used if dexpreopt is applied:
|
||||
framework_dexpreopt_tools: Location of dexpreopt_tools.zip.
|
||||
framework_dexpreopt_config: Location of framework's dexpreopt_config.zip.
|
||||
vendor_dexpreopt_config: Location of vendor's dexpreopt_config.zip.
|
||||
|
@ -915,14 +910,14 @@ def process_special_cases(temp_dir, framework_meta, vendor_meta,
|
|||
|
||||
|
||||
def process_dexopt(temp_dir, framework_meta, vendor_meta,
|
||||
output_target_files_temp_dir,
|
||||
framework_dexpreopt_tools, framework_dexpreopt_config,
|
||||
vendor_dexpreopt_config):
|
||||
output_target_files_temp_dir, framework_dexpreopt_tools,
|
||||
framework_dexpreopt_config, vendor_dexpreopt_config):
|
||||
"""If needed, generates dexopt files for vendor apps.
|
||||
|
||||
Args:
|
||||
temp_dir: Location containing an 'output' directory where target files have
|
||||
been extracted, e.g. <temp_dir>/output/SYSTEM, <temp_dir>/output/IMAGES, etc.
|
||||
been extracted, e.g. <temp_dir>/output/SYSTEM, <temp_dir>/output/IMAGES,
|
||||
etc.
|
||||
framework_meta: The name of a directory containing the special items
|
||||
extracted from the framework target files package.
|
||||
vendor_meta: The name of a directory containing the special items extracted
|
||||
|
@ -940,8 +935,7 @@ def process_dexopt(temp_dir, framework_meta, vendor_meta,
|
|||
os.path.join(vendor_meta, *misc_info_path))
|
||||
|
||||
if (vendor_misc_info_dict.get('building_with_vsdk') != 'true' or
|
||||
framework_dexpreopt_tools is None or
|
||||
framework_dexpreopt_config is None or
|
||||
framework_dexpreopt_tools is None or framework_dexpreopt_config is None or
|
||||
vendor_dexpreopt_config is None):
|
||||
return
|
||||
|
||||
|
@ -984,8 +978,10 @@ def process_dexopt(temp_dir, framework_meta, vendor_meta,
|
|||
# package.vdex
|
||||
# package.odex
|
||||
dexpreopt_tools_files_temp_dir = os.path.join(temp_dir, 'tools')
|
||||
dexpreopt_framework_config_files_temp_dir = os.path.join(temp_dir, 'system_config')
|
||||
dexpreopt_vendor_config_files_temp_dir = os.path.join(temp_dir, 'vendor_config')
|
||||
dexpreopt_framework_config_files_temp_dir = os.path.join(
|
||||
temp_dir, 'system_config')
|
||||
dexpreopt_vendor_config_files_temp_dir = os.path.join(temp_dir,
|
||||
'vendor_config')
|
||||
|
||||
extract_items(
|
||||
target_files=OPTIONS.framework_dexpreopt_tools,
|
||||
|
@ -1000,10 +996,12 @@ def process_dexopt(temp_dir, framework_meta, vendor_meta,
|
|||
target_files_temp_dir=dexpreopt_vendor_config_files_temp_dir,
|
||||
extract_item_list=('*',))
|
||||
|
||||
os.symlink(os.path.join(output_target_files_temp_dir, "SYSTEM"),
|
||||
os.path.join(temp_dir, "system"))
|
||||
os.symlink(os.path.join(output_target_files_temp_dir, "VENDOR"),
|
||||
os.path.join(temp_dir, "vendor"))
|
||||
os.symlink(
|
||||
os.path.join(output_target_files_temp_dir, 'SYSTEM'),
|
||||
os.path.join(temp_dir, 'system'))
|
||||
os.symlink(
|
||||
os.path.join(output_target_files_temp_dir, 'VENDOR'),
|
||||
os.path.join(temp_dir, 'vendor'))
|
||||
|
||||
# The directory structure for flatteded APEXes is:
|
||||
#
|
||||
|
@ -1026,7 +1024,7 @@ def process_dexopt(temp_dir, framework_meta, vendor_meta,
|
|||
# com.android.appsearch.apex
|
||||
# com.android.art.apex
|
||||
# ...
|
||||
apex_root = os.path.join(output_target_files_temp_dir, "SYSTEM", "apex")
|
||||
apex_root = os.path.join(output_target_files_temp_dir, 'SYSTEM', 'apex')
|
||||
framework_misc_info_dict = common.LoadDictionaryFromFile(
|
||||
os.path.join(framework_meta, *misc_info_path))
|
||||
|
||||
|
@ -1094,13 +1092,14 @@ def process_dexopt(temp_dir, framework_meta, vendor_meta,
|
|||
dex_img = 'VENDOR'
|
||||
# Open vendor_filesystem_config to append the items generated by dexopt.
|
||||
vendor_file_system_config = open(
|
||||
os.path.join(temp_dir, 'output', 'META', 'vendor_filesystem_config.txt'),
|
||||
'a')
|
||||
os.path.join(temp_dir, 'output', 'META',
|
||||
'vendor_filesystem_config.txt'), 'a')
|
||||
|
||||
# Dexpreopt vendor apps.
|
||||
dexpreopt_config_suffix = '_dexpreopt.config'
|
||||
for config in glob.glob(os.path.join(
|
||||
dexpreopt_vendor_config_files_temp_dir, '*' + dexpreopt_config_suffix)):
|
||||
for config in glob.glob(
|
||||
os.path.join(dexpreopt_vendor_config_files_temp_dir,
|
||||
'*' + dexpreopt_config_suffix)):
|
||||
app = os.path.basename(config)[:-len(dexpreopt_config_suffix)]
|
||||
logging.info('dexpreopt config: %s %s', config, app)
|
||||
|
||||
|
@ -1110,8 +1109,9 @@ def process_dexopt(temp_dir, framework_meta, vendor_meta,
|
|||
apk_dir = 'priv-app'
|
||||
apk_path = os.path.join(temp_dir, 'vendor', apk_dir, app, app + '.apk')
|
||||
if not os.path.exists(apk_path):
|
||||
logging.warning('skipping dexpreopt for %s, no apk found in vendor/app '
|
||||
'or vendor/priv-app', app)
|
||||
logging.warning(
|
||||
'skipping dexpreopt for %s, no apk found in vendor/app '
|
||||
'or vendor/priv-app', app)
|
||||
continue
|
||||
|
||||
# Generate dexpreopting script. Note 'out_dir' is not the output directory
|
||||
|
@ -1121,10 +1121,11 @@ def process_dexopt(temp_dir, framework_meta, vendor_meta,
|
|||
command = [
|
||||
os.path.join(dexpreopt_tools_files_temp_dir, 'dexpreopt_gen'),
|
||||
'-global',
|
||||
os.path.join(dexpreopt_framework_config_files_temp_dir, 'dexpreopt.config'),
|
||||
os.path.join(dexpreopt_framework_config_files_temp_dir,
|
||||
'dexpreopt.config'),
|
||||
'-global_soong',
|
||||
os.path.join(
|
||||
dexpreopt_framework_config_files_temp_dir, 'dexpreopt_soong.config'),
|
||||
os.path.join(dexpreopt_framework_config_files_temp_dir,
|
||||
'dexpreopt_soong.config'),
|
||||
'-module',
|
||||
config,
|
||||
'-dexpreopt_script',
|
||||
|
@ -1137,13 +1138,13 @@ def process_dexopt(temp_dir, framework_meta, vendor_meta,
|
|||
]
|
||||
|
||||
# Run the command from temp_dir so all tool paths are its descendants.
|
||||
logging.info("running %s", command)
|
||||
subprocess.check_call(command, cwd = temp_dir)
|
||||
logging.info('running %s', command)
|
||||
subprocess.check_call(command, cwd=temp_dir)
|
||||
|
||||
# Call the generated script.
|
||||
command = ['sh', 'dexpreopt_app.sh', apk_path]
|
||||
logging.info("running %s", command)
|
||||
subprocess.check_call(command, cwd = temp_dir)
|
||||
logging.info('running %s', command)
|
||||
subprocess.check_call(command, cwd=temp_dir)
|
||||
|
||||
# Output files are in:
|
||||
#
|
||||
|
@ -1171,14 +1172,17 @@ def process_dexopt(temp_dir, framework_meta, vendor_meta,
|
|||
# TODO(b/188179859): Support for other architectures.
|
||||
arch = 'arm64'
|
||||
|
||||
dex_destination = os.path.join(temp_dir, 'output', dex_img, apk_dir, app, 'oat', arch)
|
||||
dex_destination = os.path.join(temp_dir, 'output', dex_img, apk_dir, app,
|
||||
'oat', arch)
|
||||
os.makedirs(dex_destination)
|
||||
dex2oat_path = os.path.join(
|
||||
temp_dir, 'out', 'dex2oat_result', 'vendor', apk_dir, app, 'oat', arch)
|
||||
shutil.copy(os.path.join(dex2oat_path, 'package.vdex'),
|
||||
os.path.join(dex_destination, app + '.vdex'))
|
||||
shutil.copy(os.path.join(dex2oat_path, 'package.odex'),
|
||||
os.path.join(dex_destination, app + '.odex'))
|
||||
dex2oat_path = os.path.join(temp_dir, 'out', 'dex2oat_result', 'vendor',
|
||||
apk_dir, app, 'oat', arch)
|
||||
shutil.copy(
|
||||
os.path.join(dex2oat_path, 'package.vdex'),
|
||||
os.path.join(dex_destination, app + '.vdex'))
|
||||
shutil.copy(
|
||||
os.path.join(dex2oat_path, 'package.odex'),
|
||||
os.path.join(dex_destination, app + '.odex'))
|
||||
|
||||
# Append entries to vendor_file_system_config.txt, such as:
|
||||
#
|
||||
|
@ -1192,8 +1196,10 @@ def process_dexopt(temp_dir, framework_meta, vendor_meta,
|
|||
vendor_file_system_config.writelines([
|
||||
vendor_app_prefix + ' 0 2000 755 ' + selabel + '\n',
|
||||
vendor_app_prefix + '/' + arch + ' 0 2000 755 ' + selabel + '\n',
|
||||
vendor_app_prefix + '/' + arch + '/' + app + '.odex 0 0 644 ' + selabel + '\n',
|
||||
vendor_app_prefix + '/' + arch + '/' + app + '.vdex 0 0 644 ' + selabel + '\n',
|
||||
vendor_app_prefix + '/' + arch + '/' + app + '.odex 0 0 644 ' +
|
||||
selabel + '\n',
|
||||
vendor_app_prefix + '/' + arch + '/' + app + '.vdex 0 0 644 ' +
|
||||
selabel + '\n',
|
||||
])
|
||||
|
||||
if not use_system_other_odex:
|
||||
|
@ -1202,7 +1208,8 @@ def process_dexopt(temp_dir, framework_meta, vendor_meta,
|
|||
# TODO(b/188179859): Rebuilding a vendor image in GRF mode (e.g., T(framework)
|
||||
# and S(vendor) may require logic similar to that in
|
||||
# rebuild_image_with_sepolicy.
|
||||
vendor_img = os.path.join(output_target_files_temp_dir, 'IMAGES', 'vendor.img')
|
||||
vendor_img = os.path.join(output_target_files_temp_dir, 'IMAGES',
|
||||
'vendor.img')
|
||||
if os.path.exists(vendor_img):
|
||||
logging.info('Deleting %s', vendor_img)
|
||||
os.remove(vendor_img)
|
||||
|
@ -1236,9 +1243,7 @@ def create_merged_package(temp_dir, framework_target_files, framework_item_list,
|
|||
vendor instance.
|
||||
rebuild_recovery: If true, rebuild the recovery patch used by non-A/B
|
||||
devices and write it to the system image.
|
||||
|
||||
The following are only used if dexpreopt is applied:
|
||||
|
||||
Args used if dexpreopt is applied:
|
||||
framework_dexpreopt_tools: Location of dexpreopt_tools.zip.
|
||||
framework_dexpreopt_config: Location of framework's dexpreopt_config.zip.
|
||||
vendor_dexpreopt_config: Location of vendor's dexpreopt_config.zip.
|
||||
|
@ -1535,9 +1540,7 @@ def merge_target_files(temp_dir, framework_target_files, framework_item_list,
|
|||
vendor_otatools: Path to an otatools zip used for recompiling vendor images.
|
||||
rebuild_sepolicy: If true, rebuild odm.img (if target uses ODM) or
|
||||
vendor.img using a merged precompiled_sepolicy file.
|
||||
|
||||
The following are only used if dexpreopt is applied:
|
||||
|
||||
Args used if dexpreopt is applied:
|
||||
framework_dexpreopt_tools: Location of dexpreopt_tools.zip.
|
||||
framework_dexpreopt_config: Location of framework's dexpreopt_config.zip.
|
||||
vendor_dexpreopt_config: Location of vendor's dexpreopt_config.zip.
|
||||
|
@ -1820,7 +1823,8 @@ def main():
|
|||
rebuild_sepolicy=OPTIONS.rebuild_sepolicy,
|
||||
framework_dexpreopt_tools=OPTIONS.framework_dexpreopt_tools,
|
||||
framework_dexpreopt_config=OPTIONS.framework_dexpreopt_config,
|
||||
vendor_dexpreopt_config=OPTIONS.vendor_dexpreopt_config), OPTIONS.keep_tmp)
|
||||
vendor_dexpreopt_config=OPTIONS.vendor_dexpreopt_config),
|
||||
OPTIONS.keep_tmp)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in a new issue