Skip to contentSkip to conversation

Host tool to perform semiautomatic updates

RFC llandre 8 participants 11 messages Mar 14, 2008 – Mar 16, 2008

lore
Share & tools
lore

llandre

author
#0 lore raw

Hi all,

I need a tool running on host (Linux or Windows) that is able to interact with u-boot command line emulating a human operator. Also it must be able to retrieve from a text file a sequential list of commands it must issue.
One of the purpose is to have a simple procedure to perform on-the-field upgrades with just a laptop connected to the target via serial cable (I'm aware about this
http://www.denx.de/wiki/view/UBootdoc/AutomaticUpdates but I need a procedure that does not require USB nor ethernet).

For example it should be able to parse and execute a "script" like this:

- wait U-Boot startup messages
- interrupt autoboot sequence
- download new linux kernel image
- erase flash region
- program new linux kernel image
- verify new linux kernel image is stored correctly
- in case it failed, retry the erase/writing cycle until it is ok or retry counter is reached
- notify human operator about success/failure

So the human operator should just:
a) connect the target to the laptop via RS232 cable
b) start the program on laptop
c) reset the target

From now on the program will handle all the communication with the
target and the human operator will have just to wait for notification.

Anybody knows is there is something like this available? If not, any suggestions about how to implement it?

Thanks in advance,
llandre

DAVE Electronics System House - R&D Department

web:   http://www.dave.eu
email: r&d2 at dave-tech.it
#1 lore raw
Quoted 12 lines · llandre

Hi all,

I need a tool running on host (Linux or Windows) that is able to interact with u-boot command line emulating a human operator. Also it must be able to retrieve from a text file a sequential list of commands it must issue.
One of the purpose is to have a simple procedure to perform on-the-field upgrades with just a laptop connected to the target via serial cable (I'm aware about this
http://www.denx.de/wiki/view/UBootdoc/AutomaticUpdates but I need a procedure that does not require USB nor ethernet).

[snip]

Quoted 6 lines

From now on the program will handle all the communication with the
target and the human operator will have just to wait for notification.

Anybody knows is there is something like this available? If not, any suggestions about how to implement it?

I believe what you are looking for is "expect"
http://linux.die.net/man/1/expect

Regards,
?yvind Repvik

#2 lore raw
In reply to llandre
Quoted 29 lines · llandre

Hi all,

I need a tool running on host (Linux or Windows) that is able to interact with u-boot command line emulating a human operator. Also it must be able to retrieve from a text file a sequential list of commands it must issue.
One of the purpose is to have a simple procedure to perform on-the-field upgrades with just a laptop connected to the target via serial cable (I'm aware about this
http://www.denx.de/wiki/view/UBootdoc/AutomaticUpdates but I need a procedure that does not require USB nor ethernet).

For example it should be able to parse and execute a "script" like this:

- wait U-Boot startup messages
- interrupt autoboot sequence
- download new linux kernel image
- erase flash region
- program new linux kernel image
- verify new linux kernel image is stored correctly
- in case it failed, retry the erase/writing cycle until it is ok or retry counter is reached
- notify human operator about success/failure

So the human operator should just:
a) connect the target to the laptop via RS232 cable
b) start the program on laptop
c) reset the target

Quoted 8 lines

From now on the program will handle all the communication with the
target and the human operator will have just to wait for notification.

Anybody knows is there is something like this available? If not, any suggestions about how to implement it?

How about expect? This should get you started:
http://en.wikipedia.org/wiki/Expect

If you want to use Windows I'd go with expect through cygwin rather than the native Windows port of expect.

You can of course do all of this in something more modern like Python, but that might be a steeper learning curve.

regards,
Ben

#10 lore raw
In reply to llandre
Quoted 5 lines · In message <[email protected]> you wrote:

I need a tool running on host (Linux or Windows) that is able to interact with u-boot command line emulating a human operator. Also it must be able to retrieve from a text file a sequential list of commands it must issue.

"expect" is your friend.

Quoted 5 lines

One of the purpose is to have a simple procedure to perform on-the-field upgrades with just a laptop connected to the target via serial cable (I'm aware about this
http://www.denx.de/wiki/view/UBootdoc/AutomaticUpdates but I need a procedure that does not require USB nor ethernet).

See also http://www.denx.de/wiki/DUTS/DUTSDocs and
http://www.denx.de/cgi-bin/gitweb.cgi?p=duts.git;a=summary

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Life is a game. Money is how we keep score.              - Ted Turner
author
#3 lore raw
In reply to Ben Warren
Quoted 8 lines

How about expect? This should get you started:
http://en.wikipedia.org/wiki/Expect

If you want to use Windows I'd go with expect through cygwin rather than the native Windows port of expect.

You can of course do all of this in something more modern like Python, but that might be a steeper learning curve.

I thought about expect/cygwin but in my opinion is too hard to use for the average Windows operator who expects just to:
- install the application by running an .exe or unzipping a .zip
- launching the application
- press a couple of buttons on GUI and see the result.

I think Python could be a very good solution. Since I never worked with it, I ask just few questions:
1) for Windows platform, is possible to generate one single .exe file taht includes all the required stuff (such as libraries and runtime components)? If not, it is possible to group all of them in one single .zip file?
2) What about serial ports support? Is this really platform independent?
3) What about graphical interface? Is it possible to use the same library (and consequently have similar look&feel) on Windows and Linux?

Cheers,
llandre

DAVE Electronics System House - R&D Department

web:   http://www.dave.eu
email: r&d2 at dave-tech.it
#4 lore raw
Quoted 7 lines
Quoted 7 lines

I thought about expect/cygwin but in my opinion is too hard to use for the average Windows operator who expects just to:
- install the application by running an .exe or unzipping a .zip
- launching the application
- press a couple of buttons on GUI and see the result.

Quoted 10 lines
Quoted 10 lines

I think Python could be a very good solution. Since I never worked with it, I ask just few questions:
1) for Windows platform, is possible to generate one single .exe file taht includes all the required stuff (such as libraries and runtime components)? If not, it is possible to group all of them in one single .zip file?
2) What about serial ports support? Is this really platform independent?
3) What about graphical interface? Is it possible to use the same library (and consequently have similar look&feel) on Windows and Linux?

The serial port support is platform independent if you use the right library.
We use python to communicate with the target from a windows/linux host without any problems.
You can design a simple graphical interface which will look exactly the same on both operating systems.
I think the uboot list is not the right place to continue with this discussion.

Cheers,
Nicolas
Armadeus Systems
www.armadeus.com

#5 lore raw
In reply to llandre
Quoted 4 lines

1) for Windows platform, is possible to generate one single .exe file taht includes all the required stuff (such as libraries and runtime components)? If not, it is possible to group all of them in one single .zip file?

Look for py2exe, it can convert your .py script into an executable plus a few DLLs that you can zip up.

Quoted 3 lines

2) What about serial ports support? Is this really platform independent?
3) What about graphical interface? Is it possible to use the same library (and consequently have similar look&feel) on Windows and Linux?

You can look into wxPython for platform-independent GUI

Thanks
Donald

#6 lore raw
In reply to llandre
Quoted 6 lines

I thought about expect/cygwin but in my opinion is too hard to use for the average Windows operator who expects just to:
- install the application by running an .exe or unzipping a .zip
- launching the application
- press a couple of buttons on GUI and see the result.

I forgot to say there is a Python expect implementation called pyexpect as well.

Thanks
Donald

author
#7 lore raw
Quoted 8 lines
Quoted 6 lines

I thought about expect/cygwin but in my opinion is too hard to use for the average Windows operator who expects just to:
- install the application by running an .exe or unzipping a .zip
- launching the application
- press a couple of buttons on GUI and see the result.

I forgot to say there is a Python expect implementation called pyexpect as well.

Thank you all for the precious advices.
I think I'll propose a python-based solution to my team.

Cheers,
llandre

DAVE Electronics System House - R&D Department

web:   http://www.dave.eu
email: r&d2 at dave-tech.it
#8 lore raw
In reply to llandre
Quoted 9 lines · llandre

I think Python could be a very good solution. Since I never worked with it, I ask just few questions:
1) for Windows platform, is possible to generate one single .exe file taht includes all the required stuff (such as libraries and runtime components)? If not, it is possible to group all of them in one single .zip file?
2) What about serial ports support? Is this really platform independent?
3) What about graphical interface? Is it possible to use the same library (and consequently have similar look&feel) on Windows and Linux?

If you search the mailing list archive, you'll find some python expect and serial code from Jerry Van Baren:

http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/33594/focus=33733

Best regards

Markus Klotzbuecher

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#9 lore raw
Quoted 4 lines · Markus Klotzb?cher

If you search the mailing list archive, you'll find some python expect and serial code from Jerry Van Baren:

http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/33594/focus=33733

You've probably read my answer...

Robert

Signature · 5 lines
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
     Hannoversche Str. 2, 31134 Hildesheim, Germany
   Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9