Skip to content

ota/tools: Move verification to before installation#8

Merged
xiaoxiang781216 merged 3 commits intoopen-vela:devfrom
JianyuWang0623:br_wjy_ota_verify_before_install_250225
Feb 25, 2025
Merged

ota/tools: Move verification to before installation#8
xiaoxiang781216 merged 3 commits intoopen-vela:devfrom
JianyuWang0623:br_wjy_ota_verify_before_install_250225

Conversation

@JianyuWang0623
Copy link
Member

@JianyuWang0623 JianyuWang0623 commented Feb 25, 2025

WARNING: NOT committed to gerrit yet

Summary

  1. Replace "while" with "for in" for loop to make the code more concise.
  2. Add function gen_progress_list for generating progress list by binary file size.
  3. Move verification to before installation

Impact

frameworks/system/ota/tools

Testing

  • script
set -ex

function gen_bin {
  tmp=./imgs
  mkdir -p imgs
  dd if=/dev/random of=${tmp}/vela_${1}.bin bs=${2} count=1
  ./avb_sign.sh ${tmp}/vela_${1}.bin 0 -P /dev/${1} -o --dynamic_partition_size -o "--rollback_index_location ${3}" -o "--rollback_index ${4}"
}

# rollback index greater than zero - upgrade verification enabled
gen_bin tee 1MB 1 1
gen_bin verify1 2MB 1 1
gen_bin verify2 3MB 1 1

# rollback index equal to zero - upgrade verification disabled
gen_bin ap 10MB 1 0
gen_bin no_verify1 20MB 1 0
gen_bin no_verify2 30MB 1 0

./gen_ota_zip.py ./imgs --debug --sign

mkdir -p ./temp
cd ./temp
unzip ../ota.zip
cd -

vi ./temp/ota.sh

#rm -rf ./temp
#rm -rf ./imgs
#rm -vf ota.zip
  • log
+ ./gen_ota_zip.py ./imgs --debug --sign
[DEBUG]add ./imgs/vela_verify2.bin
[DEBUG]add ./imgs/vela_verify1.bin
[DEBUG]add ./imgs/vela_no_verify1.bin
[DEBUG]add ./imgs/vela_ap.bin
[DEBUG]add ./imgs/vela_tee.bin
[DEBUG]add ./imgs/vela_no_verify2.bin
[DEBUG]Enabled update verification for vela_verify2.bin
[DEBUG]Enabled update verification for vela_verify1.bin
[DEBUG]Enabled update verification for vela_tee.bin
[INFO]ota.zip, signature success!
$ cat temp/ota.sh | grep -E "ota.progress.current|ota.progress.next|avb_verify|dd if" -n | grep -v " -1"
2:setprop ota.progress.current 30
3:setprop ota.progress.next 34
5:avb_verify -U /ota/vela_verify2.bin /dev/verify2 /etc/key.avb
12:setprop ota.progress.current 34
13:setprop ota.progress.next 38
15:avb_verify -U /ota/vela_verify1.bin /dev/verify1 /etc/key.avb
22:setprop ota.progress.current 38
23:setprop ota.progress.next 40
25:avb_verify -U /ota/vela_tee.bin /dev/tee /etc/key.avb
32:setprop ota.progress.current 40
33:setprop ota.progress.next 47
36:time " dd if=/ota/vela_verify2.bin of=/dev/verify2 bs=32768 verify"
42:setprop ota.progress.current 47
43:setprop ota.progress.next 49
46:time " dd if=/ota/vela_verify1.bin of=/dev/verify1 bs=32768 verify"
52:setprop ota.progress.current 49
53:setprop ota.progress.next 65
56:time " dd if=/ota/vela_no_verify1.bin of=/dev/no_verify1 bs=32768 verify"
62:setprop ota.progress.current 65
63:setprop ota.progress.next 74
66:time " dd if=/ota/vela_ap.bin of=/dev/ap bs=32768 verify"
72:setprop ota.progress.current 74
73:setprop ota.progress.next 75
76:time " dd if=/ota/vela_tee.bin of=/dev/tee bs=32768 verify"
82:setprop ota.progress.current 75
83:setprop ota.progress.next 100
86:time " dd if=/ota/vela_no_verify2.bin of=/dev/no_verify2 bs=32768 verify"
92:setprop ota.progress.current 100

To make the code more concise.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
For generating progress list by binary file size.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Progress

   verification: 30% ~  40%
   installation: 40% ~ 100%

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
@JianyuWang0623
Copy link
Member Author

WARNING: NOT committed to gerrit yet
@Donny9 @gneworld @anjiahao1 Could you review this pull request please?

@xiaoxiang781216 xiaoxiang781216 merged commit d0a5221 into open-vela:dev Feb 25, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants