Loading tools/releasetools/add_img_to_target_files.py +1 −1 Original line number Diff line number Diff line Loading @@ -871,7 +871,7 @@ def AddImagesToTargetFiles(filename): if has_vendor_kernel_boot: banner("vendor_kernel_boot") vendor_kernel_boot_image = common.GetVendorBootImage( vendor_kernel_boot_image = common.GetVendorKernelBootImage( "IMAGES/vendor_kernel_boot.img", "vendor_kernel_boot.img", OPTIONS.input_tmp, "VENDOR_KERNEL_BOOT") if vendor_kernel_boot_image: Loading tools/releasetools/common.py +38 −9 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ SPECIAL_CERT_STRINGS = ("PRESIGNED", "EXTERNAL") # AVB_FOOTER_ARGS_BY_PARTITION in sign_target_files_apks need to be updated # accordingly. AVB_PARTITIONS = ('boot', 'init_boot', 'dtbo', 'odm', 'product', 'pvmfw', 'recovery', 'system', 'system_ext', 'vendor', 'vendor_boot', 'system', 'system_ext', 'vendor', 'vendor_boot', 'vendor_kernel_boot', 'vendor_dlkm', 'odm_dlkm', 'system_dlkm') # Chained VBMeta partitions. Loading Loading @@ -1841,7 +1841,7 @@ def GetBootableImage(name, prebuilt_name, unpack_dir, tree_subdir, return None def _BuildVendorBootImage(sourcedir, info_dict=None): def _BuildVendorBootImage(sourcedir, partition_name, info_dict=None): """Build a vendor boot image from the specified sourcedir. Take a ramdisk, dtb, and vendor_cmdline from the input (in 'sourcedir'), and Loading @@ -1866,6 +1866,11 @@ def _BuildVendorBootImage(sourcedir, info_dict=None): fn = os.path.join(sourcedir, "dtb") if os.access(fn, os.F_OK): has_vendor_kernel_boot = (info_dict.get("vendor_kernel_boot", "").lower() == "true") # Pack dtb into vendor_kernel_boot if building vendor_kernel_boot. # Otherwise pack dtb into vendor_boot. if not has_vendor_kernel_boot or partition_name == "vendor_kernel_boot": cmd.append("--dtb") cmd.append(fn) Loading Loading @@ -1927,11 +1932,11 @@ def _BuildVendorBootImage(sourcedir, info_dict=None): # AVB: if enabled, calculate and add hash. if info_dict.get("avb_enable") == "true": avbtool = info_dict["avb_avbtool"] part_size = info_dict["vendor_boot_size"] part_size = info_dict[f'{partition_name}_size'] cmd = [avbtool, "add_hash_footer", "--image", img.name, "--partition_size", str(part_size), "--partition_name", "vendor_boot"] AppendAVBSigningArgs(cmd, "vendor_boot") args = info_dict.get("avb_vendor_boot_add_hash_footer_args") "--partition_size", str(part_size), "--partition_name", partition_name] AppendAVBSigningArgs(cmd, partition_name) args = info_dict.get(f'avb_{partition_name}_add_hash_footer_args') if args and args.strip(): cmd.extend(shlex.split(args)) RunAndCheckOutput(cmd) Loading Loading @@ -1965,7 +1970,31 @@ def GetVendorBootImage(name, prebuilt_name, unpack_dir, tree_subdir, info_dict = OPTIONS.info_dict data = _BuildVendorBootImage( os.path.join(unpack_dir, tree_subdir), info_dict) os.path.join(unpack_dir, tree_subdir), "vendor_boot", info_dict) if data: return File(name, data) return None def GetVendorKernelBootImage(name, prebuilt_name, unpack_dir, tree_subdir, info_dict=None): """Return a File object with the desired vendor kernel boot image. Look for it under 'unpack_dir'/IMAGES, otherwise construct it from the source files in 'unpack_dir'/'tree_subdir'.""" prebuilt_path = os.path.join(unpack_dir, "IMAGES", prebuilt_name) if os.path.exists(prebuilt_path): logger.info("using prebuilt %s from IMAGES...", prebuilt_name) return File.FromLocalFile(name, prebuilt_path) logger.info("building image from target_files %s...", tree_subdir) if info_dict is None: info_dict = OPTIONS.info_dict data = _BuildVendorBootImage( os.path.join(unpack_dir, tree_subdir), "vendor_kernel_boot", info_dict) if data: return File(name, data) return None Loading tools/releasetools/sign_target_files_apks.py +1 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,7 @@ AVB_FOOTER_ARGS_BY_PARTITION = { 'pvmfw': 'avb_pvmfw_add_hash_footer_args', 'vendor': 'avb_vendor_add_hashtree_footer_args', 'vendor_boot': 'avb_vendor_boot_add_hash_footer_args', 'vendor_kernel_boot': 'avb_vendor_kernel_boot_add_hash_footer_args', 'vendor_dlkm': "avb_vendor_dlkm_add_hashtree_footer_args", 'vbmeta': 'avb_vbmeta_args', 'vbmeta_system': 'avb_vbmeta_system_args', Loading Loading
tools/releasetools/add_img_to_target_files.py +1 −1 Original line number Diff line number Diff line Loading @@ -871,7 +871,7 @@ def AddImagesToTargetFiles(filename): if has_vendor_kernel_boot: banner("vendor_kernel_boot") vendor_kernel_boot_image = common.GetVendorBootImage( vendor_kernel_boot_image = common.GetVendorKernelBootImage( "IMAGES/vendor_kernel_boot.img", "vendor_kernel_boot.img", OPTIONS.input_tmp, "VENDOR_KERNEL_BOOT") if vendor_kernel_boot_image: Loading
tools/releasetools/common.py +38 −9 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ SPECIAL_CERT_STRINGS = ("PRESIGNED", "EXTERNAL") # AVB_FOOTER_ARGS_BY_PARTITION in sign_target_files_apks need to be updated # accordingly. AVB_PARTITIONS = ('boot', 'init_boot', 'dtbo', 'odm', 'product', 'pvmfw', 'recovery', 'system', 'system_ext', 'vendor', 'vendor_boot', 'system', 'system_ext', 'vendor', 'vendor_boot', 'vendor_kernel_boot', 'vendor_dlkm', 'odm_dlkm', 'system_dlkm') # Chained VBMeta partitions. Loading Loading @@ -1841,7 +1841,7 @@ def GetBootableImage(name, prebuilt_name, unpack_dir, tree_subdir, return None def _BuildVendorBootImage(sourcedir, info_dict=None): def _BuildVendorBootImage(sourcedir, partition_name, info_dict=None): """Build a vendor boot image from the specified sourcedir. Take a ramdisk, dtb, and vendor_cmdline from the input (in 'sourcedir'), and Loading @@ -1866,6 +1866,11 @@ def _BuildVendorBootImage(sourcedir, info_dict=None): fn = os.path.join(sourcedir, "dtb") if os.access(fn, os.F_OK): has_vendor_kernel_boot = (info_dict.get("vendor_kernel_boot", "").lower() == "true") # Pack dtb into vendor_kernel_boot if building vendor_kernel_boot. # Otherwise pack dtb into vendor_boot. if not has_vendor_kernel_boot or partition_name == "vendor_kernel_boot": cmd.append("--dtb") cmd.append(fn) Loading Loading @@ -1927,11 +1932,11 @@ def _BuildVendorBootImage(sourcedir, info_dict=None): # AVB: if enabled, calculate and add hash. if info_dict.get("avb_enable") == "true": avbtool = info_dict["avb_avbtool"] part_size = info_dict["vendor_boot_size"] part_size = info_dict[f'{partition_name}_size'] cmd = [avbtool, "add_hash_footer", "--image", img.name, "--partition_size", str(part_size), "--partition_name", "vendor_boot"] AppendAVBSigningArgs(cmd, "vendor_boot") args = info_dict.get("avb_vendor_boot_add_hash_footer_args") "--partition_size", str(part_size), "--partition_name", partition_name] AppendAVBSigningArgs(cmd, partition_name) args = info_dict.get(f'avb_{partition_name}_add_hash_footer_args') if args and args.strip(): cmd.extend(shlex.split(args)) RunAndCheckOutput(cmd) Loading Loading @@ -1965,7 +1970,31 @@ def GetVendorBootImage(name, prebuilt_name, unpack_dir, tree_subdir, info_dict = OPTIONS.info_dict data = _BuildVendorBootImage( os.path.join(unpack_dir, tree_subdir), info_dict) os.path.join(unpack_dir, tree_subdir), "vendor_boot", info_dict) if data: return File(name, data) return None def GetVendorKernelBootImage(name, prebuilt_name, unpack_dir, tree_subdir, info_dict=None): """Return a File object with the desired vendor kernel boot image. Look for it under 'unpack_dir'/IMAGES, otherwise construct it from the source files in 'unpack_dir'/'tree_subdir'.""" prebuilt_path = os.path.join(unpack_dir, "IMAGES", prebuilt_name) if os.path.exists(prebuilt_path): logger.info("using prebuilt %s from IMAGES...", prebuilt_name) return File.FromLocalFile(name, prebuilt_path) logger.info("building image from target_files %s...", tree_subdir) if info_dict is None: info_dict = OPTIONS.info_dict data = _BuildVendorBootImage( os.path.join(unpack_dir, tree_subdir), "vendor_kernel_boot", info_dict) if data: return File(name, data) return None Loading
tools/releasetools/sign_target_files_apks.py +1 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,7 @@ AVB_FOOTER_ARGS_BY_PARTITION = { 'pvmfw': 'avb_pvmfw_add_hash_footer_args', 'vendor': 'avb_vendor_add_hashtree_footer_args', 'vendor_boot': 'avb_vendor_boot_add_hash_footer_args', 'vendor_kernel_boot': 'avb_vendor_kernel_boot_add_hash_footer_args', 'vendor_dlkm': "avb_vendor_dlkm_add_hashtree_footer_args", 'vbmeta': 'avb_vbmeta_args', 'vbmeta_system': 'avb_vbmeta_system_args', Loading