Swupdate v2016.10.0 : failed to parse sw-description!

3,731 views
Skip to first unread message

Marco

unread,
May 8, 2017, 8:07:41 AM5/8/17
to swupdate
Hello,
I have the following error but I don't understand the reason.
Any hint will be appreciated.


# swupdate -v -i ./my-software_1.4.swu
Swupdate v2016.10.0

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

Registered handlers:
flash
raw
rawfile
shellscript
preinstall
postinstall
uboot
[NOTIFY] : SWUPDATE running : [extract_sw_description] : Found file:
filename sw-description
size 225
checksum 0x390c VERIFIED

ERROR core/swupdate.c : install_from_file : 311 : failed to parse
sw-description!

[NOTIFY] : SWUPDATE failed [0] ERROR core/swupdate.c : install_from_file
: 311 : failed to parse sw-description!

---

# cat /tmp/sw-description
software =
{
version = "0.1.0";

hardware-compatibility: [ "1.0", "1.2", "1.3"];

files: (
{
filename = "TEST";
path = "/root/TEST";
device = "/dev/mmcblk0p1";
filesystem = "ext4";
}
);
}

---

# mount
/dev/root on / type ext4 (rw,relatime,data=ordered)
devtmpfs on /dev type devtmpfs
(rw,relatime,size=89640k,nr_inodes=22410,mode=755)
proc on /proc type proc (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,relatime,mode=777)
tmpfs on /tmp type tmpfs (rw,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
sysfs on /sys type sysfs (rw,relatime)

# cat /proc/cmdline
console=ttymxc0,115200 root=/dev/mmcblk0p1 rootwait rw



Thank you
--
Marco

Stefano Babic

unread,
May 8, 2017, 9:45:37 AM5/8/17
to koanso...@gmail.com, swupdate
Hi Marco,
I cannot confirm this. I simply built a .swu with your sw-description
and a test file, and running swupdate with the -c (=check) option, no
error is reported:

../../swupdate -c -i boards/pc/test5/software_pc_test5.swu
Swupdate v2017.4.0

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

Searching for custom LUA handlers :[string "require
("swupdate_handlers")"]:1: module 'swupdate_handlers' not found:
no field package.preload['swupdate_handlers']
no file '/usr/local/share/lua/5.2/swupdate_handlers.lua'
no file '/usr/local/share/lua/5.2/swupdate_handlers/init.lua'
no file '/usr/local/lib/lua/5.2/swupdate_handlers.lua'
no file '/usr/local/lib/lua/5.2/swupdate_handlers/init.lua'
no file '/usr/share/lua/5.2/swupdate_handlers.lua'
no file '/usr/share/lua/5.2/swupdate_handlers/init.lua'
no file './swupdate_handlers.lua'
no file '/usr/local/lib/lua/5.2/swupdate_handlers.so'
no file '/usr/lib/x86_64-linux-gnu/lua/5.2/swupdate_handlers.so'
no file '/usr/lib/lua/5.2/swupdate_handlers.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './swupdate_handlers.so'
Custom handlers not found, no error, skipping...

Registered handlers:
archive
tar
raw
rawfile
lua
shellscript
preinstall
postinstall
remote
uboot
bootloader
Version 0.1.0
successfully checked 'boards/pc/test5/software_pc_test5.swu'

When SWUpdate just reports an error in parsing without saying a reason,
a common issue is a syntax error. This is due to missing semicolon, or
some strange characters that flew down into sw-description. But
apparently, your sw-description is correct and it works here.

Regards,
Stefano


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

Stefano Babic

unread,
May 8, 2017, 9:52:31 AM5/8/17
to koanso...@gmail.com, swupdate
Hi Marco,

On 08/05/2017 14:07, Marco wrote:
I cannot confirm this. I simply built a .swu with your sw-description
and a test file, and running swupdate with the -c (=check) option, no
error is reported:

../../swupdate -c -i boards/pc/test5/software_pc_test5.swu
Swupdate v2017.4.0

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

Marco

unread,
May 9, 2017, 6:06:43 AM5/9/17
to Stefano Babic, swupdate
Hi Stefano,
thank you for answering.

Unfortunately I am using SWUpdate in Buildroot.
That wasn't my choice :-(

BTW I am debugging the code and I found that parse_cfg() and
parse_json() are not called because seems that CONFIG_LIBCONFIG and
CONFIG_JSON are not set, or I should say that this build system is
somehow ignoring what I configure.
I am still digging into the problem.

In any case I would suggest you to add an error message into the
parse_cfg() and parse_json() small fallback functions when the CONFIG
are not set.

Just my two cents ;-)


Ciao
--
Marco

Stefano Babic

unread,
May 9, 2017, 6:40:17 AM5/9/17
to koanso...@gmail.com, Stefano Babic, swupdate
Hi Marco,

On 09/05/2017 12:06, Marco wrote:
>
> Hi Stefano,
> thank you for answering.
>
> Unfortunately I am using SWUpdate in Buildroot.
> That wasn't my choice :-(
>
> BTW I am debugging the code and I found that parse_cfg() and
> parse_json() are not called because seems that CONFIG_LIBCONFIG and
> CONFIG_JSON are not set, or I should say that this build system is
> somehow ignoring what I configure.

Ok - then the issue is clear. Your (correct) sw-description is not
parsed at all.

> I am still digging into the problem.
>
> In any case I would suggest you to add an error message into the
> parse_cfg() and parse_json() small fallback functions when the CONFIG
> are not set.

No, this is not correct. If both are not set, it is still plausible to
use an external parser written in LUA. parse_cfg and parse_json return
with error, and the last choice (external parser) is called.

ciao,

Marco

unread,
May 10, 2017, 6:11:28 AM5/10/17
to Stefano Babic, swupdate
Il 09/05/2017 12:40, Stefano Babic ha scritto:
> Hi Marco,
>
> On 09/05/2017 12:06, Marco wrote:
>>
>> Hi Stefano,
>> thank you for answering.
>>
>> Unfortunately I am using SWUpdate in Buildroot.
>> That wasn't my choice :-(
>>
>> BTW I am debugging the code and I found that parse_cfg() and
>> parse_json() are not called because seems that CONFIG_LIBCONFIG and
>> CONFIG_JSON are not set, or I should say that this build system is
>> somehow ignoring what I configure.
>
> Ok - then the issue is clear. Your (correct) sw-description is not
> parsed at all.
>
>> I am still digging into the problem.
>>
>> In any case I would suggest you to add an error message into the
>> parse_cfg() and parse_json() small fallback functions when the CONFIG
>> are not set.
>
> No, this is not correct. If both are not set, it is still plausible to
> use an external parser written in LUA. parse_cfg and parse_json return
> with error, and the last choice (external parser) is called.
>
> ciao,
> Stefano
>


Hi Stefano,
the problem was solved by adding BR2_PACKAGE_LIBCONFIG=y into Buildroot
configuration.

Now I have many other problems trying to manage this

images: (
{
filename = "uImage";
device = "/dev/mtd1";
type = "flash";
}
);

/tmp/sw-description:14 - syntax error
ERROR parser/parser.c : parse_cfg : 524 : ..exiting
ERROR parser/parser.c : parse_json : 585 : JSON File corrupted

These error messages are very cryptic and configuring SWUpdate for
Buildroot is a pain.

Ciao
--
Marco

Stefano Babic

unread,
May 10, 2017, 6:20:53 AM5/10/17
to koanso...@gmail.com, Stefano Babic, swupdate
Hi Marco,

On 10/05/2017 12:11, Marco wrote:

> Hi Stefano,
> the problem was solved by adding BR2_PACKAGE_LIBCONFIG=y into Buildroot
> configuration.

ok

>
> Now I have many other problems trying to manage this
>
> images: (
> {
> filename = "uImage";
> device = "/dev/mtd1";
> type = "flash";
> }
> );
>
> /tmp/sw-description:14 - syntax error

Rather both libconfig and libjson do not say a lot when the file has
some (often trivial) issues. A missing semicolon raises such kind of

> ERROR parser/parser.c : parse_cfg : 524 : ..exiting

This is returned from the library, rather we do not know anything more.
The only trace ist "sw-description:14".

> ERROR parser/parser.c : parse_json : 585 : JSON File corrupted
>
> These error messages are very cryptic and configuring SWUpdate for
> Buildroot is a pain.

I can just suggest to build SWUpdate on your Host (you can disable
support for U-Boot to make life easy) and then you can verify
correctness of the SWU (sw-description is correct) directly on host with
"swupdate -c -i <swu file>".

Anatolij Gustschin

unread,
May 10, 2017, 6:23:15 AM5/10/17
to Marco, Stefano Babic, swupdate
On Wed, 10 May 2017 12:11:24 +0200
Marco koanso...@gmail.com wrote:
...
>the problem was solved by adding BR2_PACKAGE_LIBCONFIG=y into Buildroot
>configuration.
>
>Now I have many other problems trying to manage this
>
>images: (
> {
> filename = "uImage";
> device = "/dev/mtd1";
> type = "flash";
> }
>);
>
>/tmp/sw-description:14 - syntax error
>ERROR parser/parser.c : parse_cfg : 524 : ..exiting
>ERROR parser/parser.c : parse_json : 585 : JSON File corrupted
>
>These error messages are very cryptic and configuring SWUpdate for
>Buildroot is a pain.

it seems that you are using sw-description file in libconfig
syntax, but you enabled the json parser. Please disable the
json parser in the configuration.

HTH,

Anatolij

Marco

unread,
May 10, 2017, 6:25:14 AM5/10/17
to Stefano Babic, swupdate
Il 10/05/2017 12:20, Stefano Babic ha scritto:
> Hi Marco,
>
.snip.
> I can just suggest to build SWUpdate on your Host (you can disable
> support for U-Boot to make life easy) and then you can verify
> correctness of the SWU (sw-description is correct) directly on host with
> "swupdate -c -i <swu file>".
>
> ciao,
> Stefano
>


Hi Stefano,
what do I need to enable 'flash' handler ?

Registered handlers:
archive
tar
raw
rawfile
shellscript
preinstall
postinstall

ERROR core/parser.c : parse : 115 : feature 'flash' required for image
'uImage' in sw-description is absent!
[NOTIFY] : SWUPDATE failed [0] ERROR core/parser.c : parse : 115 :
feature 'flash' required for image 'uImage' in sw-description is absent!

--
Marco

Stefano Babic

unread,
May 10, 2017, 6:26:02 AM5/10/17
to Anatolij Gustschin, Marco, swupdate
No, it is not. Parsers are called in a chain. When first reports errors,
the next is in.

parse for libconfig was already called, but it returns with errors.
SWUpdate tries with the JSON parser, but of course it cannot parse a
libconfig sw-description, and it returns errors, too.

Regards,

Stefano Babic

unread,
May 10, 2017, 6:29:08 AM5/10/17
to koanso...@gmail.com, swupdate
MTD must be set.
CONFIG_MTD
CONFIG_CFI

CONFIG_CFI depends on CONFIG_MTD, you cannot set it until MTD from
"general" submenu is set.

Best regards,
Stefano Babic

Marco

unread,
May 10, 2017, 6:37:42 AM5/10/17
to Stefano Babic, swupdate
Hi Stefano,
yes CONFIG_CFI was missing.
Now it is ok.


Registered handlers:
archive
tar
flash
raw
rawfile
shellscript
preinstall
postinstall

[NOTIFY] : SWUPDATE running : [extract_sw_description] : Found file:
filename sw-description
size 296
checksum 0x4dec VERIFIED

Version 0.1.0
[NOTIFY] : SWUPDATE running : [parse_images] : Found Image : uImage in
device : /dev/mtd3 for handler flash

[NOTIFY] : SWUPDATE running : [parse_files] : Found File : TEST -->
/root/TEST (/dev/mmcblk0p1)

[NOTIFY] : SWUPDATE running : [cpio_scan] : Found file:
filename uImage
size 5653840
REQUIRED

Main loop Daemon
[NOTIFY] : SWUPDATE running : [cpio_scan] : Found file:
filename TEST
size 16
REQUIRED

[NOTIFY] : SWUPDATE running : [install_single_image] : Found installer
for stream TEST rawfile
[NOTIFY] : SWUPDATE running : [install_raw_file] : Installing file TEST
on /tmp/datadst//root/TEST

[NOTIFY] : SWUPDATE running : [install_single_image] : Found installer
for stream uImage flash
[NOTIFY] : SWUPDATE running : [install_flash_image] : Copying uImage
into /dev/mtd3
Software updated successfully
Please reboot the device to start the new software
[NOTIFY] : SWUPDATE successful !


Thank you everybody
--
Marco
Reply all
Reply to author
Forward
0 new messages