OTA guide

From ESS-WIKI
Revision as of 07:54, 21 December 2020 by Daniel.hung (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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