Testing SWUpdate on BBB with Yocto krogoth

920 views
Skip to first unread message

koanso...@gmail.com

unread,
Mar 22, 2017, 12:27:43 PM3/22/17
to swupdate
Hi Stefano and everybody,
I am testing SWUpdate on BBB with Yocto krogoth and I read the impressive large documentation but in humble opinion it is missing a real example to figure out easier what is the whole scenario.

Anyway I did the following steps.
As starting point I'd like to add a file (TEST) in /home/root on the target.

On the HOST
------------------
1. Create the script (build-swu) to generate a .swu (my-software.swu)

#! /bin/sh
CONTAINER_VER="1.0"
PRODUCT_NAME="my-software"
FILES="sw-description \
TEST"
for i in $FILES;do
echo $i;done | cpio -ov -H crc > ${PRODUCT_NAME}_${CONTAINER_VER}.swu


2. Create the description file (sw-description)

// sw-description
software =
{
version = "0.1.0";

hardware-compatibility: [ "1.0"];

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

3. Run the script (build-swu)

$ ./build-swu
sw-description
TEST
2 blocchi

On the TARGET
------------------
1. Run swupdate my-software.swu
# swupdate -v -w "-document_root /home/root"

root@beaglebone:~# swupdate -v -w "-document_root /home/root"
Swupdate v2016.10.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/share/lua/5.3/swupdate_handlers.lua'
no file '/usr/share/lua/5.3/swupdate_handlers/init.lua'
no file '/usr/lib/lua/5.3/swupdate_handlers.lua'
no file '/usr/lib/lua/5.3/swupdate_handlers/init.lua'
no file './swupdate_handlers.lua'
no file './swupdate_handlers/init.lua'
no file '/usr/lib/lua/5.3/swupdate_handlers.so'
no file '/usr/lib/lua/5.3/loadall.so'
no file './swupdate_handlers.so'
Custom handlers not found, no error, skipping...

Registered handlers:
flash
raw
rawfile
lua
shellscript
preinstall
postinstall
uboot
Main loop Daemon
Mongoose web server v. 3.8 started on port(s) 8080 with web root [/home/root]

...I can access to the TARGET http://192.168.0.184:8080/ from my broswer


Questions
------------------
*. What is the error : module 'swupdate_handlers' not found
*. Looks like the update hasn't run, what is expected?
*. Is it possible to copy one single file (my TEST file)?
*. What is the purpose of /etc/fw_env.config
*. What is the purpose of /etc/swversion


TIA
--
Marco

koanso...@gmail.com

unread,
Mar 22, 2017, 12:34:17 PM3/22/17
to swupdate, koanso...@gmail.com
An update, my TEST file has been added to the image running the following command:

root@beaglebone:~# swupdate -i my-software_1.0.swu
Swupdate v2016.10.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/share/lua/5.3/swupdate_handlers.lua'
no file '/usr/share/lua/5.3/swupdate_handlers/init.lua'
no file '/usr/lib/lua/5.3/swupdate_handlers.lua'
no file '/usr/lib/lua/5.3/swupdate_handlers/init.lua'
no file './swupdate_handlers.lua'
no file './swupdate_handlers/init.lua'
no file '/usr/lib/lua/5.3/swupdate_handlers.so'
no file '/usr/lib/lua/5.3/loadall.so'
no file './swupdate_handlers.so'
Custom handlers not found, no error, skipping...

Registered handlers:
flash
raw
rawfile
lua
shellscript
preinstall
postinstall
uboot
Main loop Daemon
Version 0.1.0
Software updated successfully
Please reboot the device to start the new software
[NOTIFY] : SWUPDATE successful !

root@beaglebone:~# ls
TEST my-software_1.0.swu

Stefano Babic

unread,
Mar 22, 2017, 12:41:12 PM3/22/17
to koanso...@gmail.com, swupdate
Hi Marco,

On 22/03/2017 17:27, koanso...@gmail.com wrote:
> Hi Stefano and everybody,
> I am testing SWUpdate on BBB with Yocto krogoth and I read the impressive large documentation but in humble opinion it is missing a real example to figure out easier what is the whole scenario.

The thing is that there are multiple scenarios and everybody chooses the
best for his own project. What is currently missing is some examples
with evaluation boards (this is in my roadmap). I plan to add a
"meta-swupdate-boards" with at least BBB and a i.MX6, but I have not got
the time.

>
> Anyway I did the following steps.
> As starting point I'd like to add a file (TEST) in /home/root on the target.
>

Check the doc - you can update from:

- local storage (USB, ..) - what you are trying now.
- in push mode with the integrated webserver
- in pull mode (.swu loaded from external server)
- in pull mode with a backend (currently, only hawkbit)

> On the HOST
> ------------------
> 1. Create the script (build-swu) to generate a .swu (my-software.swu)
>

You are using Yocto, meta-swupdate generates the .swu for you - and it
fills sw-description with the hashes.
You start the webserver, SWUpdate is expecting you download the .swu and
listens from port 8080 (default)

>
> root@beaglebone:~# swupdate -v -w "-document_root /home/root"
> Swupdate v2016.10.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/share/lua/5.3/swupdate_handlers.lua'
> no file '/usr/share/lua/5.3/swupdate_handlers/init.lua'
> no file '/usr/lib/lua/5.3/swupdate_handlers.lua'
> no file '/usr/lib/lua/5.3/swupdate_handlers/init.lua'
> no file './swupdate_handlers.lua'
> no file './swupdate_handlers/init.lua'
> no file '/usr/lib/lua/5.3/swupdate_handlers.so'
> no file '/usr/lib/lua/5.3/loadall.so'
> no file './swupdate_handlers.so'
> Custom handlers not found, no error, skipping...
^---- it says "no error"

>
> Registered handlers:
> flash
> raw
> rawfile
> lua
> shellscript
> preinstall
> postinstall
> uboot
> Main loop Daemon
> Mongoose web server v. 3.8 started on port(s) 8080 with web root [/home/root]
>
> ...I can access to the TARGET http://192.168.0.184:8080/ from my broswer
>
>
> Questions
> ------------------
> *. What is the error : module 'swupdate_handlers' not found

You can write new handlers in LUA instead of linking to the code. If LUA
handlers are enable (and this is your case), SWUpdate searches for new
handlers and simply reports that no new handlers are found. See "no error"

> *. Looks like the update hasn't run, what is expected?

...if you start the webserver, it is expected you download the .swu

> *. Is it possible to copy one single file (my TEST file)?

Yes

> *. What is the purpose of /etc/fw_env.config

Check in U-Boot documentation. SWUpdate communicates with U-Boot via the
environment.

> *. What is the purpose of /etc/swversion

This is an option and can be replaced by the configuration file (-f).
Artifact can be skipped if the system has already the same version
installed. Typical use case is the bootloader: we do not want to update,
but there are case where we must do - with a risk. But we want that the
update is done *only* if strictly required: when U-Boot version
mismatches the version provided in the .swu.

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

Marco

unread,
Mar 23, 2017, 6:39:45 AM3/23/17
to swup...@googlegroups.com
Hi Stefano,
thank you for answering.

>>
>> Anyway I did the following steps.
>> As starting point I'd like to add a file (TEST) in /home/root on the target.
>>
>
> Check the doc - you can update from:
>
> - local storage (USB, ..) - what you are trying now.
> - in push mode with the integrated webserver
> - in pull mode (.swu loaded from external server)
> - in pull mode with a backend (currently, only hawkbit)


Is it possible to update from the network without copying a whole image
on the TARGET ?



>> On the TARGET
>> ------------------
>> 1. Run swupdate my-software.swu
>> # swupdate -v -w "-document_root /home/root"
>
> You start the webserver, SWUpdate is expecting you download the .swu and
> listens from port 8080 (default)
>

Actually when webserver starts by default it looks into /www
In the browser I see an empty directory with no files though.
How can I see something like you explained in this image
https://sbabic.github.io/swupdate/_images/website.png

Thanks,

Marco

unread,
Mar 23, 2017, 6:52:40 AM3/23/17
to swup...@googlegroups.com
Il 22/03/2017 17:41, Stefano Babic ha scritto:
>> On the HOST
>> ------------------
>> 1. Create the script (build-swu) to generate a .swu (my-software.swu)
>>
>
> You are using Yocto, meta-swupdate generates the .swu for you - and it
> fills sw-description with the hashes.
>


Actually if I build bitbake swupdate-image I get this file
swupdate-image-beaglebone.ext3.gz.u-boot
What is it supposed to be used for?


If I build butbake bbb-swu-image I get an error due to a missing file
core-image-full-cmdline-beaglebone.ext3 and probably I need to override
the recipe (?)

Exception: IOError: [Errno 2] No such file or directory:
'/home/marco/yocto-bbb-krogoth/poky/build/tmp/deploy/images/beaglebone/core-image-full-cmdline-beaglebone.ext3'

Thanks,

Stefano Babic

unread,
Mar 23, 2017, 2:05:16 PM3/23/17
to koanso...@gmail.com, swup...@googlegroups.com
On 23/03/2017 11:39, Marco wrote:
> Hi Stefano,
> thank you for answering.
>
>>>
>>> Anyway I did the following steps.
>>> As starting point I'd like to add a file (TEST) in /home/root on the
>>> target.
>>>
>>
>> Check the doc - you can update from:
>>
>> - local storage (USB, ..) - what you are trying now.
>> - in push mode with the integrated webserver
>> - in pull mode (.swu loaded from external server)
>> - in pull mode with a backend (currently, only hawkbit)
>
>
> Is it possible to update from the network without copying a whole image
> on the TARGET ?


Yes: the complete .swu is never copied on the target. You can add the
fla "installed-directly" to all artifacts that you want to be installed
without any temporary copy (that is, they are "streamed" into the flash)

>
>
>
>>> On the TARGET
>>> ------------------
>>> 1. Run swupdate my-software.swu
>>> # swupdate -v -w "-document_root /home/root"
>>
>> You start the webserver, SWUpdate is expecting you download the .swu and
>> listens from port 8080 (default)
>>
>
> Actually when webserver starts by default it looks into /www
> In the browser I see an empty directory with no files though.

If you build outside Yocto, you have to provide the website. In Yocto,
the website is in package swupdate-www and installs file in /www

> How can I see something like you explained in this image
> https://sbabic.github.io/swupdate/_images/website.png

The files in swupdate-www (or simply, what you see in ./www in the
sources) must be installed on target.

Stefano Babic

unread,
Mar 23, 2017, 2:06:45 PM3/23/17
to koanso...@gmail.com, swup...@googlegroups.com
On 23/03/2017 11:52, Marco wrote:
> Il 22/03/2017 17:41, Stefano Babic ha scritto:
>>> On the HOST
>>> ------------------
>>> 1. Create the script (build-swu) to generate a .swu (my-software.swu)
>>>
>>
>> You are using Yocto, meta-swupdate generates the .swu for you - and it
>> fills sw-description with the hashes.
>>
>
>
> Actually if I build bitbake swupdate-image I get this file
> swupdate-image-beaglebone.ext3.gz.u-boot
> What is it supposed to be used for?
>

This is the rescue system - it is a ramdisk (without kernel) and can be
started by U-Boot.

>
> If I build butbake bbb-swu-image I get an error due to a missing file
> core-image-full-cmdline-beaglebone.ext3 and probably I need to override
> the recipe (?)

Yes - I will drop this recipe because it is source of confusion.

>
> Exception: IOError: [Errno 2] No such file or directory:
> '/home/marco/yocto-bbb-krogoth/poky/build/tmp/deploy/images/beaglebone/core-image-full-cmdline-beaglebone.ext3'
>
>

Darapuneni Lakshminaidu

unread,
Sep 14, 2018, 12:22:58 AM9/14/18
to swupdate
Hi Stefano and Macro

I am also doing same like Macro has done. But I have a problem on Target.

Macro Having http on his Target but on my target there is no http for doing like this http://Board's IP:8080/ from my browser.

Questions:
1. How to get http on target or
2. Is there any alternative for doing this on target?

Target : PHYTEC board.

Thanks,
Lakshmi Naidu.
Reply all
Reply to author
Forward
0 new messages