Share the Recovery mode function information of VS-RK3399 board[Copy link]
The following describes the recovery mode upgrade method of VS-RK3399, mainly for the motherboard of Shenzhen Shizhuang Technology Co., Ltd. 1.1 Recovery mode overview Recovery mode refers to a mode that can modify the data or system inside the Android phone (similar to Windows PE or DOS). In this mode, we can flash a new Android system, or back up or upgrade the existing system, or restore the factory settings here. 1.2 Recovery mode location in the framework layer After Android starts, it will first run the bootloader. The bootloader will decide whether to enter the recovery mode based on certain judgment conditions. Recovery mode will load the recovery partition, which contains recovery.img. Recovery.img contains the standard kernel (the same as the kernel in boot.img) and the recovery root file system. Android recovery has three parts and two interfaces. The work of recovery requires the cooperation of the entire software platform. From the perspective of architecture, there are three parts: 1. Main System: Linux system started with boot.img, the normal working mode of Android. 2. Recovery: The Linux system started with recovery.img mainly runs the recovery program. 3. Bootloader: In addition to loading and starting the system, it also obtains messages from the Main System and Recovery by reading the MISC partition of the flash, and uses this to decide what operation to do. Two communication interfaces: 1. /cache/recovery/: command, log, intent 2. BCB (Bootloader Control Block): misc partition Main System How to enter Recovery mode: When we use the update.zip package to upgrade the Main System, the system will restart and enter recovery mode. Before the system restarts, we can see that the Main System will definitely write boot-recovery (pink line) to the recovery domain to tell the bootloader to enter Rcovery mode after restarting. This step is necessary. As for whether the Main System will write values to the recovery domain, we cannot be sure of this in the source code. Even so, after restarting into Recovery mode, the Bootloader will read the value from /cache/recovery/command and put it into the recovery domain of BCB. Before restarting, the Main System will definitely write the operation command that Recovery will perform to /cache/recovery/command. 1.installPackage: RecoverySystem's interface, completes the upgrade package path conversion, and calls bootCommand. 2.bootCommand: RecoverySystem's interface, writes the command to /cache/recovery/command, and calls pm.reboot. 3.Pm.reboot: PowerManager's interface, restarts and enters Recovery mode. 2 Compile OTA package 2.1 OTA Introduction OTA (over the air) upgrade is the standard software upgrade method provided by the Android system. It is powerful and provides full upgrade (complete package) and incremental upgrade mode (difference package). It can be upgraded locally or over the network. 2.2 Generate a complete package The complete package includes: system, recovery, boot.img The correct order to release a firmware: 1. make -j4 2. make otapackage -j4 3. ./mkimage.sh ota To release firmware, you must use ./mkimage.sh ota to package boot and kernel. You do not need to burn kernel separately. If the mass production firmware is separate, it will affect the subsequent differential package upgrade, unless you do not need to use differential upgrade. In the out/target/product/rkxxxx/ directory, the ota complete package rkxxxx-ota-eng.root.zip will be generated. Change it to update.zip and copy it to the T card or built-in flash for upgrade. 2.3 Generate differential package OTA differential package only has differential content, the package size is relatively small, and it is mainly used for OTA online upgrade, and can also be upgraded locally on the T card. The production of OTA differential package requires special compilation for manual production. (1) First release the v1 version of the firmware and generate a complete package of the v1 version. (2) Save out/target/product/rkxxxx/obj/PACKAGING/target_files_intermediates/rk3188-target_files-en g.root.zip as rkxxxx-target_files-v1.zip, as the basic material package of the v1 version. (3) Modify the kernel code or android code, release the v2 version of the firmware, and generate a complete package of the v2 version. (4) Save out/target/product/rkxxxx/obj/PACKAGING/target_files_intermediates/rk3188-target_files-en g.root.zip as rkxxxx-target_files-v2.zip, as the basic material package of the v2 version. (5) Generate a differential upgrade package of v1-v2: Android7.1 Google CTS test requires the enabling of the verifying boot function. Currently, the platforms that enable the verifying boot function by default include RK3368H Android7.1 mid and RK3399 Android7.1 mid. When making a difference package, you must add the block parameter. ./build/tools/releasetools/ota_from_target_files -v -i rkxxxx-target_files-v1.zip -p out/host/linux-x86 -k build/target/product/security/testkey rkxxxx-target_files-v2.zip out/target/product/rk3188/rkxxxx-v1-v2.zip Description: Generate a difference package command format: ota_from_target_files -v -i The previous target file for comparison --block Use the block method for OTA upgrade. When enabling the verfying boot function, you must add this parameter -p host host compilation environment -k package key The next target file for comparison The final generated ota difference package If you have any questions, please leave a message or call 3026969227