sw-description - incorrectly setting uboot environment variables

243 views
Skip to first unread message

brend...@gmail.com

unread,
Aug 25, 2017, 2:56:22 AM8/25/17
to swupdate
Hello,

In my sw-description file I have one small issue where one of the bootloader(uboot) environment variables is incorrectly set when the swupdate process is executed (which is successful).

The one in question is this:
```
{
name = "recovery_setargs";
value = "setenv bootargs ubi.mtd=4 root=ubi0:rootfs rootfstype=ubifs ro console=ttymxc0,115200 ${kern_ip}";
},
```

Which expands to this:

```
recovery_setargssetenv=bootargs ubi.mtd=4 root=ubi0:rootfs rootfstype=ubifs ro console=ttymxc0,115200 ${kern_ip} setenv bootargs ubi.mtd=4 root=ubi0:rootfs rootfstype=ubifs ro console=ttymxc0,115200 ${kern_ip}
```

I confirm this while I'm in userspace as well:

```
root@var-som-mx6:~# fw_printenv recovery_setargs
## Error: "recovery_setargs" not defined
root@var-som-mx6:~# fw_printenv recovery_setargssetenv
recovery_setargssetenv=bootargs ubi.mtd=4 root=ubi0:rootfs rootfstype=ubifs ro console=ttymxc0,115200 ${kern_ip} setenv bootargs ubi.mtd=4 root=ubi0:rootfs rootfstype=ubifs ro console=ttymxc0,115200 ${kern_ip}
```

Is there something in the background with string replacements and keywords that I am unaware of?

Thanks

Stefano Babic

unread,
Aug 25, 2017, 3:02:15 AM8/25/17
to brend...@gmail.com, swupdate
Hi Brendan,
Does it work with u-boot's tools ?

fw_setenv recovery_setargs ...

If this does not work, it won't work in SWUpdate, too - SWUpdate calls
the library provided by U-Boot.

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

brend...@gmail.com

unread,
Aug 25, 2017, 3:21:00 AM8/25/17
to swupdate, brend...@gmail.com, sba...@denx.de
On Friday, 25 August 2017 17:02:15 UTC+10, Stefano Babic wrote:
> Hi Brendan,

>
> Does it work with u-boot's tools ?
>
> fw_setenv recovery_setargs ...
>
> If this does not work, it won't work in SWUpdate, too - SWUpdate calls
> the library provided by U-Boot.
>
> Best regards,
> Stefano Babic

Hi Stefano,

Thank you for your swift reply.

```


root@var-som-mx6:~# fw_printenv recovery_setargs
## Error: "recovery_setargs" not defined

root@var-som-mx6:~# fw_setenv recovery_setargs "setenv bootargs ubi.mtd=4 root=ubi0:rootfs rootfstype=ubifs ro console=ttymxc0,115200 ${kern_ip}"
root@var-som-mx6:~# fw_printenv recovery_setargs
recovery_setargs=setenv bootargs ubi.mtd=4 root=ubi0:rootfs rootfstype=ubifs ro console=ttymxc0,115200
```

I have no issues using fw_setenv albeit ${kern_ip} isn't defined hence why it is blank, which I understand.

I used the verbose swupdate output and saw that it parses it as below:
```
[NOTIFY] : SWUPDATE running : [parse_uboot] : U-Boot var: recovery_setargssetenv bootargs ubi.mtd=4 root=ubi0:rootfs rootfstype=ubifs ro console=ttymxc0,115200 ${kern_ip} = setenv bootargs ubi.mtd=4 root=ubi0:r

```

Stefano Babic

unread,
Aug 25, 2017, 6:08:44 AM8/25/17
to brend...@gmail.com, swupdate, sba...@denx.de
Hi Brendan,
I have simply generated an image with the suspected part of
sw-description, and I ran SWUpdate in check mode:

[NOTIFY] : SWUPDATE running : [parse_hw_compatibility] : Accepted Hw
Revision : 1.0
[NOTIFY] : SWUPDATE running : [parse_scripts] : Found Script:
shellscript_logger.sh

[NOTIFY] : SWUPDATE running : [parse_bootloader] : Bootloader var:
recovery_setargs = setenv bootargs ubi.mtd=4 root=ubi0:rootfs
rootfstype=ubifs ro console=ttymxc0,115200 ${kern_ip}

The parsing is correct in my case. I can just suggest to update to
current SWUpdate (I see you have an older version) and check if the
problem persists.

brend...@gmail.com

unread,
Aug 29, 2017, 12:55:30 AM8/29/17
to swupdate, brend...@gmail.com, sba...@denx.de
On Friday, 25 August 2017 20:08:44 UTC+10, Stefano Babic wrote:
> Hi Brendan,
>
> I have simply generated an image with the suspected part of
> sw-description, and I ran SWUpdate in check mode:
>
> [NOTIFY] : SWUPDATE running : [parse_hw_compatibility] : Accepted Hw
> Revision : 1.0
> [NOTIFY] : SWUPDATE running : [parse_scripts] : Found Script:
> shellscript_logger.sh
>
> [NOTIFY] : SWUPDATE running : [parse_bootloader] : Bootloader var:
> recovery_setargs = setenv bootargs ubi.mtd=4 root=ubi0:rootfs
> rootfstype=ubifs ro console=ttymxc0,115200 ${kern_ip}
>
> The parsing is correct in my case. I can just suggest to update to
> current SWUpdate (I see you have an older version) and check if the
> problem persists.
>
> 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
> =====================================================================

Just an update on this for others who might stumble onto this thread or suffer with this problem.

It was indeed because I was using an older version of swupdate; one before this commit was added: https://github.com/sbabic/swupdate/commit/87565c2693acfc049102ba07268286ef1d5be6ef

Stefano Babic

unread,
Aug 29, 2017, 4:27:07 AM8/29/17
to brend...@gmail.com, swupdate, sba...@denx.de
Thanks for reporting this.
Reply all
Reply to author
Forward
0 new messages