OTA
全称 Over The Air
支持全量升级/增量升级,SD卡/网络在线 升级,要实现需要有以下几个步骤
1.制作升级包
$ make otapackage (前提是已经有了system.img)
生成文件:
ota/target/product/XXXXX/XXXXX-ota-eng.[UID].zip
生成差分包的一种工具:
/build/tools/releasetools/ota_from_target_files
2.获取升级包
1.在线获取 (手机设置-系统升级)
2.U盘升级(以前用的比较多)
3.处理升级
OTA - Recovery 模式
目录:/bootable/recovery/ 文件非常多
进入recovery 的流程如下图:
进入方式两种
1.开机过程- 手动操作进入 一般为 Volume+ 和 电源键组合(类似于windows开机进入BIOS)
2.系统判断,主动进入(OTA就是用的这种)
进入RecoveryMode 后,会运行一个Recovery
的程序,对应的源码 /bootable/recovery/recovery.cpp
(一个cpp直接就是一个可运行程序)
Android系统跟recovery 通信中用到的一个关键的 东西
Android -> recovery, 通过命令行文件
/cache/recovery/command
recovery -> Android, 通过intent
/cache/recovery/intent
Recovery - 应用
1、恢复出厂设置
FACTORY RESET 1. user selects "factory reset" 2. main system writes "--wipe_data" to /cache/recovery/command 3. main system reboots into recovery 4. get_args() writes BCB(bootloader control block) with "boot-recovery" and "--wipe_data" -- after this, rebooting will restart the erase -- 5. erase_volume() reformats /data 6. erase_volume() reformats /cache 7. finish_recovery() erases BCB -- after this, rebooting will restart the main system -- 8. main() calls reboot() to boot main system
2、OAT
OTA INSTALL 1. main system downloads OTA package to /cache/some-filename.zip 2. main system writes "--update_package=/cache/some-filename.zip" 3. main system reboots into recovery 4. get_args() writes BCB with "boot-recovery" and "--update_package=..." -- after this, rebooting will attempt to reinstall the update -- 5. install_package() attempts to install the update NOTE: the package install must itself be restartable from any point 6. finish_recovery() erases BCB -- after this, rebooting will (try to) restart the main system -- 7. ** if install failed ** 7a. prompt_and_wait() shows an error icon and waits for the user 7b; the user reboots (pulling the battery, etc) into the main system 8. main() calls maybe_install_firmware_update() ** if the update contained radio/hboot firmware **: 8a. m_i_f_u() writes BCB with "boot-recovery" and "--wipe_cache" -- after this, rebooting will reformat cache & restart main system -- 8b. m_i_f_u() writes firmware image into raw cache partition 8c. m_i_f_u() writes BCB with "update-radio/hboot" and "--wipe_cache" -- after this, rebooting will attempt to reinstall firmware -- 8d. bootloader tries to flash firmware 8e. bootloader writes BCB with "boot-recovery" (keeping "--wipe_cache") -- after this, rebooting will reformat cache & restart main system -- 8f. erase_volume() reformats /cache 8g. finish_recovery() erases BCB -- after this, rebooting will (try to) restart the main system -- 9. main() calls reboot() to boot main system
// command line args come from, in decreasing precedence: // - the actual command line // - the bootloader control block (one per line, after "recovery") // - the contents of COMMAND_FILE (one per line) static void get_args(int *argc, char ***argv) { struct bootloader_message boot; ... set_bootloader_message(&boot); }
本文来自博客园,作者:阿丟啊,转载请注明原文链接:https://www.cnblogs.com/qiyuexiaxun/p/17612598.html
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 没有源码,如何修改代码逻辑?
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· NetPad:一个.NET开源、跨平台的C#编辑器
· PowerShell开发游戏 · 打蜜蜂