Difference between revisions of "RISC FOTA"

From ESS-WIKI
Jump to: navigation, search
 
(33 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
 +
 +
Our Workflow as below
 +
 +
[[File:Flow3.png|600px|Flow3.png]]
 +
 
== WISE-OTA ==
 
== WISE-OTA ==
===Server===
+
 
===Client===
+
=== Server ===
===OTA PACKAGE TOOL===
+
 
 +
Here we can upload our update package and depoly to devices
 +
 
 +
[http://wise-ota.eastasia.cloudapp.azure.com/ http://wise-ota.eastasia.cloudapp.azure.com/]
 +
 
 +
=== Agent ===
 +
 
 +
Our devices need to install OTA agent by default, so that devices can connect to OTA server.
 +
 
 +
=== OTA PACKAGE TOOL ===
 +
 
 +
This software is a package tool for WISE-PaaS/OTA system. You can use this tool to generate an OTA package which can be identified by the WISE-PaaS/OTA system based on your original update resources.
 +
 
 
== Architecture ==
 
== Architecture ==
===Bootloader===
+
 
===System===
+
=== Bootloader ===
===Cache===
+
 
 +
It can detect the Update Flag is enabled or not
 +
 
 +
::If flag is true ,it will enter '''Recovery System'''
 +
 
 +
::If flag is false,it will enter '''Main System'''
 +
 
 +
=== System ===
 +
 
 +
We need two systems in our image.
 +
 
 +
One is '''Main System''' , another is '''Recovery System'''.
 +
 
 +
Both Systems have a specific script for FOTA.
 +
 
 +
*Main System
 +
 
 +
::do_update.sh
 +
:::This script has three functions
 +
:::#Record upgrade package file path
 +
:::#Set Upgrade Flag
 +
:::#Return OTA result
 +
 
 +
*Recovery system
 +
 
 +
::adv-ota.sh
 +
:::This script has two functions
 +
:::#Parse upgrade package and upgrade main system
 +
:::#Clear Upgrade Flag, and reboot
 +
 
 +
=== Cache ===
 +
 
 +
For storage of downloaded OTA upgrade packages
 +
 
 
== Upgrade Packages ==
 
== Upgrade Packages ==
 +
 +
ota-package.sh
 +
 +
:Generate package file to be used for OTA update on Yocto Linux
 +
Usage: ota-package.sh [OPTIONS]
 +
 +
Generate package file to be used for OTA update on Yocto Linux
 +
 +
-b <file>  Bootloader image file
 +
-k <file>  Kernel or Boot image file
 +
-d <file>  DTB (device tree) file
 +
-r <file>  Rootfs image file
 +
-o <file>  Output file
 +
-h        Show help
  
 
== Platform ==
 
== Platform ==
===i.MX6===
 
===Quark===
 
===QCOM===
 
  
==Upgrade Steps==
+
Depending on the platform, we have different modifications for FOTA
===Online Upgrade===
+
 
===Local Upgrade===
+
=== i.MX6 ===
 +
 
 +
*'''Layout'''
 +
 
 +
:Take 4G size as an example
 +
 
 +
[[File:Imx6 layout.png|500px|imxayout.png]]
 +
 
 +
:#We add misc partition to store upgrade flag
 +
:#We can only upgrade '''boot''' and '''rootfs''' partition so far
 +
 
 +
:::*Kernel
 +
:::*Device tree
 +
:::*Root file-system
 +
 
 +
*'''Workflow'''
 +
 
 +
[[File:Imxflow2.png|500px|Imxflow2.png]]
 +
 
 +
:The step for setting upgrade flag here is to write BCB to misc partition.
 +
 
 +
:Then bootloader will detect the content of BCB, if the content is '''"boot-recovery"''' then system will boot to recovery system.
 +
 
 +
=== Qualcomm APQ8016 (Dragdonboard 410c) ===
 +
 
 +
The workflow on Qualcomm APQ8016 platform is the same with i.MX6. We also have an additional MISC partition for upgrade flag. The only one difference between APQ8016 & i.MX6 is '''partition layout'''.
 +
 
 +
*'''Layout'''
 +
 
 +
:Because we have 8GB eMMC in RSB-4760 project, we are able to have bigger /cache space for image upgrade.
 +
:Besides the bigger size of storage, we use GPT (GUID partition table) for partitions.
 +
 
 +
:
 +
 
 +
:The partition layout is as below. The orange ones are new to added for OTA feature.
 +
 
 +
[[File:Db410c layout.png|320px|Db410c layout.png]]
 +
 
 +
=== Quark ===
 +
 
 +
== Upgrade Steps ==
 +
 
 +
=== Online Upgrade ===
 +
 
 +
*Step 1
 +
 
 +
:Use package tool to generate ota package file
 +
::[https://github.com/ADVANTECH-Corp/OTA_PACKAGE_TOOL/archive/master.zip OTA_PACKAGE_TOOL]
 +
::'''We must rename to update.zip'''
 +
::Put update.zip (generate by ota-package.sh) in the same folder.
 +
 
 +
[[File:Oat1.png|600px|Oat1.png]]
 +
 
 +
::Set the relevant settings and generate ota package.
 +
 
 +
[[File:Ota2.png|600px|Ota2.png]]
 +
 
 +
*Step 2
 +
 
 +
:Upload ota package
 +
 
 +
[[File:Ota3.png|600px|Ota3.png]]
 +
 
 +
::Push upload button to upload ota package
 +
 
 +
[[File:Ota4.png|600px|Ota4.png]]
 +
 
 +
*Step 3
 +
 
 +
:Check whether the device has connected to server
 +
::'''If this is your first to connect your device to sever, it will add to default group'''
 +
::'''You have to create new group for update , because default group can't use upgrade function'''
 +
::If the device connect to server, the host will show your device
 +
 
 +
[[File:Ota5.png|600px|Ota5.png]]
 +
 
 +
[[File:Ota6.png|600px|Ota6.png]]
 +
 
 +
*Step 4
 +
 
 +
:Upgrade system
 +
::Push upgrade button and select ota package
 +
 
 +
[[File:Ota7.png|600px|Ota7.png]]
 +
 
 +
[[File:Ota8.png|600px|Ota8.png]]
 +
 
 +
[[File:Ota9.png|600px|Ota9.png]]
 +
 
 +
::We can see the message via debug port
 +
 
 +
[[File:Ota10.png|600px|Ota10.png]]
 +
 
 +
=== Local Upgrade ===
 +
*Step 1
 +
:copy update.zip to cache
 +
cp update.zip /cache/
 +
*Step 2
 +
:enter /cache/
 +
cd /cache
 +
*Step 3
 +
:set flag and set recovery command
 +
/tools/do_update.sh update.zip
 +
[[File:local1.png|400px]]
 +
*Step 4
 +
:reboot
 +
*Step 5
 +
:Enter recovery system and upgrade
 +
[[File:local2.png|400px]]
 +
*Step 6
 +
:Enter main system and check result
 +
/toos/do_update.sh result
 +
OK

Latest revision as of 08:40, 16 August 2018

Introduction

Our Workflow as below

Flow3.png

WISE-OTA

Server

Here we can upload our update package and depoly to devices

http://wise-ota.eastasia.cloudapp.azure.com/

Agent

Our devices need to install OTA agent by default, so that devices can connect to OTA server.

OTA PACKAGE TOOL

This software is a package tool for WISE-PaaS/OTA system. You can use this tool to generate an OTA package which can be identified by the WISE-PaaS/OTA system based on your original update resources.

Architecture

Bootloader

It can detect the Update Flag is enabled or not

If flag is true ,it will enter Recovery System
If flag is false,it will enter Main System

System

We need two systems in our image.

One is Main System , another is Recovery System.

Both Systems have a specific script for FOTA.

  • Main System
do_update.sh
This script has three functions
  1. Record upgrade package file path
  2. Set Upgrade Flag
  3. Return OTA result
  • Recovery system
adv-ota.sh
This script has two functions
  1. Parse upgrade package and upgrade main system
  2. Clear Upgrade Flag, and reboot

Cache

For storage of downloaded OTA upgrade packages

Upgrade Packages

ota-package.sh

Generate package file to be used for OTA update on Yocto Linux
Usage: ota-package.sh [OPTIONS]

Generate package file to be used for OTA update on Yocto Linux

-b <file>  Bootloader image file
-k <file>  Kernel or Boot image file
-d <file>  DTB (device tree) file
-r <file>  Rootfs image file
-o <file>  Output file
-h         Show help

Platform

Depending on the platform, we have different modifications for FOTA

i.MX6

  • Layout
Take 4G size as an example

imxayout.png

  1. We add misc partition to store upgrade flag
  2. We can only upgrade boot and rootfs partition so far
  • Kernel
  • Device tree
  • Root file-system
  • Workflow

Imxflow2.png

The step for setting upgrade flag here is to write BCB to misc partition.
Then bootloader will detect the content of BCB, if the content is "boot-recovery" then system will boot to recovery system.

Qualcomm APQ8016 (Dragdonboard 410c)

The workflow on Qualcomm APQ8016 platform is the same with i.MX6. We also have an additional MISC partition for upgrade flag. The only one difference between APQ8016 & i.MX6 is partition layout.

  • Layout
Because we have 8GB eMMC in RSB-4760 project, we are able to have bigger /cache space for image upgrade.
Besides the bigger size of storage, we use GPT (GUID partition table) for partitions.
The partition layout is as below. The orange ones are new to added for OTA feature.

Db410c layout.png

Quark

Upgrade Steps

Online Upgrade

  • Step 1
Use package tool to generate ota package file
OTA_PACKAGE_TOOL
We must rename to update.zip
Put update.zip (generate by ota-package.sh) in the same folder.

Oat1.png

Set the relevant settings and generate ota package.

Ota2.png

  • Step 2
Upload ota package

Ota3.png

Push upload button to upload ota package

Ota4.png

  • Step 3
Check whether the device has connected to server
If this is your first to connect your device to sever, it will add to default group
You have to create new group for update , because default group can't use upgrade function
If the device connect to server, the host will show your device

Ota5.png

Ota6.png

  • Step 4
Upgrade system
Push upgrade button and select ota package

Ota7.png

Ota8.png

Ota9.png

We can see the message via debug port

Ota10.png

Local Upgrade

  • Step 1
copy update.zip to cache
cp update.zip /cache/
  • Step 2
enter /cache/
cd /cache
  • Step 3
set flag and set recovery command
/tools/do_update.sh update.zip

Local1.png

  • Step 4
reboot
  • Step 5
Enter recovery system and upgrade

Local2.png

  • Step 6
Enter main system and check result
/toos/do_update.sh result
OK