Search code examples
embedded-linuxyoctoswupdate

SWUpdate RootFS and Device Tree


I am using Yocto to create a Linux build for an IMX6. This is going great and I am not looking into using SWUpdate to perform kernel and device tree updates. So far I have a bitbake script which does the following.

source setup-environment build-fb/
bitbake -c cleanall swupdate
bitbake swupdate
bitbake -c cleanall swupdate-image
bitbake swupdate-image
bitbake -c cleanall mainapplication-dev
bitbake mainapplication-dev
bitbake -c cleanall smg-image-swu
bitbake smg-image-swu

This properly configures my build and creates a .swu file containing three items

  1. mainapplication-dev-imx6ull14x14evk.tar.bz2
  2. sw-description
  3. update.sh

I followed a guide by Variscite and referenced their GitHub. In their guide they mention that enter image description here

This leads me to believe that after they run a build, the .swu file contains the files I listed above with the addition that in /boot lies a zimage and a .dtb file. I have replicated their bb files. In my mainapplication-dev-imx6ull14x14evk.tar.bz2 in the /boot directory, I only have a zimage. I cannot get this to package the device tree.

Has anyone done this before? Can anyone guide me here? For reference I am adding my bitbake files below.

smg-image-swu.bb:

DESCRIPTION = "Example compound image for Variscite boards"
SECTION = ""

# Note: sw-description is mandatory
SRC_URI = " \
    file://sw-description \
    file://update.sh \
"

inherit swupdate

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

# IMAGE_DEPENDS: list of Yocto images that contains a root filesystem
# it will be ensured they are built before creating swupdate image
IMAGE_DEPENDS = "mainapplication-dev"

# SWUPDATE_IMAGES: list of images that will be part of the compound image
# the list can have any binaries - images must be in the DEPLOY directory
SWUPDATE_IMAGES = "mainapplication-dev"

SWUPDATE_IMAGES_FSTYPES[mainapplication-dev] = ".tar.bz2"

smg-image-swupdate.bb

DESCRIPTION = ""
LICENSE = "MIT"

require recipes-core/images/core-image-minimal.bb

CORE_IMAGE_EXTRA_INSTALL += " \
    swupdate \
    swupdate-www \
    kernel-image \
    kernel-devicetree \
"

IMAGE_FSTYPES = "tar.gz"

Solution

  • To add the device tree and modules to my .swu image I made the following change to smg-image-swu.bb

    DESCRIPTION = "Example compound image for Variscite boards"
    SECTION = ""
    
    # Note: sw-description is mandatory
    SRC_URI = " \
        file://sw-description \
        file://update.sh \
    "
    
    inherit swupdate
    
    LICENSE = "MIT"
    LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
    
    # IMAGE_DEPENDS: list of Yocto images that contains a root filesystem
    # it will be ensured they are built before creating swupdate image
    IMAGE_DEPENDS = "mainapplication-dev virtual/kernel"
    
    # SWUPDATE_IMAGES: list of images that will be part of the compound image
    # the list can have any binaries - images must be in the DEPLOY directory
    SWUPDATE_IMAGES = "mainapplication-dev \
                modules-imx6ull14x14evk \
                imx6ull-14x14-evk"
    
    SWUPDATE_IMAGES_FSTYPES[mainapplication-dev] = ".tar.bz2"
    SWUPDATE_IMAGES_FSTYPES[modules-imx6ull14x14evk] = ".tgz"
    SWUPDATE_IMAGES_FSTYPES[imx6ull-14x14-evk] = ".dtb"