Hi Renaud,
On 31/01/2017 15:57, Barbier, Renaud wrote:
> The json output below is obtained with "str = json_object_to_json_string_ext(cfg,JSON_C_TO_STRING_PRETTY);"
>
>
> The issue seems to be that I have too many nodes in json while this work with the libconfig version.
> I updated json_object *find_json_recursive_node with:
>
> const char *first = "software";
>
> if (json_object_object_get_ex(node, first, &onode)) {
> printf("GOT FIRST NODE: %s\n", first);
> node = onode;
> }
>
Quite - just the "software" entry is not proofed by the JSOIN parser.
I can parse without error this slightly modified file:
{
"hardware-compatibility":[
"0"
],
"files":[
{
"path":"\/tmp\/mnt\/secondary\/kernel.bin",
"sha256":"ffe2c8ab5cc94fc6a3c347b23986cc1249e81b811cb39c4742cc9e0a173b4292",
"name":"kernel factory",
"filename":"kernel.bin"
},
{
"path":"\/tmp\/mnt\/secondary\/dtbx_fac.dtb",
"sha256":"67565d41f8ac7a07128e11a6bfc44e24df5b75c68b235cf47042daa59224ebce",
"name":"dtb factory",
"filename":"dtbx_fac.dtb"
}
],
"images":[
{
"volume":"fs-redundant",
"sha256":"d60d7435790e215e995d330b2e7e5418c2009ec817e462fb2c3715b61ca074b9",
"type":"ubivol",
"name":"nand",
"filename":"nand.ubifs"
}
],
"scripts":[
{
"sha256":"e63c3370df5bcc79f5503e3041ffae151d6ceb08792cbab22a5af1388f69ca2b",
"type":"preinstall",
"filename":"preinstall_fac"
},
{
"sha256":"b1a96f95222366d6c23c34d67088af54024f8f49cf6a21937766b2f5e789bc6e",
"type":"postinstall",
"filename":"postinstall_fac"
}
],
"partitions":[
{
"mtdname":"nand",
"name":"fs-redundant",
"size":"134217728"
}
]
}
}
}
}
The output I get from a .swu with just the sw-description is:
./swupdate -v -c -Hrm927rc:0 -e stable,factory -i tests/ML/software_1.0.swu
Swupdate v2017.1.0-rc1
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...
Running on rm927rc Revision 0
Registered handlers:
archive
tar
flash
flash-hamming1
raw
rawfile
ubivol
ubipartition
lua
shellscript
preinstall
postinstall
remote
uboot
software set: stable mode: factory
[NOTIFY] : SWUPDATE running : [extract_sw_description] : Found file:
filename sw-description
size 3059
checksum 0x2c3c9 VERIFIED
[NOTIFY] : SWUPDATE running : [parse_images] : Found Image nand :
nand.ubifs in volume : fs-redundant for handler ubivol
[NOTIFY] : SWUPDATE running : [parse_scripts] : Found Script:
postinstall_fac
[NOTIFY] : SWUPDATE running : [parse_scripts] : Found Script:
preinstall_fac
[NOTIFY] : SWUPDATE running : [parse_files] : Found File kernel factory
: kernel.bin --> /tmp/mnt/secondary/kernel.bin (ROOTFS)
[NOTIFY] : SWUPDATE running : [parse_files] : Found File dtb factory :
dtbx_fac.dtb --> /tmp/mnt/secondary/dtbx_fac.dtb (ROOTFS)
[NOTIFY] : SWUPDATE failed [0] ERROR parser/parser.c : parse_partitions
: 237 : Partition incompleted in description file
[NOTIFY] : SWUPDATE running : [check_hw_compatibility] : Hardware
rm927rc Revision: 0
[NOTIFY] : SWUPDATE failed [0] ERROR core/swupdate.c : install_from_file
: 337 : SW not compatible with hardware
This time the file is parsed, no error and all entries are parsed.