Upgrade of OTA System Based on Forlinx OK3568-C Single Board Computer

OTA is a way to upgrade the system for the device without loss, and can remotely deploy new functions to the product. We can not only download the OTA upgrade package through the network, but also upgrade the device by downloading the OTA upgrade package to the SD card or U disk.

In this article, we will introduce the OTA upgrade process, the process of local upgrade program recovery, and the technical details of the upgrade through the Forlinx Embedded OK3568-C development board.

1. Making recovery.img

Recovery The associated source code path:

buildroot/output/OK3568-recovery/build/recovery-develop

If any of the source files in the above directory have been modified, you need to perform the following actions:

(1). forlinx@ubuntu:~/OK3568-linux-source$ source envsetup.sh

(2). Select the recovery configuration for a platform and enter 96

(3). forlinx@ubuntu:~/OK3568-linux-source$ make recovery-dirclean && make recovery  #Clear the compilation product and recompile

(4). forlinx@ubuntu:~/OK3568-linux-source$ make rkupdate-dirclean && make rkupdate  #Clear the compilation product and recompile

If you have not modified the source code files in the above directory, then do the following directly:

(1). forlinx@ubuntu:~/OK3568-linux-source$ ./build.sh recovery  #compile to generate recovery.img

(2). forlinx@ubuntu:~/OK3568-linux-source$ ./mkfirmware.sh

# Copy the generated firmware to the rockdev/ directory

Flash/OK3568-linux-source/buildroot/output/OK3568-recovery/images/recovery.img file.

Click Device Partition Table, tick 9, select recovery path, and click Execute.

OK3568-C development board Making recovery.img

2. Make an upgrade image

How to verify that the upgrade was successful? We need to have a preliminary understanding of the boot.img file holds the device tree and kernel, and we just need to make appropriate changes to the device tree or kernel. This routine updates the boot.img file as an example, with appropriate changes to the device tree.

Modify the device tree:

/OK3568-linux-source/kernel/arch/arm64/boot/dts/rockchip/OK3568-C-common.dtsi,Modify the forlinx _ control node as follows. By default, only the HDMI output is turned on, leaving the MIPI and LVDS outputs off.

OK3568-C development board Modify the device tree

Modify the file:

/OK3568-linux-source/tools/linux/Linux_Pack_Firmware/rockdev/package-file

Modify this file as required, this routine updates boot.img as an example, so comment out the other .img files. Users can adjust this file to meet product update requirements.

OK3568-C development board Modify the file

This routine takes the example of modifying the device tree display and recompiling the kernel after modifying the device tree.

forlinx@ubuntu:~ /OK3568-linux-source$ ./build.sh kernel #modify the device tree, then regenerate the kernel

forlinx@ubuntu:~/OK3568-linux-source$ ./build.sh updateimg #package Upgrade Package Firmware

Use /Ok3568--linux-source/rockdev/update.img file to upgrade.

3. Upgrade operation

SD card or USB flash drive upgrade

Mount the SD card or USB disk to the /run/media directory of the OK3568-C development board by default. Copy the update.img image file to the /userdata directory of the OK3568-C development board, and the system will detect the upgrade package in this directory and upgrade it automatically after rebooting the board.

FTP server upgrade

Execute the following command on the OK3568-C development board to copy the upgrade package file from the server to the development board for upgrading.

Upgrade of OTA System Based on Forlinx OK3568-C Single Board Computer

After the download is complete use the following command to upgrade:

update ota /userdata/update.img

During the upgrade process, the device will enter recovery mode and upgrade automatically, after the upgrade is successful, it will enter the normal normal system.

4. Verify the test results

Power up the OK3568-C development board and the serial terminal will enter the uboot screen selection interface by holding down the space bar. The phenomenon of flashing default factory image files: by default, HDMI, MIPI, and LVDS three outputs are enabled.

Upgrade of OTA System Based on Forlinx OK3568-C Single Board Computer

Phenomenon after flashing upgrade package image file: Only HDMI display is enabled, and the other two outputs are closed.

Upgrade of OTA System Based on Forlinx OK3568-C Single Board Computer

5. Safety instructions

When creating the update.img firmware, remember you can choose to include all partitions or just specific ones. Modify the package-file to remove unnecessary partitions, reducing the update.img size.

If ''recovery.img'' is included in the ''package-file,'' it won't be upgraded in Recovery mode. To prevent issues where power loss during recovery.img upgrading could disrupt the upgrade of other partitions, it's recommended to upgrade this partition under normal system mode. When executing the update command, the system will first check if ''recovery.img'' is included in the update.img package. If so, it will upgrade the recovery partition before entering Recovery mode to upgrade other partition firmware.

It's not recommended to include the ''misc'' partition in the update.img. Even if it's included, the upgrade program will ignore it when detected. Even if the ''misc'' partition is upgraded, the recovery program will still clear all commands and parameters in the ''misc'' partition after a successful upgrade, which may not yield the expected results.

If the update.img package is placed in the ''userdata'' partition in flash memory, ensure that ''userdata.img'' is not included in the package-file. This is because it may lead to file system damage, potentially causing the OEM or user data partition to fail to mount successfully after the upgrade. If upgrading from an SD card or USB disk, you can pack user data. img to upgrade the user data partition. After the upgrade is completed, the user data partition will be re-sized.

With that, the entire process of OTA upgrades has been explained. Users can follow the instructions in this article for experimentation. Once they are familiar with the operations described in this article, they can modify U-Boot, the kernel, or the file system to remotely upgrade their products via OTA. This enables them to fix bugs in their products, making it more convenient to optimize and iterate on their products.