def _replace_kernel(bootimg_path, kernel_path): """Unpacks a boot.img, replaces the kernel, then repacks.""" with tempfile.TemporaryDirectory() as unpack_dir:
print('Unpacking bootimg %s' % bootimg_path)
cmd = [ 'out/host/linux-x86/bin/unpack_bootimg', '--boot_img',
bootimg_path, '--out',
unpack_dir, '--format', 'mkbootimg',
]
print(' '.join(cmd))
mkbootimg_args = subprocess.check_output(cmd).decode('utf-8').split(' ')
print('Copying kernel %s' % kernel_path)
shutil.copy(kernel_path, os.path.join(unpack_dir, 'kernel'))
print('Repacking with mkbootimg')
cmd = [ 'out/host/linux-x86/bin/mkbootimg', '--output',
bootimg_path,
] + mkbootimg_args
print(' '.join(cmd))
subprocess.check_call(cmd)
def repack_bootimgs(bootimg_dir, kernel_dir, kernel_debug_dir): """Repacks all boot images in a given dir using the provided kernels.""" for bootimg_path in os.listdir(bootimg_dir):
bootimg_path = os.path.join(bootimg_dir, bootimg_path) ifnot bootimg_path.endswith('.img'): continue
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.