"""Repacks GKI boot images with the given kernel images.""" import argparse import json import os import shutil import tempfile
from treble.fetcher import fetcher_lib from treble.gki import repack_gki_lib
def main():
parser = argparse.ArgumentParser(
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument( '--json_keyfile',
help='JSON keyfile containing credentials. ' '(Default: Use default credential file)')
parser.add_argument( '--bootimg_build_id', help='Download from the specified build.')
parser.add_argument( '--ramdisk_build_id', help='DEPRECATED. Use --bootimg_build_id instead.')
parser.add_argument( '--bootimg_target',
help='Name of the bootimg target from the bootimg branch.')
parser.add_argument( '--ramdisk_target', help='DEPRECATED. Use --bootimg_target instead.')
parser.add_argument( '--kernel_build_id',
required=True,
help='Download from the specified build.')
parser.add_argument( '--kernel_target',
required=True,
help='Name of the kernel target from the kernel branch.')
parser.add_argument( '--kernel_debug_target',
required=True,
help='Name of the kernel debug target from the kernel branch.')
parser.add_argument( '--kernel_version',
required=True,
help='The Kernel version to use when repacking.')
parser.add_argument( '--out_dir', required=True, help='Save output to this directory.')
# Save kernel artifacts to the out dir.
kernel_out_dir = os.path.join(args.out_dir, 'kernel', args.kernel_version) ifnot os.path.exists(kernel_out_dir):
os.makedirs(kernel_out_dir)
# Repack individual boot images using the fetched kernel artifacts, # then save to the out dir.
repack_gki_lib.repack_bootimgs(tmp_bootimg_dir, kernel_dir,
kernel_debug_dir)
shutil.copytree(tmp_bootimg_dir, args.out_dir, dirs_exist_ok=True)
# Repack boot images inside the img.zip and save to the out dir.
img_zip_name = [f for f in os.listdir(tmp_bootimg_dir) if'-img-'in f][0]
img_zip_path = os.path.join(tmp_bootimg_dir, img_zip_name)
repack_gki_lib.repack_img_zip(img_zip_path, kernel_dir, kernel_debug_dir,
args.kernel_version)
shutil.copy(img_zip_path, args.out_dir)
target_files_zip_name = [
f for f in os.listdir(tmp_bootimg_dir) if'-target_files-'in f
][0]
target_files_zip_path = os.path.join(tmp_bootimg_dir, target_files_zip_name)
repack_gki_lib.replace_target_files_zip_kernels(target_files_zip_path,
kernel_out_dir,
args.kernel_version)
shutil.copy(target_files_zip_path, args.out_dir)
# Copy otatools.zip from the bootimg build, used for GKI signing.
shutil.copy(os.path.join(tmp_bootimg_dir, 'otatools.zip'), args.out_dir)
# Write prebuilt-info.txt using the prebuilt artifact build IDs.
data = { 'kernel-build-id': int(args.kernel_build_id),
} with open(os.path.join(kernel_out_dir, 'prebuilt-info.txt'), 'w') as f:
json.dump(data, f, indent=4)
if __name__ == '__main__':
main()
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-06-27)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.