From 05bac1c71d1a54891b0f2bd40bcc5e247d5083a3 Mon Sep 17 00:00:00 2001 From: wangjianyu3 Date: Thu, 2 Jan 2025 15:04:32 +0800 Subject: [PATCH] external/avb: Add rollback only support for info_image For getting rollback_index or rollback_index_location of signed file directly at host Test # test.bin # rollback_index_location : 0 # rollback_index : 1 $ ./avbtool info_image --image test.bin --rollback_index 1 $ ./avbtool info_image --image test.bin --rollback_index_location 0 Signed-off-by: wangjianyu3 --- avbtool.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/avbtool.py b/avbtool.py index a56c680..f7111ce 100755 --- a/avbtool.py +++ b/avbtool.py @@ -2424,6 +2424,12 @@ def info_image(self, args): header.public_key_offset) key_blob = vbmeta_blob[key_offset:key_offset + header.public_key_size] + if args.rollback_index_location: + o.write('{}\n'.format(header.rollback_index_location)) + return + if args.rollback_index: + o.write('{}\n'.format(header.rollback_index)) + return if footer: o.write('Footer version: {}.{}\n'.format(footer.version_major, footer.version_minor)) @@ -4530,6 +4536,12 @@ def run(self, argv): help=('Show information about Android Things ' 'eXtension (ATX).'), action='store_true') + sub_parser.add_argument('--rollback_index', + help=('Only rollback_index'), + action='store_true') + sub_parser.add_argument('--rollback_index_location', + help=('Only rollback_index_location'), + action='store_true') sub_parser.set_defaults(func=self.info_image) sub_parser = subparsers.add_parser(