Double-copy Swupdate system: download .swu file to inactive partition

1,126 views
Skip to first unread message

Adrian McGrath

unread,
Apr 13, 2016, 4:27:13 AM4/13/16
to swup...@googlegroups.com
Hi Stefano

I had a look through the posts and didn't see an answer to this question so please accept my apologies if this question has been asked before.


I've got my double-copy swupdate system configured with 4x partitions {boot, rootfs, rootfs-bkup and userdata} and it appears to be working well.

The "active" rootfs being used is /dev/mmcblk2p2. When I create my .swu file it uses the sw-description file as shown below. As you can see the sw-description file states that updates should be downloaded into the currently "inactive" partition (/dev/mmcblk2p3).

So long as the system continues to boot from /dev/mmcblk2p2 any update will work as intended.

However, should a fault occur on /dev/mmcblk2p2 and the user switches to the back-up rootfs on /dev/mmcblk2p3 this .swu file update will fail. This will mean that a new .swu file will need to be generated to download into /dev/mmcblk2p2. This behaviour is not desirable as I do not want to have to interrogate a users system before performing an update and potentially have to create another .swu image.

My question is, is it possible to edit the sw-description file so that the .swu file will automatically download to the inactive partition?

Many thanks

Adrian


File: sw-description
software =
{
    version = "1.9.102";

    hardware-compatibility: [ "1.0", "1.1" ];

    images: (
        {
            filename = "vblade-image-imx6qswan.ext3";
            device = "/dev/mmcblk2p3";
            type = "raw";
            installed-directly = true;
        }
    );
}

Stefano Babic

unread,
Apr 13, 2016, 4:57:00 AM4/13/16
to Adrian McGrath, swup...@googlegroups.com
Hi Adrian,

On 13/04/2016 10:27, Adrian McGrath wrote:
> Hi Stefano
>
> I had a look through the posts and didn't see an answer to this question
> so please accept my apologies if this question has been asked before.
>

Ok, it is..

>
> I've got my double-copy swupdate system configured with 4x partitions
> {boot, rootfs, rootfs-bkup and userdata} and it appears to be working well.
>
> The "active" rootfs being used is /dev/mmcblk2p2. When I create my .swu
> file it uses the sw-description file as shown below. As you can see the
> sw-description file states that updates should be downloaded into the
> currently "inactive" partition (/dev/mmcblk2p3).
>
> So long as the system continues to boot from /dev/mmcblk2p2 any update
> will work as intended.
>
> However, should a fault occur on /dev/mmcblk2p2 and the user switches to
> the back-up rootfs on /dev/mmcblk2p3 this .swu file update will fail.
> This will mean that a new .swu file will need to be generated to
> download into /dev/mmcblk2p2. This behaviour is not desirable as I do
> not want to have to interrogate a users system before performing an
> update and potentially have to create another .swu image.

This is not possible and should never be done - the user does not need
to know where the software runs. Just the target knows.

>
> My question is, /is it possible to edit the sw-description file so that
> the .swu file will ///automatically /download to the inactive partition? /

You have not set swupdate for double-copy, you have just set 4 partitions.

You have to write sw-description for "Software collection" - see in
documentation. swupdate must contains description for *both* copies.
This means you have to describe how software is installed in both cases:
how software must be installed on /dev/mmcblk2p2 and how on /dev/mmcblk2p3.

The active copy is never detected by swupdate and should be passed as
command line parameters (See -e <sel> in documentation). You pass with
"-e" which copy must be installed, that is you pass the stand-by copy.

Checks also "multi-copy" in the examples directory.

Best regards,
Stefano Babic

>
> Many thanks
>
> Adrian
>
>
> _*File: sw-description*_
> software =
> {
> version = "1.9.102";
>
> hardware-compatibility: [ "1.0", "1.1" ];
>
> images: (
> {
> filename = "vblade-image-imx6qswan.ext3";
> device = "/dev/mmcblk2p3";
> type = "raw";
> installed-directly = true;
> }
> );
> }
>
> --
> 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
=====================================================================

Topper

unread,
Jun 23, 2022, 3:50:27 AM6/23/22
to swupdate

Stefano Babic

unread,
Jun 24, 2022, 5:00:32 AM6/24/22
to Topper, swupdate
On 23.06.22 09:50, Topper wrote:
> I think such script can do the job easily
> https://github.com/varigit/meta-variscite-fslc/blob/thud/dynamic-layers/swupdate/var-image-swu/update.sh

This is a hack, breaks the streaming (because pre install scripts cannot
run in streamin mode), breaks atomicity and raises security issues.

You should do the right way instead of the easy way. Last SWUpdate's
version make easy to identify the running partition / device, see
swupdate --get-root, that is available to the Lua API for embedded
scripts, too.

Best regards,
Stefano Babic
> <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 <tel:+49%208142%206698953> Fax:
> +49-8142-66989-80 <tel:+49%208142%206698980> Email: 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/swupdate/d4682478-66db-4e98-a7df-c03ee94b9ac1n%40googlegroups.com
> <https://groups.google.com/d/msgid/swupdate/d4682478-66db-4e98-a7df-c03ee94b9ac1n%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany

Topper

unread,
Jun 24, 2022, 5:03:24 AM6/24/22
to swupdate
Good to know that Stefano,
I'm afraid cant update to latest SWUpdate even I want to, cause some cross dependancy hell in Yocto 2.6 (and vendor meta-layer, error in bootloader tools)
How can we do it right way with v.2018  ?
Reply all
Reply to author
Forward
0 new messages