SWUpdate Guide

From Variscite Wiki
SWUpdate

SWUpdate introduction

One of the challenges in nowadays embedded systems is field update of the embedded software (e.g. Linux) in the safe and efficient way whether via OTA or removable device. This article presents SWUpdate approach for the embedded system software update that supports local and remote updates, multiple update strategies and it can be well integrated in the Yocto build system by adding the meta-swupdate layer. The SWUpdater is licensed under GPL Version 2.0+ and was developed by Stefano Babic from U-Boot community. The most notable feature are:

  • Install on embedded media (eMMC, NAND, SD)
  • Allow delivery single image for multiple devices
  • Multiple interfaces for getting software
    • local storage
    • integrated web server
    • integrated REST client connector to hawkBit
    • remote server download
  • Software delivered as images, gzipped tarball, etc.
  • Allow custom handlers for installing FPGA firmware, microcontroller firmware via custom protocols.
  • Power-Off safe

References

Setup and build Yocto

Follow steps 1-3 of the Yocto Build Release page.

Supported image

The following image is provided by Variscite for evaluation purpose:

  • var-image-swupdate: This image is based on fsl-image-gui, the Default Variscite demo image with a GUI without any QT content, with the following differences:

- swupdate and swupdate-www pacakages are included - The kernel image and device trees are added to the /boot directory of the rootfs - The rootfs is configured as read-only by default

This image recipe works on all backends for X11, DirectFB, Frame Buffer and Wayland.

Supported distros

The following distros can be used:

  • fslc-x11: Distro for X11 without wayland. This distro include x11 feature and doesn’ has wayland support.
  • fslc-framebuffer: Distro for Framebuffer graphical backend. This distro doesn’t include x11 and wayland features.
  • fslc-wayland: Distro for Wayland without X11. This distro include wayland feature but doesn’t has x11 support.
  • fslc-xwayland: Distro for Wayland with X11. This distro include both wayland and x11 features.

Note: Also standard Poky distros can be used

GStreamer support

FSL community BSP comes with gstreamer-imx, a set of GStreamer1.0 plugins for i.MX platform, which make use of the i.MX multimedia capabilities.
Some of the multimedia plugins do not work well with X11 and Wayland backends.
To get the most from gstreamer-imx, it is recommended to use fslc-framebufer distro with one of the demo images

Build X11 GUI demo image

$ cd ~/var-fslc-yocto
$ MACHINE=var-som-mx6 DISTRO=fslc-x11 . setup-environment build_x11


Optional steps: local.conf customization

launch bitbake:

$ bitbake var-image-swupdate

NOTE: Some of the blitter-based i.MX GStreamer plugins do not work with X11 and Wayland backends. To get the most of the i.MX GPU/VPU acceleration, use the fslc-framebuffer backend.

local.conf customization

Change the downloads directory

Create a /opt/yocto_downloads directory and set its permissions:

$ sudo mkdir /opt/yocto_downloads
$ sudo chmod 777 /opt/yocto_downloads/

Direct downloads to it, by replacing 'DL_DIR ?= "${BSPDIR}/downloads/"' with 'DL_DIR = "/opt/yocto_downloads/"' in conf/local.conf:

$ sed -i 's/DL_DIR ?= "${BSPDIR}\/downloads/DL_DIR = "\/opt\/yocto_downloads/g' conf/local.conf

Add Eclipse debug and Qt creator support to your images

Append the following to the conf/local.conf file in your Yocto build directory, to add Eclipse debug and Qt creator support to your images:

EXTRA_IMAGE_FEATURES = " \
    debug-tweaks \
    tools-debug \
    eclipse-debug \
    "

IMAGE_INSTALL_append = " \
    tcf-agent \
    openssh-sftp-server \
    "

Use systemd instead of SysV init

Append the following to the conf/local.conf file in your Yocto build directory, to use systemd instead of SysV init in your images:

DISTRO_FEATURES_append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""
IMX_DEFAULT_DISTRO_FEATURES_append = " systemd"

Create a read-only root file system

Append the following to the conf/local.conf file in your Yocto build directory, to create a read-only rootfs:

EXTRA_IMAGE_FEATURES += "read-only-rootfs"

Build Results

The resulted images are located in tmp/deploy/images/var-som-mx6.

Image Name
How to use
fsl-image-gui-var-som-mx6.sdcard This image is for SD card boot.
It can be flashed as-is on an SD card that can then be used to boot your system,
according to the relevant startup-guide of your product
(usually requires to press the boot select button, or toggle a DIP switch).
For detailed information refer to the Create a bootable SD card section below.
fsl-image-gui-var-som-mx6.tar.bz2 Tarball with rootfs files.
Can be used to create an NFS root file system on the host.
See the Yocto Setup TFTP/NFS section for more info.
Also used to create our extended SD card.
See the Create a bootable SD card section below.
fsl-image-gui-var-som-mx6.ubi A complete UBI image containing a UBIFS volume, for writing to NAND flash.
uImage Linux kernel image, same binary for SD card or NAND flash.
u-boot.img-nand U-Boot built for NAND flash.
u-boot.img-sd U-Boot built for SD card boot or eMMC boot.
SPL-sd SPL built for SD card boot or eMMC boot.
SPL-nand SPL built for NAND flash.


Image Name
Description
fsl-image-gui-var-som-mx6.sdcard This image is for SD card boot.
It can be flashed as-is on an SD card that can then be used to boot your system,
according to the relevant startup-guide of your product
(usually requires to press the boot select button, or toggle a DIP switch).
For detailed information refer to the Create a bootable SD card section below.
fsl-image-gui-var-som-mx6.tar.gz Tarball with rootfs files.
Can be used to create an NFS root file system on the host.
See the Yocto Setup TFTP/NFS section for more info.
Also used to create our extended SD card.
See the Create a bootable SD card section below.
fsl-image-gui-var-som-mx6_128kbpeb.ubi A complete UBI image containing a UBIFS volume, for writing to NAND flash with 128KiB PEB.
fsl-image-gui-var-som-mx6_256kbpeb.ubi A complete UBI image containing a UBIFS volume, for writing to NAND flash with 256KiB PEB.
uImage Linux kernel image, same binary for SD card/eMMC or NAND flash.
SPL-sd SPL built for SD card boot or eMMC boot.
SPL-nand SPL built for NAND flash.
u-boot.img-sd U-Boot built for SD card boot or eMMC boot.
u-boot.img-nand U-Boot built for NAND flash.
Device Tree Name
SOM type
Carrier Board type
LCD Type
Evaluation Kit name
uImage-imx6q-var-som-cap.dtb VAR-SOM-MX6_V2 (Quad / Dual) VAR-MX6CustomBoard Capacitive touch VAR-DVK-MX6_V2-PRO
VAR-STK-MX6_V2
uImage-imx6q-var-som-res.dtb VAR-SOM-MX6_V2 (Quad / Dual) VAR-MX6CustomBoard Resistive touch VAR-DVK-MX6_V2-PRO
VAR-STK-MX6_V2
uImage-imx6q-var-som-vsc.dtb VAR-SOM-MX6_V2 (Quad / Dual) VAR-SOLOCustomBoard Capacitive LVDS touch N/A
uImage-imx6dl-var-som-cap.dtb VAR-SOM-MX6_V2 (DualLite / Solo) VAR-MX6CustomBoard Capacitive touch N/A
uImage-imx6dl-var-som-res.dtb VAR-SOM-MX6_V2 (DualLite / Solo) VAR-MX6CustomBoard Resistive touch N/A
uImage-imx6dl-var-som-vsc.dtb VAR-SOM-MX6_V2 (DualLite / Solo) VAR-SOLOCustomBoard Capacitive LVDS touch N/A
uImage-imx6qp-var-som-cap.dtb VAR-SOM-MX6_V2 (QuadPlus / DualPlus) VAR-MX6CustomBoard Capacitive touch N/A
uImage-imx6qp-var-som-res.dtb VAR-SOM-MX6_V2 (QuadPlus / DualPlus) VAR-MX6CustomBoard Resistive touch N/A
uImage-imx6qp-var-som-vsc.dtb VAR-SOM-MX6_V2 (QuadPlus / DualPlus) VAR-SOLOCustomBoard Capacitive LVDS touch N/A
uImage-imx6dl-var-som-solo-cap.dtb VAR-SOM-SOLO / VAR-SOM-DUAL VAR-MX6CustomBoard Capacitive touch N/A
uImage-imx6dl-var-som-solo-res.dtb VAR-SOM-SOLO / VAR-SOM-DUAL VAR-MX6CustomBoard Resistive touch N/A
uImage-imx6dl-var-som-solo-vsc.dtb VAR-SOM-SOLO / VAR-SOM-DUAL VAR-SOLOCustomBoard Capacitive LVDS touch VAR-DVK-SOLO/DUAL
VAR-STK-SOLO/DUAL
uImage-imx6q-var-dart.dtb DART-MX6 VAR-DT6CustomBoard Capacitive LVDS touch VAR-DVK-DT6
VAR-STK-DT6