[U-Boot-Users] [RFC] Host tool to perform semiautomatic updates

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@dave-tech.it

llandre wrote:
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]
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

llandre wrote:
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?
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

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@dave-tech.it

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

- 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.
- What about serial ports support? Is this really platform independent?
- 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

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

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@dave-tech.it

llandre r&d2@dave-tech.it writes:
I think Python could be a very good solution. Since I never worked with it, I ask just few questions:
- 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@denx.de

On Sat, Mar 15, 2008 at 01:20:17PM +0100, Markus Klotzbücher wrote:
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

In message 47DA8762.2090008@dave-tech.it 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.
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
participants (8)
-
Ben Warren
-
Hoi-Ho Chan
-
llandre
-
Markus Klotzbücher
-
Nicolas Colombain
-
Robert Schwebel
-
Wolfgang Denk
-
Øyvind Repvik