Corrupted PEB errors in SW update

7 views
Skip to first unread message

Chandrasekaran, Manonmani

unread,
Nov 23, 2022, 8:47:07 AM11/23/22
to swup...@googlegroups.com

Hi Team,

 

We are using swupdate to update rootfs of our device.

 

We are able to update rootfs on any one partition one time, and after reboot if try for another partition it is going to corrupted flash block state.

 

Example (One scenario) :

 

  1. Panel booted with "/dev/mtd8”. Copying swu file to temp(RAM) directory.
  2. Running below command
    1. swupdate -v -i rootfs_1.1.swu -H Multi:1.0 -e stable,copy2 -f /etc/swupdate.cfg &
  3. The above command flashing rootfs on "/dev/mtd9” and updating bootargs, so in next boot panel will up from “"/dev/mtd9”
  4. Now panel booted from second partition. Again we are trying to flash rootfs in first partition "/dev/mtd8” using below command
    1. swupdate -v -i rootfs_1.1.swu -H Multi:1.0 -e stable,copy1 -f /etc/swupdate.cfg &
  5. This time getting below corrupted PEBs errors.

Text

Description automatically generated

 

SW description :

 

software =

{

              version = "0.1";

             

              Multi = {

                             hardware-compatibility:["1.0"];

                             stable : {

                                           copy1 : {

                                                          images : (

                                                                        {

                                                                                      filename = "rootfs_sw.ubi";

                                                                                      type = "flash";

                                                                                      device = "/dev/mtd8";

                                                                        }

                                                          );

                                                          scripts : (

                                                                        {

                                                                                      filename = "post_install.sh";

                                                                                      type = "postinstall";

                                                                        }

                                                          );

                                                          bootenv : (

                                                                        {

                                                                                                     name = "rootfspart";

                                                                                                     value = "9";

                                                                        },

                                                                        {

                        name = "bootargs";

                        value = "console=ttymxc3,115200 root=ubi0:rootfs rw rootwait ubi.mtd=8 ubi.mtd=10 rootfstype=ubifs";

                                                                        },

                                                                        {

                        name = "bootargs_nor";

                        value = "console=ttymxc3,115200 root=ubi0:rootfs rw rootwait ubi.mtd=8 ubi.mtd=10 rootfstype=ubifs";

                                                                        }

                                                          );

                                           };

                                           copy2 : {

                                                          images : (

                                                                        {

                                                                                      filename = "rootfs_sw.ubi";

                                                                                      type="flash";

                                                                                      device="/dev/mtd9";

                                                                        }

                                                          );

                                                          scripts : (

                                                                        {

                                                                                      filename = "post_install.sh";

                                                                                      type = "postinstall";

                                                                        }

                                                          );

                                                          bootenv : (

                                                                        {

                                                                                                     name = "rootfspart";

                                                                                                     value = "8";

                                                                        },

                                                                        {

                        name = "bootargs";

                        value = "console=ttymxc3,115200 root=ubi0:rootfs rw rootwait ubi.mtd=9 ubi.mtd=10 rootfstype=ubifs";

                                                                        },

                                                                        {

                        name = "bootargs_nor";

                        value = "console=ttymxc3,115200 root=ubi0:rootfs rw rootwait ubi.mtd=9 ubi.mtd=10 rootfstype=ubifs";

                                                                        }

                                                          );

                                           };

                             };

              };           

};

 

 

Commands used to update rootfs :

 

swupdate -v -i rootfs_1.1.swu -H Multi:1.0 -e stable,copy2 -f /etc/swupdate.cfg &

swupdate -v -i rootfs_1.1.swu -H Multi:1.0 -e stable,copy1 -f /etc/swupdate.cfg &

 

We initially throught flash might not happened properly, so give sometime to flash the rootfs properly, we added sleep in post_install scripts. But that also did not work.

 

Post_install.sh :

 

#!/bin/sh

 

sleep 60

echo "Running post install scripts. reboot now"

 

# SW_STATUS=$(fw_printenv recovery_status)

# while [ "$SW_STATUS" == "recovery_status=in_progress" ]

# do

              # sleep 5

              # SW_STATUS=$(fw_printenv recovery_status)

              # echo $(fw_printenv recovery_status)

              # echo "Sleep for 5more min"

# done

 

echo $(fw_printenv recovery_status)

reboot

 

Could you check our above config files & scripts and please revert back for the missing details.

 

Thanks & Regards,

Manonmani

 

 

Stefano Babic

unread,
Nov 23, 2022, 10:31:33 AM11/23/22
to Chandrasekaran, Manonmani, swup...@googlegroups.com
Hi Manonmani,

On 23.11.22 14:47, 'Chandrasekaran, Manonmani' via swupdate wrote:
> Hi Team,
>
> We are using swupdate to update rootfs of our device.
>
> We are able to update rootfs on any one partition one time, and after
> reboot if try for another partition it is going to corrupted flash block
> state.
>
> *Example (One scenario) :*
>
> 1. Panel booted with "/dev/mtd8”. Copying swu file to temp(RAM) directory.
> 2. Running below command
> 1. swupdate -v -i rootfs_1.1.swu -H Multi:1.0 -e stable,copy2 -f
> /etc/swupdate.cfg &
> 3. The above command flashing rootfs on "/dev/mtd9” and updating
> bootargs, so in next boot panel will up from “"/dev/mtd9”
> 4. Now panel booted from second partition. Again we are trying to flash
> rootfs in first partition "/dev/mtd8” using below command
> 1. swupdate -v -i rootfs_1.1.swu -H Multi:1.0 -e stable,copy1 -f
> /etc/swupdate.cfg &
> 5. This time getting below corrupted PEBs errors.
>
> Text Description automatically generated
>

If your read the complete line, it says "corrupted PEB = 0".

It looks like you have not read the documentation - please do it carefully:

http://sbabic.github.io/swupdate/handlers.html?highlight=ubi

If you have a UBI volume, it should be treated as UBI and not like raw
flash.

There are several other errors in your setup:

- it seems to me you have multiple MTD devices on the same NAND. This is
wrong, it is not like a NOR flash. You have split your NAND by multiple
MTD devices instead of using multiple and configurable volumes. You
waste space, layout is fixed, and wear levelling on the NAND is not
working correctly.

- you are using (again, read the docs !) "flash" handler to update. I am
just surprised nthat sometimes works. It just depends if some LEBs must
be moved, it looks like that your NAND is a fresh chip. After some time,
even updating on "/dev/mtd8" shouldn't work.

- you are copying (??) the whole SWU on tmpfs. This is wrong, it
consumes a lot of memory that are not available anymore to the
application. And because streaming is not enabled in sw-description,
SWUpdate will extract again artifacts to tmpfs, so the SWU is really
copied twice.

- reboot should not be part of a postinstall script. If SWUpdate should
reboot, add "-p" to swupdate.

Best regards,
Stefano Babic


> *SW description :*
> *Commands used to update rootfs :*
>
> **
>
> /swupdate -v -i rootfs_1.1.swu -H Multi:1.0 -e stable,copy2 -f
> /etc/swupdate.cfg &/
>
> /swupdate -v -i rootfs_1.1.swu -H Multi:1.0 -e stable,copy1 -f
> /etc/swupdate.cfg &/
>
> We initially throught flash might not happened properly, so give
> sometime to flash the rootfs properly, we added sleep in post_install
> scripts. But that also did not work.
>
> *Post_install.sh :*
>
> /#!/bin/sh/
>
> //
>
> /sleep 60/
>
> /echo "Running post install scripts. reboot now"/
>
> //
>
> /# SW_STATUS=$(fw_printenv recovery_status)/
>
> /# while [ "$SW_STATUS" == "recovery_status=in_progress" ]/
>
> /# do/
>
> /              # sleep 5/
>
> /              # SW_STATUS=$(fw_printenv recovery_status)/
>
> /              # echo $(fw_printenv recovery_status)/
>
> /              # echo "Sleep for 5more min"/
>
> /# done/
>
> //
>
> /echo $(fw_printenv recovery_status)/
>
> /reboot/
>
> Could you check our above config files & scripts and please revert back
> for the missing details.
>
> Thanks & Regards,
>
> Manonmani
>
> --
> 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/DM6PR07MB5065C5FD97547BF5A396017B860C9%40DM6PR07MB5065.namprd07.prod.outlook.com <https://groups.google.com/d/msgid/swupdate/DM6PR07MB5065C5FD97547BF5A396017B860C9%40DM6PR07MB5065.namprd07.prod.outlook.com?utm_medium=email&utm_source=footer>.

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

Reply all
Reply to author
Forward
0 new messages