Difference between revisions of "OTA guide"

From ESS-WIKI
Jump to: navigation, search
(Created page with "1.dd image to SD card dd if=core-image-full-cmdline-imx6qrom3420a1.sdcard of=/dev/sdc;sync 2.'''OTA clien'''t should download update.zip to /cache 3.'''OTA client''' shoul...")
 
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
1.dd image to SD card  
+
= Compile OTA image =
 +
 
 +
[[IoTGateway/BSP/Linux/iMX6/Yocto_LBV8_User_Guide#Get_BSP|After Get BSP]]
 +
 
 +
Checkout to '''OTA branch'''
 +
 
 +
cd sources/meta-advantech
 +
git checkout '''OTA'''
 +
 
 +
[[IoTGateway/BSP/Linux/iMX6/Yocto_LBV8_User_Guide#To_create_one_new_build_environment|After create a new build machine]]
 +
 
 +
build recovery image
 +
 
 +
bitbake '''initramfs-debug-image'''
 +
 
 +
build minimal image with OTA functions
 +
 
 +
bitbake '''core-image-full-cmdline'''
 +
 
 +
= Make OTA SDcard =
 +
 
 +
dd image to SD card
 +
 
 
  dd if=core-image-full-cmdline-imx6qrom3420a1.sdcard of=/dev/sdc;sync
 
  dd if=core-image-full-cmdline-imx6qrom3420a1.sdcard of=/dev/sdc;sync
  
2.'''OTA clien'''t should download update.zip to /cache
+
= Generate update.zip =
  
3.'''OTA client''' should call as below
+
Taken rom3420 as an example:
  /tools/do_update.sh /cache/update.zip
+
 
then it returns
+
cp sources/meta-advantech/meta-WISE-PaaS/recipes-ota/ota-script/files/'''ota-package.sh''' build-3420/tmp/deploy/images/imx6qrom3420a1/
 +
 
 +
*ota-package.sh
 +
 
 +
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
 +
 
 +
So we run command as below:
 +
 
 +
./ota-package.sh -k zImage -d imx6q-rom3420-a1.dtb -r core-image-full-cmdline-imx6qrom3420a1.ext4 -o update.zip
 +
 
 +
= Update Manually =
 +
 
 +
cp '''update.zip''' /cache/
 +
 
 +
cd /cache/
 +
  /tools/do_update.sh update.zip
 
  Write recovery command ...
 
  Write recovery command ...
 
  Write BCB ...
 
  Write BCB ...
Line 14: Line 60:
 
  Setup OK. Reboot to recovery image!
 
  Setup OK. Reboot to recovery image!
  
4.'''OTA client''' should reboot system after above command
+
Then
 +
 
 +
reboot
 +
 
 +
After reboot , system will enter recovery image for updating system and reboot system
  
5.After reboot , system will enter recovery image for updating system and reboot system
 
 
  Adv-Boot 2009.08-advantech_rom3420_1G_V2.210_svn414 (Mar 14 2014 - 09:51:19)
 
  Adv-Boot 2009.08-advantech_rom3420_1G_V2.210_svn414 (Mar 14 2014 - 09:51:19)
 
  U-Boot 2016.03-OTA+g3adf656d (Apr 05 2017 - 06:05:49 +0000)
 
  U-Boot 2016.03-OTA+g3adf656d (Apr 05 2017 - 06:05:49 +0000)
Line 49: Line 98:
 
  reboot: Restarting system  
 
  reboot: Restarting system  
  
5.After updating system, '''OTA client''' can call command as below
+
After updating system
 +
 
 
  /tools/do_update.sh result
 
  /tools/do_update.sh result
 +
 
it returns
 
it returns
 +
 
  OK
 
  OK
 +
 
which means system updates successfully
 
which means system updates successfully

Latest revision as of 07:54, 21 December 2020

Compile OTA image

After Get BSP

Checkout to OTA branch

cd sources/meta-advantech
git checkout OTA

After create a new build machine

build recovery image

bitbake initramfs-debug-image

build minimal image with OTA functions

bitbake core-image-full-cmdline

Make OTA SDcard

dd image to SD card

dd if=core-image-full-cmdline-imx6qrom3420a1.sdcard of=/dev/sdc;sync

Generate update.zip

Taken rom3420 as an example:

cp sources/meta-advantech/meta-WISE-PaaS/recipes-ota/ota-script/files/ota-package.sh build-3420/tmp/deploy/images/imx6qrom3420a1/
  • ota-package.sh
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

So we run command as below:

./ota-package.sh -k zImage -d imx6q-rom3420-a1.dtb -r core-image-full-cmdline-imx6qrom3420a1.ext4 -o update.zip 

Update Manually

cp update.zip /cache/

cd /cache/
/tools/do_update.sh update.zip
Write recovery command ...
Write BCB ...
0+1 records in
0+1 records out
14 bytes copied, 0.00918567 s, 1.5 kB/s
Setup OK. Reboot to recovery image!

Then

reboot

After reboot , system will enter recovery image for updating system and reboot system

Adv-Boot 2009.08-advantech_rom3420_1G_V2.210_svn414 (Mar 14 2014 - 09:51:19)
U-Boot 2016.03-OTA+g3adf656d (Apr 05 2017 - 06:05:49 +0000)
.....
setup env for recovery..
flash target is MMC:0
Net:   FEC [PRIME]
Normal Boot
Hit any key to stop autoboot:  0
boota mmc0 recovery
kernel   @ 14008000 (5845616)
ramdisk  @ 15000000 (5362058)
fdt      @ 14f00000 (53290)
.....
[OTA] Read recovery commands ...
[OTA] Check OTA package ...
[OTA] Unzip /cache/update.zip ...
Archive:  /cache/update.zip
  inflating: ota-update/updater-script
  inflating: ota-update/zImage
  inflating: ota-update/imx6q-rom3420-a1.dtb
[OTA] Parse updater-script in /cache/update.zip ...
[OTA] Update boot partition (zImage) ...
[OTA] Update done!
[OTA] OK
[OTA] Cleaning BCB ...
32+0 records in
32+0 records out
random: nonblocking pool is initialized
[OTA] BCB is clear!
[OTA] Going to reboot ...
reboot: Restarting system 

After updating system

/tools/do_update.sh result

it returns

OK

which means system updates successfully