Skip to content

Commit

Permalink
ota: Enable upgrade verifiation if AVB signed and rollback_index set
Browse files Browse the repository at this point in the history
Signed-off-by: wangjianyu3 <[email protected]>
  • Loading branch information
JianyuWang0623 committed Jan 2, 2025
1 parent 2495767 commit c88026c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tools/gen_ota_zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import filecmp
import configparser
import re
import subprocess

program_description = \
'''
Expand Down Expand Up @@ -43,6 +44,7 @@
patch_path = []
bin_list = []
tools_path=''
avbtool_path=os.path.abspath(os.path.dirname(sys.argv[0]) + '/../../../../external/avb/avb/avbtool')
speed_dict = {}
logging.basicConfig(format = "[%(levelname)s]%(message)s")
logger = logging.getLogger()
Expand Down Expand Up @@ -326,7 +328,12 @@ def gen_full_sh(path_list, bin_list, args, tmp_folder):

i = 0
while i < path_cnt:
str = \
str = ''
ret = subprocess.Popen("%s info_image --image %s/%s --rollback_index" % (avbtool_path, args.bin_path[0], bin_list[i]), shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL);
idx = ret.communicate()
if (ret.returncode == 0) and (int(idx[0]) != 0):
logger.debug("Enabled update verification for %s" % bin_list[i])
str += \
'''
avb_verify -U /ota/%s %s /etc/key.avb
if [ $? -ne 0 ]
Expand Down Expand Up @@ -538,6 +545,9 @@ def gen_full_ota(args):
if inputstr != 'Y' and inputstr != 'y':
exit()

if not os.path.exists(avbtool_path):
logger.error("avbtool: %s: No such file or directory", avbtool_path)
exit()
if len((args.bin_path)) == 2:
os.chdir(tools_path)
if not os.path.exists("ddelta_generate"):
Expand Down

0 comments on commit c88026c

Please sign in to comment.