RK3308 embedded system upgrade process using Recovery mode

1. Recovery upgrade overview

In the development of embedded Linux systems, there are many ways to upgrade terminal equipment, mainly including: 1. SD card or U disk boot programming; 2. OTA (space download technology) upgrade; 3. Remote online programming; 4. , upgrade by file copy. This article mainly introduces the upgrade process of downloading the upgrade package to the device during OTA technology upgrade, and then using the Recovery mode to program the specified partition.

                                             Recovery upgrade flowchart

According to the above Recovery upgrade flow chart, it can be seen that the three key applications that implement the upgrade function are:

        RecoverySystem program: It is used to boot into Recovery mode and check whether the Recovery.img image needs to be burned.

        recovery program: the core program of recovery mode.

        rkupdate program: It is used to parse the data of each partition in the update.img firmware and execute the key procedures for programming and upgrading each partition.

2. Preparation before upgrade

Compile the rootfs.img main file system image:

1. Execute source envsetup.sh in the root directory and select the compilation configuration corresponding to the platform (such as: rockchip_rk3308_release);

2. Execute make menuconfig to turn on recoverySystem support;

The recoverySystem source code is located at: external/recoverySystem/

3. Compile

Execute make recoverySystem-rebuild, and then execute ./build.sh rootfs to compile the rootfs main file system.

 

Compile the recovery.img image:

1. Execute source envsetup.sh and select the platform compilation configuration corresponding to recovery (such as: rockchip_rk3308_recovery);

2. Execute make menuconfig to turn on recoverySystem support;

The recovery source code is located at: external/recovery/

The rkupdate source code is located at: external/rkupdate/

3. Compile

Execute make recovery-rebuild and make rkupdate-rebuild, and then execute ./build.sh recovery to compile the recovery.img image.

Make update.img upgrade package image

1. Modify tools/linux/Linux_Pack_Firmware/rockdev/package-file

      # vim tools/linux/Linux_Pack_Firmware/rockdev/package-file

     Upgrade the partition configuration as needed and modify the package-file file.

2. Execute ./mkfirmware.sh, and the generated firmware will be copied to the recckdev directory.

3. Execute ./build.sh updateimg. This command will place the update.img upgrade package in the recckdev directory.

 

3. Recovery upgrade process

1. Upload update.img to the embedded board via http. It needs to be placed in the /userdata directory or /mnt/sdcard directory or /udisk directory, otherwise update.img cannot be recognized normally.

2. Execute recoverySystem ota /userdata/update.img;

3. Before entering recovery mode, update.img will be parsed to check whether it contains the recovery.img image. If it does, recovery.img will be burned first.

4. Write the misc partition upgrade command and restart the system. The device will enter recovery mode.

5. Enter the recovery mode and parse the misc command. If it is an upgrade, execute the rkupdate upgrade program to program the specified partition.

6. After the upgrade is successful, clear the misc command and reboot into the normal system.

                                                 Analyzing the misc process

                                                       rkupdte program for firmware programming

Precautions:

1. When packaging update.img, you need to modify the package-file file first, open the partitions that need to be upgraded, and block the partitions that do not need to be upgraded to reduce the size of update.img;

2. In order to avoid power failure during the upgrade of recovery.img, which may cause the upgrade to fail, the recovery upgrade is placed in the main system mode instead of the recovery mode;

3. If you need to place the upgrade package in the /userdata directory, please do not open the userdata partition in the package-file. You cannot upgrade the upgrade package containing the userdata.img image under /userdata to avoid damaging the update during the process of burning userdata. .img image.

4. There are the following images prepared by RK for misc.img

Commonly used ones are blank-misc.img and wipe_all-misc.img

Blank-misc.img is a blank misc partition file, and wipe_all-misc.img is a misc partition file used to format user partitions.

If you need customized modifications, you can view the external/recovery/recovery.c file.

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin blog.csdn.net/yufeng1108/article/details/103786347