Starting with swupdate

3,093 views
Skip to first unread message

Albert-Miquel

unread,
Jul 17, 2018, 7:13:08 AM7/17/18
to swup...@googlegroups.com
Hello,

I'm involved in the design phase project where the Linux is run from an SD card since right now there is not enough space available in the flash. For sure, this will change before production, but this is what I have by now. In the SD card I have two partitions, 'BOOT' (with three files, BOOT.BIN, image.ub and system.dtb) and 'rootfs'. 

My intention is to update both partitions (that is, everything) everytime a new version is released using single copy mode. To this end, I started compressing the three files of the BOOT partition in a file with the extension cpio. And did the same for the rootfs partition. My first question is: is this compressing format accepted by SWUpdate, or is it needed something different (as an image, for instance)?

The sw-description file I'm using is as follows:

software =
{
        version = "0.1";

        hardware-compatibility = [ "revA" ];

        images: (
                /* single copy mode */
                {
                        filename = "boot.cpio";
                        volume = "BOOT";
                },
                {
                        filename = "rootfs.cpio";
                        volume = "rootfs";
                }
        );
}

Again, I'm using a compressed file as an image, so it may be wrong. 

After embedding everything in a single file .swu, I tried to update the embedded Linux, obtaining the following output:

          [network_initializer] : Main loop Daemon

           Waiting for requests...

           [network_initializer] : Main thread sleep again !

           Image invalid or corrupted. Not installing ...

           ERROR corelib/stream_interface.c : extract_files : 168 : Compatible SW not found

           ERROR core/parser.c : check_handler : 90 : feature 'ubivol' required for 'boot.cpio' in sw-description is absent!

           [parse_images] : Found Image : boot.cpio in volume : BOOT for handler ubivol

           [parse_images] : Found Image : rootfs.cpio in volume : rootfs for handler ubivol

           [parse_hw_compatibility] : Accepted Hw Revision : revA

           [parse_cfg] : Version 0.1

           [extract_file_to_tmp] : Found file: filename sw-description.sig size 256

           [extract_file_to_tmp] : Found file: filename sw-description size 338

           Software Update started !

           File information: update-image-v1.swu size: 2025511424 bytes

Apparently, the image is not correct. I would like to ask you which steps are not being done correctly, which may be more than one. For instance, not sure if the three files of the BOOT partition would be better to be update them separately instead of using a single compressed file...

Any help will be really appreciated.

Regards,

Albert

Albert-Miquel

unread,
Jul 27, 2018, 7:13:41 AM7/27/18
to swup...@googlegroups.com
Hello again,

after some work, I think I'm almost at the end, but I'm still having some problem with the images. To simplify the problem, I'm working only with rootfs. Then, the sw-description file is as follows:

software =
{
        version = "0.1";

        hardware-compatibility = [ "revA" ];

        images: (
        /* single copy mode */
        {
                filename = "rootfs.ext4";
                device = "/dev/mmcblk0p2";
                type = "raw";
                sha256 = "2ae0eb5a53152f04d92addfe734ccafcb9766b32befd3266ed2092bb3ea9a866";
        }
        );
}

And the output os SWUpdate is:

[network_initializer] : Main loop Daemon

Waiting for requests...

[network_initializer] : Main thread sleep again !

Image invalid or corrupted. Not installing ...

ERROR corelib/stream_interface.c : extract_files : 173 : SW not compatible with hardware

[swupdate_verify_file] : Verified OK

[swupdate_verify_file] : Verify signed image: Read 375 bytes

[parse_images] : Found Image : rootfs.ext4 in device : /dev/mmcblk0p2 for handler raw

[parse_hw_compatibility] : Accepted Hw Revision : revA

[parse_cfg] : Version 0.1

[extract_file_to_tmp] : Found file: filename sw-description.sig size 256

[extract_file_to_tmp] : Found file: filename sw-description size 375

Software Update started !

For the generation of the image I'm using the following instructions:

dd if=/dev/zero of=rootfs.ext4 bs=1M count=2000
mkfs.ext4 rootfs.ext4
mount -o loop rootfs.ext4 /mnt
cp -ax /{bin,dev,etc,lib,root,sbin,usr,var} /mnt
mkdir /mnt/{home,proc,opt,sys,tmp}
chmod 777 /mnt/tmp
umount /mnt

Can you provide some help what's going wrong?

Thanks in advance,

Albert

Stefano Babic

unread,
Jul 27, 2018, 7:21:47 AM7/27/18
to Albert-Miquel, swup...@googlegroups.com
Hi Albert,

On 27/07/2018 13:13, Albert-Miquel wrote:
> Hello again,
>
> after some work, I think I'm almost at the end, but I'm still having
> some problem with the images. To simplify the problem, I'm working only
> with rootfs. Then, the sw-description file is as follows:
>
> software =
> {
>         version = "0.1";
>
>         hardware-compatibility = [ "revA" ];
>
>         images: (
>         /* single copy mode */
>         {
>                 filename = "rootfs.ext4";
>                 device = "/dev/mmcblk0p2";
>                 type = "raw";
>                 sha256 =
> "2ae0eb5a53152f04d92addfe734ccafcb9766b32befd3266ed2092bb3ea9a866";
>         }
>         );
> }
>
> And the output os SWUpdate is:
>
>
> [network_initializer] : Main loop Daemon
>
> Waiting for requests...
>
> [network_initializer] : Main thread sleep again !
>
> *Image invalid or corrupted. Not installing ...*
>
> ERROR corelib/stream_interface.c : extract_files : 173 : *SW not
> compatible with hardware*
>

Log is telling you loudly what happens. You have activated the hw
compatibility check. You have to inform SWUpdate which HW is running and
the same information must be in sw-description, where it is current missing.

If your board (I see you have a zynq) can be called "zynq", and you set
"revA", you should start swupdate with "-H zynq:revA"

See
http://sbabic.github.io/swupdate/sw-description.html?highlight=hardware#hardware-compatibility



> [swupdate_verify_file] : Verified OK
>
> [swupdate_verify_file] : Verify signed image: Read 375 bytes
>
> [parse_images] : Found Image : rootfs.ext4 in device :
> /dev/mmcblk0p2 for handler raw
>
> [parse_hw_compatibility] : Accepted Hw Revision : revA
>
> [parse_cfg] : Version 0.1
>
> [extract_file_to_tmp] : Found file: filename sw-description.sig size 256
>
> [extract_file_to_tmp] : Found file: filename sw-description size 375
>
> Software Update started !
>
>
> For the generation of the image I'm using the following instructions:
>
> dd if=/dev/zero of=rootfs.ext4 bs=1M count=2000
> mkfs.ext4 rootfs.ext4
> mount -o loop rootfs.ext4 /mnt
> cp -ax /{bin,dev,etc,lib,root,sbin,usr,var} /mnt
> mkdir /mnt/{home,proc,opt,sys,tmp}
> chmod 777 /mnt/tmp
> umount /mnt

This is just a hack without any build system and should not be used in
production.

>
> Can you provide some help what's going wrong?

Best regards,
Stefano Babic


>
> Thanks in advance,
>
> Albert
>
> 2018-07-17 13:13 GMT+02:00 Albert-Miquel <wuampa...@gmail.com
> <mailto:wuampa...@gmail.com>>:
> --
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+u...@googlegroups.com
> <mailto:swupdate+u...@googlegroups.com>.
> To post to this group, send email to swup...@googlegroups.com
> <mailto:swup...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.


--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=====================================================================

Albert-Miquel

unread,
Jul 27, 2018, 7:42:45 AM7/27/18
to Stefano Babic, swup...@googlegroups.com
Thank you very much, it worked!!!

Not sure how you know I'm using a zynq, but I'll accept you are something close to a magician.

Anyway, and I didn't want to hack anything. If this is not a suitable way to generate an image, how should it be done? Not needed to say I'm a newbie...

Regards,

Albert


> To post to this group, send email to swup...@googlegroups.com

Stefano Babic

unread,
Jul 27, 2018, 8:08:45 AM7/27/18
to Albert-Miquel, Stefano Babic, swup...@googlegroups.com
Hi Albert,

On 27/07/2018 13:42, Albert-Miquel wrote:
> Thank you very much, it worked!!!
>
> Not sure how you know I'm using a zynq, but I'll accept you are
> something close to a magician.
>

Yes, this is a kind of magic...

> Anyway, and I didn't want to hack anything. If this is not a suitable
> way to generate an image, how should it be done? Not needed to say I'm a
> newbie...

You need a buildsystem to generate your embedded system, or at least, to
make it reproducible. The most known buildsystems for embedded linux are
buildroot and Yocto. Xilinx supports Yocto and has released meta-layers
for the zynq processors, search for meta-xilinx and meta-silinx-tools.

Best regards,
Stefano Babic

>
> Regards,
>
> Albert
>
> 2018-07-27 13:21 GMT+02:00 Stefano Babic <sba...@denx.de
> <mailto:sba...@denx.de>>:
> > <mailto:wuampa...@gmail.com <mailto:wuampa...@gmail.com>>>:
> > an email to swupdate+u...@googlegroups.com
> <mailto:swupdate%2Bunsu...@googlegroups.com>
> > <mailto:swupdate+u...@googlegroups.com
> <mailto:swupdate%2Bunsu...@googlegroups.com>>.
> > To post to this group, send email to swup...@googlegroups.com <mailto:swup...@googlegroups.com>
> > <mailto:swup...@googlegroups.com <mailto:swup...@googlegroups.com>>.
> > For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>.
>
>
> --
> =====================================================================
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email:
> sba...@denx.de <mailto:sba...@denx.de>
> =====================================================================
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+u...@googlegroups.com
> <mailto:swupdate+u...@googlegroups.com>.
> To post to this group, send email to swup...@googlegroups.com
> <mailto:swup...@googlegroups.com>.

Albert-Miquel

unread,
Aug 24, 2018, 7:37:08 AM8/24/18
to Stefano Babic, swup...@googlegroups.com
Hello  Stefano,

thank you very much for your kind help. One additional question. The following error means there is not enough space in flash to extract the image or is it a different problem?

[network_initializer] : Main loop Daemon
Waiting for requests...
Installation failed !
[network_initializer] : Main thread sleep again !
[install_single_image] : Installer for raw not successful !
ERROR core/cpio_utils.c : fill_buffer : 64 : Failure in stream 9: Input/output error
[install_single_image] : Found installer for stream rootfs.ext4 raw
Installation in progress
[network_initializer] : Valid image found: copying to FLASH
[extract_files] : Found file: filename rootfs.ext4 size 2097152000 required
[extract_files] : Found file: filename SWUpdate size 12 Not required: skipping
[check_hw_compatibility] : Hardware compatibility verified
[check_hw_compatibility] : Hardware zynq Revision: revA
[swupdate_verify_file] : Verified OK
[swupdate_verify_file] : Verify signed image: Read 345 bytes
[parse_images] : Found Image : rootfs.ext4 in device : /dev/mmcblk0p2 for handler raw
[parse_hw_compatibility] : Accepted Hw Revision : revA
[parse_cfg] : Version 0.1
[extract_file_to_tmp] : Found file: filename sw-description.sig size 256
[extract_file_to_tmp] : Found file: filename sw-description size 345
Software Update started !

In the console I can see:

[TRACE] : SWUPDATE running :  [network_initializer] : Valid image found: copying to FLASH
[INFO ] : SWUPDATE running :  Installation in progress
[TRACE] : SWUPDATE running :  [install_single_image] : Found installer for stream rootfs.ext4 raw
[ERROR] : SWUPDATE failed [0] ERROR core/cpio_utils.c : fill_buffer : 64 : Failure in stream 9: Input/output error
[TRACE] : SWUPDATE running :  [install_single_image] : Installer for raw not successful !
[ERROR] : SWUPDATE failed [1] Installation failed !
[TRACE] : SWUPDATE running :  [network_initializer] : Main thread sleep again !
[INFO ] : No SWUPDATE running :  Waiting for requests...
[TRACE] : SWUPDATE running :  [network_initializer] : Main loop Daemon

Thanks again,

Albert

Missatge de Stefano Babic <sba...@denx.de> del dia dv., 27 de jul. 2018 a les 14:08:

Stefano Babic

unread,
Aug 24, 2018, 8:25:17 AM8/24/18
to Albert-Miquel, Stefano Babic, swup...@googlegroups.com
Hi Albert,

On 24/08/2018 13:37, Albert-Miquel wrote:
> Hello  Stefano,
>
> thank you very much for your kind help. One additional question. The
> following error means there is not enough space in flash to extract the
> image or is it a different problem?
>
> [network_initializer] : Main loop Daemon
>
> Waiting for requests...
>
> Installation failed !
>
> [network_initializer] : Main thread sleep again !
>
> [install_single_image] : Installer for raw not successful !
>
> ERROR core/cpio_utils.c : fill_buffer : 64 : Failure in stream
> 9: Input/output error

This error is coming from read(). The SWU cannot be read or there is
such kind of problem.

>
> [install_single_image] : Found installer for stream rootfs.ext4 raw
>
> Installation in progress
>
> [network_initializer] : Valid image found: copying to FLASH
>
> [extract_files] : Found file: filename rootfs.ext4 size
> 2097152000 required

So your rootfs is 2GB...
Best regards,
Stefano Babic

> Thanks again,
>
> Albert
>
> Missatge de Stefano Babic <sba...@denx.de <mailto:sba...@denx.de>> del
> dia dv., 27 de jul. 2018 a les 14:08:
>
> Hi Albert,
>
> On 27/07/2018 13:42, Albert-Miquel wrote:
> > Thank you very much, it worked!!!
> >
> > Not sure how you know I'm using a zynq, but I'll accept you are
> > something close to a magician.
> >
>
> Yes, this is a kind of magic...
>
> > Anyway, and I didn't want to hack anything. If this is not a suitable
> > way to generate an image, how should it be done? Not needed to say
> I'm a
> > newbie...
>
> You need a buildsystem to generate your embedded system, or at least, to
> make it reproducible. The most known buildsystems for embedded linux are
> buildroot and Yocto. Xilinx supports Yocto and has released meta-layers
> for the zynq processors, search for meta-xilinx and meta-silinx-tools.
>
> Best regards,
> Stefano Babic
>
> >
> > Regards,
> >
> > Albert
> >
> > 2018-07-27 13:21 GMT+02:00 Stefano Babic <sba...@denx.de
> <mailto:sba...@denx.de>
> > <mailto:sba...@denx.de <mailto:sba...@denx.de>>>:
> >     <mailto:swupdate%2Bunsu...@googlegroups.com
> <mailto:swupdate%252Buns...@googlegroups.com>>
> >     > <mailto:swupdate+u...@googlegroups.com
> <mailto:swupdate%2Bunsu...@googlegroups.com>
> >     <mailto:swupdate%2Bunsu...@googlegroups.com
> <mailto:swupdate%252Buns...@googlegroups.com>>>.
> >     > To post to this group, send email to
> swup...@googlegroups.com <mailto:swup...@googlegroups.com>
> <mailto:swup...@googlegroups.com <mailto:swup...@googlegroups.com>>
> >     > <mailto:swup...@googlegroups.com
> <mailto:swup...@googlegroups.com> <mailto:swup...@googlegroups.com
> <mailto:swup...@googlegroups.com>>>.
> >     > For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
> >
> >
> >     --
> >   
>  =====================================================================
> >     DENX Software Engineering GmbH,      Managing Director:
> Wolfgang Denk
> >     HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell,
> Germany
> >     Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email:
> >     sba...@denx.de <mailto:sba...@denx.de> <mailto:sba...@denx.de
> <mailto:sba...@denx.de>>
> >   
>  =====================================================================
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "swupdate" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to swupdate+u...@googlegroups.com

Vishnudas N Kartha

unread,
Oct 4, 2023, 8:11:08 AM10/4/23
to swupdate
Hi Team,

Something similar is happening to my update too.

I will brief what i am doing. 

In my board (/home/root/) I have a file named "File.txt"

As a start i am trying to update this file.

My Swupdate description (sw-description) file looks like this:  






software =
{
version = "1.2";
hardware-compatibility: [ "1" ];
files: (
        {
                filename = "File.txt";
                path = "/home/root/File.txt";
        }
);
}






I have a file called hwrevision in my board (/etc/):

its content is: "1"

For the generation of .swu file I am using the below script (generate_swu-1.sh):  






#!/bin/bash

CONTAINER_VER="1.2"
PRODUCT_NAME="vishnuUpdate"
FILES="sw-description File.txt"

#openssl dgst -sha256 -sign swupdate-priv.pem sw-description > sw-description.sig

for i in $FILES;do
        echo $i;done | cpio -ov -H crc >  ${PRODUCT_NAME}_${CONTAINER_VER}.swu






After running the script I am getting  this "vishnuUpdate_1.2.swu" file, which I copy to a USB and plug to my device.

After mounting the USB, and entering into the USB I run this command:

swupdate -i vishnuUpdate_1.2.swu

But the following errors are produced:

SWUpdate v2023.05

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

[INFO ] : SWUPDATE started :  Software Update started !
[ERROR] : SWUPDATE failed [0] ERROR : SW not compatible with hardware
[ERROR] : SWUPDATE failed [1] Image invalid or corrupted. Not installing ...

[INFO ] : No SWUPDATE running :  Waiting for requests...
[ERROR] : SWUPDATE failed [0] ERROR : SWUpdate *failed* !


I don't know if i am missing something I am very new to these topics....

Please help me to solve this. 
Reply all
Reply to author
Forward
0 new messages