avbtool: add --set_hashtree_disabled_flag option to make_vbmeta_image command.
This enables people to set
BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS="--set_hashtree_disabled_flag"
in their environment and then the images they build are baked with the
HASHTREE_DISABLED bit set and as a result they don't need to manually
disable dm-verity via e.g. 'adb disable-verity'. Note that this is
already possible through the existing --flags option, e.g.
BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS="--flags 1"
but it's much nicer to be explicit about it.
Bug: 34124301
Test: Unit tests pass.
Test: Manually tested on UEFI based bootloader.
Change-Id: I75537c614a660362ae68342ce50aa2c09022dc07
diff --git a/avbtool b/avbtool
index 9a7358f..328f927 100755
--- a/avbtool
+++ b/avbtool
@@ -39,7 +39,7 @@
# Keep in sync with avb_vbmeta_header.h.
AVB_VERSION_MAJOR = 1
AVB_VERSION_MINOR = 0
-
+AVB_VBMETA_IMAGE_FLAGS_HASHTREE_DISABLED = 1
class AvbError(Exception):
"""Application-specific errors.
@@ -2669,6 +2669,9 @@
help='VBMeta flags',
type=parse_number,
default=0)
+ sub_parser.add_argument('--set_hashtree_disabled_flag',
+ help='Set the HASHTREE_DISABLED flag',
+ action='store_true')
sub_parser.set_defaults(func=self.make_vbmeta_image)
sub_parser = subparsers.add_parser('add_hash_footer',
@@ -2786,6 +2789,8 @@
def make_vbmeta_image(self, args):
"""Implements the 'make_vbmeta_image' sub-command."""
+ if args.set_hashtree_disabled_flag:
+ args.flags |= AVB_VBMETA_IMAGE_FLAGS_HASHTREE_DISABLED
self.avb.make_vbmeta_image(args.output, args.chain_partition,
args.algorithm, args.key,
args.public_key_metadata, args.rollback_index,