How to secure firmware update using single files copy instead of images ?

Hi,

Host OS: Ubuntu 16.04 LTS x86_64
Target: ConnectCore i.MX6UL Starter Kit
Target OS: Embedded Linux
Build Environment: DEY-2.2
Issue: Can’t firmware update using single files copy

I want to perform a firmware update but not atomically, instead by delta mechanism using update files.

For this, I changed the sw-description file located in:
/usr/local/dey-2.2/sources/meta-digi/meta-digi-dey/recipes-digi/swu-images/files/ccimx6ul

Its content example:
software =
{
version = “0.0.1”;

files: (
    {
        filename = "test";
        path = "/bin";
    device = "/dev/mtdblock7";
    filesystem = "ubivol";
    }
);

}

Then bitbake a new dey-image-tiny-swu.

Once on target and after perfomring the following command:

update-firmware dey-image-tiny-swu-ccimx6ulstarter.swu

I face this issue:
[RECOVERY] Starting recovery…
[RECOVERY] Checking update package ‘dey-image-tiny-swu-ccimx6ulstarter.swu’
Swupdate v2017.1.0

Licensed under GPLv2. See source distribution for detailed copyright notices.

Registered handlers:
raw
rawfile
ubivol
ubipartition
shellscript
preinstall
postinstall
uboot
Version 0.0.1
successfully checked ‘/run/media/mmcblk1p1/dey-image-tiny-swu-ccimx6ulstarter.swu’
[RECOVERY] Firmware update requested
[RECOVERY] Partition ‘rootfs’ successfully erased!
[RECOVERY] Update package location: /run/media/mmcblk1p1/dey-image-tiny-swu-ccimx6ulstarter.swu
Trying to connect to SWUpdate…
Swupdate v2017.1.0

Licensed under GPLv2. See source distribution for detailed copyright notices.

Registered handlers:
raw
rawfile
ubivol
ubipartition
shellscript
preinstall
postinstall
uboot
[NOTIFY] : SWUPDATE running : [extract_sw_description] : Found file:
filename sw-description
size 178
checksum 0x2a8d VERIFIED

Version 0.0.1
[NOTIFY] : SWUPDATE running : [parse_files] : Found File : test –> /bin (/dev/mtdblock7)

[NOTIFY] : SWUPDATE running : [cpio_scan] : Found file:
filename test
size 26
REQUIRED

Main loop Daemon
scan_for_ubi_devices
[NOTIFY] : SWUPDATE running : [scan_ubi_volumes] : mtd3: Volume found : linux
[NOTIFY] : SWUPDATE running : [scan_ubi_volumes] : mtd12: Volume found : update
[NOTIFY] : SWUPDATE running : [scan_ubi_volumes] : mtd4: Volume found : recovery
ubi3 error: ubi_read_volume_table: the layout volume was not found
ubi3 error: ubi_attach_mtd_dev: failed to attach mtd5, error -22
[NOTIFY] : SWUPDATE failed [0] ERubi3 error: ubi_read_volume_table: the layout volume was not found
ROR corelib/mtd-interface.c : scaubi3 error: ubi_attach_mtd_dev: failed to attach mtd6, error -22
n_ubi_partitions : 233 : cannot attach mtd5 - maybe not a NAND or raw device
[NOTIFY] : SWUPDATE failed [0] ERROR corelib/mtd-interface.c : scan_ubi_partitions : 233 : cannot attach mtd6 - maybe not a NAND or raw device
[NOTIFY] : SWUPDATE running : [scan_ubi_volumes] : mtd7: Volume found : rootfs
ubi5 error: ubi_read_volume_table: the layout volume was not found
ubi5 error: ubi_attach_mtd_dev: failed to attach mtd9, error -22
[NOTIFY] : SWUPDATE failed [0] ERROR corelib/mtd-interface.c : scan_ubi_partitions : 233 : cannot attach mtd9 - maybe not a NAND or raw device
ubi5 error: ubi_read_volume_table: the layout volume was not found
ubi5 error: ubi_attach_mtd_dev: failed to attach mtd10, error -22
[NOTIFY] : SWUPDATE failed [0] ERROR corelib/mtd-interface.c : scan_ubi_partitions : 233 : cannot attach mtd10 - maybe not a NAND or raw device
ubi5 error: ubi_read_volume_table: the layout volume was not found
ubi5 error: ubi_attach_mtd_dev: failed to attach mtd11, error -22
[NOTIFY] : SWUPDATE failed [0] ERROR corelib/mtd-interface.c : scan_ubi_partitions : 233 : cannot attach mtd11 - maybe not a NAND or raw device
[NOTIFY] : SWUPDATE running : [install_single_image] : Found installer for stream test rawfile
[NOTIFY] : SWUPDATE running : [install_raw_file] : Installing file test on /bin

[NOTIFY] : SWUPDATE failed [0] ERROR core/util.c : openfileoutput : 126 : I cannot open /bin 21

[NOTIFY] : SWUPDATE failed [0] ERROR core/cpio_utils.c : copy_write : 96 : cannot write 26 bytes
[NOTIFY] : SWUPDATE failed [0] ERROR handlers/raw_handler.c : install_raw_file : 87 : Error copying extracted file

[NOTIFY] : SWUPDATE running : [install_single_image] : Installer for rawfile not successful !
Software updated failed
[RECOVERY] [ERROR] Error executing the firmware update
[RECOVERY] The system will now reboot in 10 seconds
reboot: Restarting system

After I tried to use the meta-swupdate layer directly as following:

  • I added swupdate package to the Rootfs

  • Create a test file under /bin (otherwise I face the same issue of: I cannot open /bin 21)

  • sw-description content’s:
    software =
    {
    version = “0.0.1”;

    files: (
    {
    filename = “test”;
    path = “/bin/test”;
    }
    );
    }

  • Executing these commands on host machine:

export FILES=“sw-description test”

for i in $FILES; do echo $i; done | cpio -ov -H crc > dey-image-tiny-swu-ccimx6ulstarter.swu

  • Then install the .swu on the device:

swupdate dey-image-tiny-swu-ccimx6ulstarter.swu

  • And it WORKS the file test content is updated.

My question is how to use the DIGI mechanism to firmware update single files copy instead of images ? (I suppose that there are changes to put on swu.inc file but how ?)

And how to apply the trustfense secure firmware update to this mechanism by files ?

Thanks in advance.

Regards.

YC

has anybody an idea how to solve this issue please ?