SWupdate ERROR: No suitable .swu image found

812 views Asked by At

I am rather new to eclipse hawkbit and SWupdate I have been trying to do a test implementation on a RPi before I go with the production implementation. I have Hawkbit up and running but I am having several problems with SWupdate, I have built a core-image-full-cmdline.wic and the .swu update Image along with it:

This is the local.conf:

MACHINE = "raspberrypi3"

IMAGE_FSTYPES += "wic"

RPI_USE_U_BOOT = "1"

KERNEL_IMAGETYPE = "uImage"

IMAGE_INSTALL_append = " kernel-image kernel-modules"

#WKS_FILES_raspberrypi3 = "ts-raspberrypi.wks"

PREFERRED_PROVIDER_u-boot-fw-utils = "libubootenv"

DISTRO_FEATURES_append = " systemd"

DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"

VIRTUAL-RUNTIME_init_manager = "systemd"

VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"

ENABLE_UART = "1"

I also got this error when I changed the IMAGE_FSTYPE from ext4 rpimg to wic:

ERROR: update-image-1.0-r0 do_swuimage: swupdate cannot find image file: /home/aswin/yocto/build/tmp/deploy/images/raspberrypi3/core-image-full-cmdline.ext4.gz
ERROR: Logfile of failure stored in: /home/aswin/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/update-image/1.0-r0/temp/log.do_swuimage.87006
ERROR: Task (/home/aswin/yocto/layers/meta-swupdate-boards/recipes-extended/images/update-image.bb:do_swuimage) failed with exit code '1'

So I had to change the update-image.bb FSTYPE = ".wic"

And when I comment this out #WKS_FILES_raspberrypi3 = "ts-raspberrypi.wks" Then flash the image to a sd card and boot it nothing really shows up except for a blinking line. If I leave it, then the .swu file is way too big to upload it to hawkbit.

error picture

2

There are 2 answers

0
cramayar On

Tested using kirkstone version, so it is still relevant in 2023, and sumarizes what I found while testing swupdate to rpi3B +.

There are two issues to be addressed:

  1. The expected image and fs produced by bitbake is wrong, and
  2. The expected packages installed on the image for proper operation of swupdate are not present.

1. Expected image

Software update meta-swupdate layer makes the assumption that the image created by meta-raspberrypi comes in a .ext4.gz, however the default filesystem and image comes in .ext3.gz so when running 'bitbake update-image' it will fail to find the image with the right extension, which should be:

core-image-full-cmdline.ext4.gz

This is easily addressable by adding these lines in your conf/local.conf file:

...
MACHINE ??= "raspberrypi3-64"
...

# Overwrite SDIMG_ROOTFS_TYPE in local.conf
SDIMG_ROOTFS_TYPE = "ext4.gz"

IMAGE_FSTYPES += " tar.bz2 ext4.gz wic.bz2 wic.bmap"

2. Expected packages

In the configuration file you provided, you already enable systemd as your init manager, which is need by swupdate to be able to load on start.

In addition to this, if you found out that the swudate binaries and files are not present in your rootfs. It means that swupdate was not automatically added to the core-image-full-cmdline.

To do so we need to "append" packages to the core-image-full-cmdline. Inside the meta-swupdate-boards layer, add or create the file

meta-swupdate-boards/recipes-extended/images/core-image-full-cmdline.bbappend

IMAGE_INSTALL += " \
                        swupdate \
                        swupdate-www \
                 "

3. Summary

Your configuration file in conf/local.conf should include this lines:

...
MACHINE ??= "raspberrypi3-64"
...

# Overwrite SDIMG_ROOTFS_TYPE in local.conf
SDIMG_ROOTFS_TYPE = "ext4.gz"

IMAGE_FSTYPES += " tar.bz2 ext4.gz wic.bz2 wic.bmap"

PREFERRED_PROVIDER:u-boot-fw-utils = "libubootenv"
RPI_USE_U_BOOT = "1"
ENABLE_UART = "1"

# Notice that the new parsing : instead of _ is used
WKS_FILES:raspberrypi3 = "ts-raspberrypi.wks"


# Enable systemd as default init manager
DISTRO_FEATURES:append = " systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
VIRTUAL-RUNTIME_init_manager = "systemd"
VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"

and the swupdate should be appended to the core-image-full-cmdline layer as explained on 2.

4. Testing

Once you have modified your local.conf file, run in your build environment run:

bitbake core-image-full-cmdline

Then,

bitbake update-image

Output images

For the SD Card

We need two files wic.bz2 and wic.bmap to properly write to the SD card using the bmap tool, we can check them in

jenkins@xbuilder:~/poky/build-rpi$ ls tmp/deploy/images/raspberrypi3-64/*.wic*
tmp/deploy/images/raspberrypi3-64/core-image-full-cmdline-raspberrypi3-64-20231123091223.rootfs.wic.bmap  
tmp/deploy/images/raspberrypi3-64/core-image-full-cmdline-raspberrypi3-64.wic.bmap
tmp/deploy/images/raspberrypi3-64/core-image-full-cmdline-raspberrypi3-64-20231123091223.rootfs.wic.bz2   
tmp/deploy/images/raspberrypi3-64/core-image-full-cmdline-raspberrypi3-64.wic.bz2

The the files not including date are simply symbolic links.

For the software update images

The files with extension .swu will be used to upload in hawkbit.

jenkins@builder:~/poky/build$ ls  tmp/deploy/images/raspberrypi3-64/*.swu
tmp/deploy/images/raspberrypi3-64/update-image-raspberrypi3-64-20231123091614.swu  tmp/deploy/images/raspberrypi3-64/update-image-raspberrypi3-64.swu

I tested this using kirkstone branches in all related meta-layers:

  • meta-poky
  • meta-raspberrypi
  • meta-openembedded/meta-oe
  • meta-swupdate
  • meta-swupdate-boards

Cheers,

0
ZBT248 On

How do you expect it to work when you have HW compatibility errors, JSON file corrupted errors, forget about the hawkbit for now, and try to see if your sw-description file is creating the correct swu image file that updates the rootsfs or whatever you want to update using mongoose webserver and only then move on to the hawkbit.

First solve the errors that are coming before

suitable .swu image not found

Edited: please also put the sw-descirption file that you are using to create your swu file for further help.