Android OTA相关资料地址

学习Android OTA相关

官方OTA文档

编译Android code

进入android 根目录

# first, build the target-files .zip
. build/envsetup.sh && lunch tardis-eng
mkdir dist_output
make dist DIST_DIR=dist_output #指定输出dist_output目录

Android 编译输出目录
android 编译生成的out目录结构剖析
Android out目录和linux启动Android流程

Androd ota package 生成

在这里插入图片描述

Androd SW UPDATE LIFECYCLE

在这里插入图片描述

Android 编译输出目录

Android 下提供的工具

build/make/tools/releasetools$

add_img_to_target_files
Given a target-files zipfile that does not contain images (ie, does
not have an IMAGES/ top-level subdirectory), produce the images and
add them to the zipfile.

ota_from_target_files
Given a target-files zipfile, produces an OTA package that installs
that build. An incremental OTA is produced if -i is given, otherwise
a full OTA is produced.

build_image
Build image output_image_file from input_directory, properties_file, and target_out_dir

check_ota_package_signature
Verify a given OTA package with the specifed certificate.

check_target_file_signatures
Check the signatures of all APKs in a target_files .zip file. With
-c, compare the signatures of each package to the ones in a separate
target_files (usually a previously distributed build for the same
device) and flag any changes.

img_from_target_files
Given a target-files zipfile, produces an image zipfile suitable for
use with ‘fastboot update’.

Google在Android系统了提供了自己的二进制差分工具,bsdiff/bspatch,代码位于external/bsdiff目录下。
在Ubuntu系统上可以直接通过apt进行安装。
sudo apt-get install bsdiff
使用方法如下:
diff:
bsdiff oldfile newfile patch
patch:
bspatch oldfile newfile patch
虽然针对普通文件bsdiff/bspatch效率非常高。但对于一些压缩文件,由于压缩前内容非常小的变化会导致压缩后整个二进制文件产生非常巨大的变化,这样patch文件会非常大。如Android系统中常用的boot.img/recovery.img,本质上就是一块包含压缩和非压缩数据的二进制文件。
为了解决这个问题,Android也提供了imgdiff工具(bootable/recovery/applypatch)。在source文件中搜索压缩部分(0x1f8b0800),将其划分成多个小块
imgdiff工具使用

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章