[swupdate] uboot env applied even if image skipped

621 views
Skip to first unread message

TEIR Sid-Ali

unread,
Mar 28, 2017, 6:11:33 PM3/28/17
to swup...@googlegroups.com
Hi,

I noticed that uboot environment variables are updated even if the image install has been skipped due to same installed version on the current active rootfs :

I am using a derived version of this sw-description : https://github.com/sbabic/swupdate/blob/master/examples/description/multi-copy

example:

- sw-description:
software =
{
hardware-compatibility = [ "revA" ];
stable:
{
alt:
{
images: (
{
filename = "rootfs.ext3";
device = "/dev/mmcblk0p2";
name = "rootfs";
version = "0.1";
install-if-different = true;
}
);

uboot: (
{
name = "bootfs";
value = "/dev/mmcblk0p2";
}
);
};
main:
{
[...] (same as above except with /dev/mmcblk0p1")
};
};
}

- /etc/sw-version:
rootfs 0.1

If I decide to install the update with " -e stable,alt", the rootfs image is skipped because the version is the same as /etc/sw-versions, however uboot environment variable "bootfs" is updated to /dev/mmcblk0p2 so I will have the system rebooting into the new rootfs partition even if no rootfs has been installed.
Am I using the feature correctly ? or is this the correct behavior ?

Regards,
Sid-Ali.

Stefano Babic

unread,
Mar 29, 2017, 2:26:11 AM3/29/17
to TEIR Sid-Ali, swup...@googlegroups.com
Hi Sid-Ali,

On 29/03/2017 00:12, TEIR Sid-Ali wrote:
> Hi,
>
> I noticed that uboot environment variables are updated even if the image install has been skipped due to same installed version on the current active rootfs :
>

Yes, this is wanted. The install was not "skipped", it was "successful",
just it is noted that it is not necessary to reflash the storage. This
is mostly used in case of slow storage (NOR flashes) where erase/write
takes a very long time.

> I am using a derived version of this sw-description : https://github.com/sbabic/swupdate/blob/master/examples/description/multi-copy
>
> example:
>
> - sw-description:
> software =
> {
> hardware-compatibility = [ "revA" ];
> stable:
> {
> alt:
> {
> images: (
> {
> filename = "rootfs.ext3";
> device = "/dev/mmcblk0p2";
> name = "rootfs";
> version = "0.1";
> install-if-different = true;
> }
> );
>
> uboot: (
> {
> name = "bootfs";
> value = "/dev/mmcblk0p2";
> }
> );
> };
> main:
> {
> [...] (same as above except with /dev/mmcblk0p1")
> };
> };
> }
>
> - /etc/sw-version:
> rootfs 0.1
>
> If I decide to install the update with " -e stable,alt", the rootfs image is skipped because the version is the same as /etc/sw-versions, however uboot environment variable "bootfs" is updated to /dev/mmcblk0p2 so I will have the system rebooting into the new rootfs partition even if no rootfs has been installed.
>

Yes - it is not important if it was written into /dev/mmcblk02. At the
end, the result is to have the required version installed into this
partition, and this is what you get. That means that the updater goes on
with next steps, and it calls the other handlers - in your case the
U-Boot handler.

Am I using the feature correctly ? or is this the correct behavior ?

You are using correctly and this is the correct behavior.

Best regards,
Stefano Babic

--
=====================================================================
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
=====================================================================

TEIR Sid-Ali

unread,
Mar 29, 2017, 11:43:00 AM3/29/17
to Stefano Babic, swup...@googlegroups.com
Hi Stefano,

I don't understand some points about using this strategy, I want to implement the dual-copy partition layout and I have an sd card partitioned as follow:

| | - mmcblk0p1: rootFS initial
| copy1 | /etc/sw-versions: rootfs 0.1
| |
| | - mmcblk0p5: kernel + dt initial
|-----------|
| | - mmcblk0p2: unformatted
| copy2 |
| |
| | - mmcblk0p6: unformatted

My update contains the same version of rootfs but also a new kernel + dt that will be installed in mmcblk0p6.

So the update will correctly install the new kernel + dt in mmcblk0p6, update the according uboot variables, but it will skip the rootfs, and update the rootfs uboot variable to mmcblk0p2 which is unformatted. In this case, my boot is broken.

How can I avoid this case ?

Regards,

Sid-Ali.
________________________________________
From: Stefano Babic [sba...@denx.de]
Sent: Tuesday, March 28, 2017 11:26 PM
To: TEIR Sid-Ali; swup...@googlegroups.com
Subject: Re: [swupdate] uboot env applied even if image skipped

Stefano Babic

unread,
Mar 29, 2017, 11:45:40 AM3/29/17
to TEIR Sid-Ali, Stefano Babic, swup...@googlegroups.com
Hi,

On 29/03/2017 17:43, TEIR Sid-Ali wrote:
> Hi Stefano,
>
> I don't understand some points about using this strategy, I want to implement the dual-copy partition layout and I have an sd card partitioned as follow:
>
> | | - mmcblk0p1: rootFS initial
> | copy1 | /etc/sw-versions: rootfs 0.1
> | |
> | | - mmcblk0p5: kernel + dt initial
> |-----------|
> | | - mmcblk0p2: unformatted
> | copy2 |
> | |
> | | - mmcblk0p6: unformatted
>
> My update contains the same version of rootfs but also a new kernel + dt that will be installed in mmcblk0p6.
>
> So the update will correctly install the new kernel + dt in mmcblk0p6, update the according uboot variables, but it will skip the rootfs, and update the rootfs uboot variable to mmcblk0p2 which is unformatted. In this case, my boot is broken.
>
> How can I avoid this case ?
>

Your /etc/versions is broken. It should not contain the versions of the
running systems, but the version of the stand-by copy to be updated - or
nothing if version cannot be read.

TEIR Sid-Ali

unread,
Mar 29, 2017, 12:13:23 PM3/29/17
to Stefano Babic, swup...@googlegroups.com
I understand now.
My first idea was to avoid updating if the update contains the same version as the
running one, so if I understood correctly, this is the layout I should get with an update
containing rootfs 0.2 or 0.3 :

| | - mmcblk0p1: rootFS (running 0.2)
| copy1 | /etc/sw-versions: rootfs 0.1
| |
| | - mmcblk0p5: kernel + dt initial
|-----------|
| | - mmcblk0p2: rootFS (running 0.1)
| copy2 |
| |
| | - mmcblk0p6: kernel + dt

In the end, having the same rootfs running in both partitions is not a problem.

Regards,
Sid-Ali.
________________________________________
From: Stefano Babic [sba...@denx.de]
Sent: Wednesday, March 29, 2017 8:45 AM
To: TEIR Sid-Ali; Stefano Babic; swup...@googlegroups.com
Subject: Re: [swupdate] uboot env applied even if image skipped

Reply all
Reply to author
Forward
0 new messages