Not getting .swu file - OTA in imx8ulp-evk9

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Not getting .swu file - OTA in imx8ulp-evk9

2,722 Views
dhruvinrajpura
Contributor III

I am trying to enable OTA(software update) in IMX8ULP-EVK9

Till now I was following documents attached
https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/SWUpdate-OTA-i-MX8MM-EVK-i-MX8QXP-MEK/ta...

I have normal yocto build for imx8ulp-evk9 in that
I cloned 
git clone https://github.com/sbabic/meta-swupdate.git -b mickledore
git clone https://github.com/nxp-imx-support/meta-swupdate-imx.git -b mickledore_6.1.36_2.1.0

and I added below in imx-setup-release.sh
  
+echo "BBLAYERS += \"\${BSPDIR}/sources/meta-swupdate\"" >> $BUILD_DIR/conf/
bblayers.conf
+echo "BBLAYERS += \"\${BSPDIR}/sources/meta-swupdate-imx\"" >> $BUILD_DIR/
conf/bblayers.conf

+echo "IMAGE_INSTALL:append = \" lua swupdate swupdate-www swupdate-progress
swupdate-client swupdate-tools-ipc u-boot-imx u-boot-fw-utils systemd-swusys
json-c\"" >> conf/local.conf
+echo "IMAGE_FSTYPES = \" ext4 ext4.gz wic.bmap wic.gz\"" >> conf/local.conf


and I build and in the images folder I am not able to see any .swu image but some image contain swu in their name

./swupdate-image-imx8ulp-9x9-lpddr4-evk-20240715151536.rootfs.ext4
./swupdate-image-imx8ulp-9x9-lpddr4-evk.manifest
./swupdate-image-imx8ulp-9x9-lpddr4-evk.cpio.gz.u-boot
./swupdate-image-imx8ulp-9x9-lpddr4-evk.ext4
./swupdate-image-imx8ulp-9x9-lpddr4-evk-20240715151536.testdata.json
./swupdate-image-imx8ulp-9x9-lpddr4-evk-20240715151536.rootfs.manifest
./swupdate-image-imx8ulp-9x9-lpddr4-evk-20240715151536.rootfs.cpio.gz.u-boot
./swupdate-image-imx8ulp-9x9-lpddr4-evk.testdata.json
./swupdate-image-imx8ulp-9x9-lpddr4-evk-20240715151536.rootfs.ext4.gz.u-boot
./swupdate-image-imx8ulp-9x9-lpddr4-evk.ext4.gz.u-boot


How can I generate .swu image because with these changes I can open webpage where I need to upload image but I am not able to generate that image which required for software update.

0 Kudos
Reply
6 Replies

2,683 Views
dhruvinrajpura
Contributor III

I made progress in it.

To generate swu file I taken
imx-image-core-imx8ulp-9x9-lpddr4-evk-20240716174730.rootfs.ext4
Image
u-boot-imx8ulp-9x9-lpddr4-evk.bin

and made sw-description file

software =
{
    version = "1.0";
    description = "Firmware update example";
    hardware-compatibility: [ "1.0", "1.2", "1.3"];
    imx8ulpevk: {
        images: (
            {
                filename = "rootfs.ext4";
                sha256 = "SHA256_CHECKSUM_OF_ROOTFS";
                compressed = "zlib";
                device = "/dev/mmcblk1p2";
                installed-directly = true;
                hook = "preinst";
            },
            {
                filename = "uImage";
                sha256 = "SHA256_CHECKSUM_OF_UIMAGE";
                device = "/dev/mmcblk1p1";
                installed-directly = true;
            },
            {
                filename = "u-boot.bin";
                sha256 = "SHA256_CHECKSUM_OF_UBOOT";
                device = "/dev/mmcblk0boot0";
                installed-directly = true;
            }
        );
        scripts: (
            {
                filename = "env_set_bootslot.sh";
                sha256 = "SHA256_CHECKSUM_OF_SCRIPT";
                type = "postinstall";
            }
        );
    }
}

 

 

and made env_set_bootslot.sh

#!/bin/sh

# Get the current boot slot
CURRENT_SLOT=$(fw_printenv -n boot_slot)

# Toggle the boot slot
if [ "$CURRENT_SLOT" = "A" ]; then
    NEW_SLOT="B"
else
    NEW_SLOT="A"
fi

# Set the new boot slot
fw_setenv boot_slot $NEW_SLOT

# Update other related environment variables if necessary
fw_setenv boot_partition /dev/mmcblk0p${NEW_SLOT}

 

and ran below generate_swu.sh

#!/bin/bash
MODE="RSA-PKCS-1.5"
PRODUCT_NAME="myproduct"
CONTAINER_VER="1.0"
IMAGES="rootfs.ext4 uImage u-boot.bin env_set_bootslot.sh"
FILES="sw-description sw-description.sig $IMAGES"

# Sign the sw-description
if [ x"$MODE" == "xRSA-PKCS-1.5" ]; then
  openssl dgst -sha256 -sign priv.pem sw-description > sw-description.sig
elif [ x"$MODE" == "xRSA-PSS" ]; then
  openssl dgst -sha256 -sign priv.pem -sigopt rsa_padding_mode:pss \
  -sigopt rsa_pss_saltlen:-2 sw-description > sw-description.sig
else
  openssl cms -sign -in sw-description -out sw-description.sig -signer mycert.cert.pem \
  -inkey mycert.key.pem -outform DER -nosmimecap -binary
fi

# Package the files into a SWU container
for i in $FILES; do
  echo $i
done | cpio -ov -H crc > ${PRODUCT_NAME}_${CONTAINER_VER}.swu

 

 

than image is generated with .swu extention

but when I update it on webserver it is giving logs like

[network_thread] : Incoming network request: processing...

Software Update started !

[network_initializer] : Software update started

[extract_file_to_tmp] : Found file

[extract_file_to_tmp] : filename sw-description

[extract_file_to_tmp] : size 1086

[extract_file_to_tmp] : Found file

[extract_file_to_tmp] : filename sw-description.sig

[extract_file_to_tmp] : size 256

[swupdate_verify_file] : Verify signed image: Read 1086 bytes

ERROR swupdate_rsa_verify.c : verify_final : 99 : EVP_DigestVerifyFinal failed, error 0x200008a 0

[swupdate_verify_file] : Error Verifying Data

ERROR stream_interface.c : extract_files : 183 : Compatible SW not found

Image invalid or corrupted. Not installing ...

[network_initializer] : Main thread sleep again !

Waiting for requests...

ERROR mongoose_interface.c : upload_handler : 625 : Writing to IPC fails due to Broken pipe

[network_thread] : Incoming network request: processing...

Software Update started !

[network_initializer] : Software update started

[extract_file_to_tmp] : Found file

[extract_file_to_tmp] : filename sw-description

[extract_file_to_tmp] : size 1086

[extract_file_to_tmp] : Found file

[extract_file_to_tmp] : filename sw-description.sig

[extract_file_to_tmp] : size 256

[swupdate_verify_file] : Verify signed image: Read 1086 bytes

ERROR swupdate_rsa_verify.c : verify_final : 99 : EVP_DigestVerifyFinal failed, error 0x200008a 0

[swupdate_verify_file] : Error Verifying Data

ERROR stream_interface.c : extract_files : 183 : Compatible SW not found

Image invalid or corrupted. Not installing ...

[network_initializer] : Main thread sleep again !

Waiting for requests...


Is this correct way to build swu image?

0 Kudos
Reply

2,637 Views
jimmychan
NXP TechSupport
NXP TechSupport
0 Kudos
Reply

2,566 Views
dhruvinrajpura
Contributor III

@jimmychan 

In the link you provided I am not getting how that guy has solved issue there is no description overthere,

Can you provide step by step guide to generate .swu image in the yocto system of imx8ulp-evk9, I already followed some documents but there is no specific sw-description file avilable for imx8ulp-evk9.

0 Kudos
Reply

2,628 Views
dhruvinrajpura
Contributor III

Hello @jimmychan 

Thanks for response,

I want to generate .swu image inside yocto it self I prepared yocto environment to build imx8ulp-evk9 build and in that I added meta-swupdate and meta-swupdate-imx layer and build but I am not getting image inside.

I found that we need to add bbclasses available inside meta-swupdate and need to add sw-description file and sign mechanism and then we need to build yocto and then we can get .swu image inside.

Can you provide me steps to follow above procedure like sw-description file for imx8ulp-evk9 and changes require for sign mechanism, because currently if I am adding sw-decription file and build than in the swu file there is no sw-description.sig file available so I am not able to upload it on mongoose web page because it is looking for sw-description.sig file, Do we have any proper steps that I can follow in yocto?

0 Kudos
Reply

2,688 Views
dhruvinrajpura
Contributor III
0 Kudos
Reply