mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-05 02:51:00 +00:00
4cf4600f25
update tbot documentation in U-Boot, as I just merged the event system into tbots master branch. Signed-off-by: Heiko Schocher <hs@denx.de>
310 lines
11 KiB
Text
310 lines
11 KiB
Text
# Copyright (c) 2016 DENX Software Engineering GmbH
|
|
# Heiko Schocher <hs@denx.de>
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0+
|
|
#
|
|
|
|
install tbot on your PC (linux only tested):
|
|
============================================
|
|
|
|
- get the source code:
|
|
|
|
$ git clone https://github.com/hsdenx/tbot.git
|
|
[...]
|
|
$
|
|
|
|
cd into the tbot directory.
|
|
|
|
- you need the for running tbot the python paramiko module, see:
|
|
http://www.paramiko.org/installing.html
|
|
|
|
paramiko is used for handling ssh sessions, and open filedescriptors
|
|
on a ssh connection. Tbot open a ssh connection to a "lab PC" and
|
|
opens on that connection 2 filehandles, one for control functions
|
|
and one for the connection to the boards console. May it is worth
|
|
to think about to open more filehandles and use them in tbot, but
|
|
thats a point in the Todo list ...
|
|
|
|
See [1] for more infos about tbot principles.
|
|
|
|
- prepare a directory for storing the logfiles
|
|
and pass it with the commandline option "-l"
|
|
to tbot. Default is the directory "log" in the tbot
|
|
root (don;t forget to create it, if you want to use it)
|
|
|
|
- If your VL is not yet in tbot source, integrate it
|
|
(This task has only to be done once for your VL):
|
|
|
|
A VL has, as described in [2] "necessary tasks for a Lab PC" explained,
|
|
3 tasks:
|
|
|
|
a) power on/off the board
|
|
b) get power state of the board
|
|
c) connect to the boards console
|
|
|
|
As tbot sends only shell commands (also to the Lab PC)
|
|
this tasks must be executable through shell commands on your
|
|
Lab PC:
|
|
|
|
Task a) power on/off board:
|
|
default TC for this task is:
|
|
https://github.com/hsdenx/tbot/blob/master/src/tc/tc_lab_denx_power.py
|
|
|
|
- now copy this file to for example
|
|
cp src/tc/tc_lab_denx_power.py src/tc/tc_lab_denx_power_XXX.py
|
|
(replace XXX to a proper value)
|
|
and adapt the "remote_power" command from the denx lab to your needs.
|
|
|
|
As this TC powers on the board for all your boards in your VL,
|
|
you can differ between the boards through the tbot class
|
|
variable "tb.boardlabpowername" (which is in the default case the
|
|
same as "tb.boardname"), but you may need to name the power target
|
|
with an other name than boardname, so you can configure this case.
|
|
The power state "tb.power_state" which the TC has to set
|
|
is "on" for power on, or "off" for power off.
|
|
|
|
If switching on the power is successful, call "tb.end_tc(True)"
|
|
else "tb.end_tc(False)"
|
|
|
|
- set in your board config file:
|
|
self.tc_lab_denx_power_tc = 'tc_lab_denx_power_XXX.py'
|
|
|
|
Task b) power on/off board:
|
|
default TC for this task is:
|
|
https://github.com/hsdenx/tbot/blob/master/src/tc/tc_lab_denx_get_power_state.py
|
|
|
|
- now copy this file to for example
|
|
(replace XXX to a proper value)
|
|
cp src/tc/tc_lab_denx_get_power_state.py src/tc/tc_lab_denx_get_power_state_XXX.py
|
|
and adapt the commands to your needs.
|
|
|
|
If the power of the board is on, call "tb.end_tc(True)"
|
|
else "tb.end_tc(False)"
|
|
|
|
- set in your board config file:
|
|
self.tc_lab_denx_get_power_state_tc = 'tc_lab_denx_get_power_state_XXX.py'
|
|
|
|
Task c) connect to the boards console:
|
|
default TC for this task is:
|
|
https://github.com/hsdenx/tbot/blob/master/src/tc/tc_lab_denx_connect_to_board.py
|
|
|
|
- now copy this file to for example
|
|
(replace XXX to a proper value)
|
|
cp src/tc/tc_lab_denx_connect_to_board.py src/tc/tc_lab_denx_connect_to_board_XXX.py
|
|
and adapt the commands to your needs.
|
|
|
|
If connect fails end this TC with "tb.end_tc(False)"
|
|
else call "tb.end_tc(True)"
|
|
|
|
If you want to use kermit for connecting to the boards console, you
|
|
can use:
|
|
|
|
https://github.com/hsdenx/tbot/blob/master/src/tc/tc_workfd_connect_with_kermit.py
|
|
|
|
Example for such a board in the VL from denx:
|
|
self.tc_lab_denx_connect_to_board_tc = 'tc_workfd_connect_with_kermit.py'
|
|
https://github.com/hsdenx/tbot/blob/master/tbot_dxr2.cfg#L24
|
|
|
|
Hopefully this works for you too.
|
|
|
|
- set in your board config file:
|
|
self.tc_lab_denx_connect_to_board_tc = 'tc_lab_denx_connect_to_board_XXX.py'
|
|
|
|
remarks while writting this:
|
|
- Currently there is only the denx VL. Original idea was to include
|
|
other VL through a seperate class/file in
|
|
https://github.com/hsdenx/tbot/tree/master/src/lab_api
|
|
but it turned out, that if we say "ssh" is the standard way to connect
|
|
to a VL, we can integrate the VL specific tasks through testcases, see
|
|
above, so we should do:
|
|
- rename the "denx" API to a more general name.
|
|
This is a point on my ToDo list ... done, renamed to 'ssh_std'
|
|
|
|
- the VL specific configuration may moved from the board config files
|
|
and should be collected in VL specific config files, which boards
|
|
config file simple include.
|
|
|
|
- prepare password.py file:
|
|
This file contains all passwords tbot needs (for example for
|
|
linux login on the boards)
|
|
tbot searches this file in the tbot root directory.
|
|
It is a simple python file, for example:
|
|
|
|
# passwords for the lab
|
|
if (board == 'lab'):
|
|
if (user == 'hs'):
|
|
password = 'passwordforuserhs'
|
|
if (user == 'root'):
|
|
password = 'passwordforrootuser'
|
|
# passwords for the boards
|
|
elif (board == 'mcx'):
|
|
if (user == 'root'):
|
|
password = 'passwordformcxrootfs'
|
|
else:
|
|
if (user == 'root'):
|
|
password = ''
|
|
|
|
- prepare board config file
|
|
Each board which is found in the VL needs a tbot configuration file
|
|
pass the config file name with the option '-c' to tbot, tbot searches
|
|
in the root dir for them.
|
|
|
|
board Example (dxr2 board):
|
|
https://github.com/hsdenx/tbot/blob/master/tbot_dxr2.cfg
|
|
|
|
Necessary variables:
|
|
|
|
line 3: boardname, here it is the "etamin" board
|
|
no default value, must be set.
|
|
line 4: boardlabname: name used for connecting to the board
|
|
may differ from tb.boardname, default tb.boardname
|
|
line 5: boardlabpowername: name used for power on/off
|
|
may differ from tb.boardname, default tb.boardname
|
|
line 6: tftpboardname: name used for tftp subdir (from where
|
|
U-Boot loads images for example).
|
|
may differ from tb.boardname, default tb.boardname
|
|
line 7: labprompt: linux prompt tbot sets
|
|
no defaultvalue, must be set (maybe we should introduce
|
|
"ttbott" as default ...
|
|
line 8: debug: If True, adds debug output on the tbot shell
|
|
line 9: debugstatus: enable status debug output on the shell
|
|
line 10: ip: Where tbot finds the Lab PC
|
|
line 11: user: As which user does tbot logs into the Lab PC
|
|
line 12: accept_all: passed to paramiko, accept all connections
|
|
line 13: keepalivetimout: passed to paramiko, timeout for sending
|
|
keepalive message.
|
|
line 14: channel_timeout: passed to paramiko
|
|
line 15: loglevel: tbots loglevel for adding entries into the logfile.
|
|
line 17: wdt_timeout: timeout in seconds for tbots watchdog.
|
|
Watchdog gets triggered if prompt get read.
|
|
line 24: tc_lab_denx_connect_to_board_tc: Which TC is used for
|
|
connecting to the boards console the TC, here:
|
|
https://github.com/hsdenx/tbot/blob/master/src/tc/tc_workfd_connect_with_kermit.py
|
|
line 27: uboot_prompt: boards U-Boot prompt
|
|
line 28: linux_prompt: boards linux prompt
|
|
|
|
Now comes a list of variables TC needs, this vary from which TC
|
|
you start on the board.
|
|
|
|
Thats it ... you now can call tbot and hopefully, it works ;-)
|
|
Find an example log [3] for calling simple U-Boot TC for setting
|
|
an U-Boot Environmentvariable.
|
|
|
|
If you have problems in setting tbot up, please contact me
|
|
(and may give me ssh access to your Lab PC ;-)
|
|
|
|
If you have running your first TC [3], you may want to write now your own
|
|
TC (and hopefully share them), so continue with:
|
|
u-boot:tools/tbot/README.create_a_new_testcase
|
|
|
|
Heiko Schocher <hs@denx.de>
|
|
v2 2016.04.26
|
|
|
|
--------------
|
|
|
|
[1] tbot Dokumentation:
|
|
[2] u-boot:/tools/tbot/README
|
|
https://github.com/hsdenx/tbot/blob/master/README.md
|
|
tbot-devel@googlegroups.com
|
|
|
|
[3] Example for a first U-Boot TC which should always work:
|
|
(with commandline option "-v" for verbose output):
|
|
hs@localhost:tbot [event-devel] $ python2.7 src/common/tbot.py -c tbot_dxr2.cfg -t tc_ub_setenv.py -v -l log/tbot.log
|
|
**** option cfg: tbot_dxr2.cfg log: log/tbot.log tc: tc_ub_setenv.py v 1
|
|
('CUR WORK PATH: ', '/home/hs/data/Entwicklung/tbot')
|
|
('CFGFILE ', 'tbot_dxr2.cfg')
|
|
('LOGFILE ', '/home/hs/data/Entwicklung/tbot/log/tbot.log')
|
|
tb_ctrl: Last login: Mon Apr 25 14:52:42 2016 from 87.97.29.27
|
|
*************************************************************
|
|
BDI2000 Assignment: (last updated: 2015-11-20 12:30 MET)
|
|
bdi1 => techem bdi2 => cetec_mx25 bdi3 => lpc3250
|
|
bdi4 => - bdi5 => --Rev.B!-- bdi6 => tqm5200s
|
|
bdi7 => [stefano] bdi8 => smartweb bdi9 => sigmatek-nand
|
|
bdi10 => pcm052 bdi11 => socrates bdi12 => aristainetos
|
|
bdi13 => imx53 bdi14 => ib8315 bdi15 => cairo
|
|
bdi16 => g2c1 bdi17 => lwe090 bdi18 => symphony
|
|
bdi19 => dxr2 bdi20 => ima3-mx6 bdi21 => sama5d3
|
|
bdi98 => - bdi99 => - bdi0 => -
|
|
Please power off unused systems when you leave! Thanks, wd.
|
|
*************************************************************
|
|
tb_ctrl: pollux:~ hs $
|
|
tb_ctrl: export PS1=ttbott
|
|
ttbott
|
|
tb_ctrl: stty cols 200
|
|
ttbott
|
|
tb_ctrl: export TERM=vt200
|
|
ttbott
|
|
tb_ctrl: echo $COLUMNS
|
|
200
|
|
ttbott
|
|
tb_con: Last login: Tue Apr 26 06:28:59 2016 from 87.97.29.27
|
|
*************************************************************
|
|
BDI2000 Assignment: (last updated: 2015-11-20 12:30 MET)
|
|
bdi1 => techem bdi2 => cetec_mx25 bdi3 => lpc3250
|
|
bdi4 => - bdi5 => --Rev.B!-- bdi6 => tqm5200s
|
|
bdi7 => [stefano] bdi8 => smartweb bdi9 => sigmatek-nand
|
|
bdi10 => pcm052 bdi11 => socrates bdi12 => aristainetos
|
|
bdi13 => imx53 bdi14 => ib8315 bdi15 => cairo
|
|
bdi16 => g2c1 bdi17 => lwe090 bdi18 => symphony
|
|
bdi19 => dxr2 bdi20 => ima3-mx6 bdi21 => sama5d3
|
|
bdi98 => - bdi99 => - bdi0 => -
|
|
Please power off unused systems when you leave! Thanks, wd.
|
|
*************************************************************
|
|
tb_con: pollux:~ hs $
|
|
tb_con: export PS1=ttbot
|
|
tb_con: t
|
|
ttbott
|
|
tb_con: stty cols 200
|
|
ttbott
|
|
tb_con: export TERM=vt200
|
|
ttbott
|
|
tb_con: echo $COLUMNS
|
|
200
|
|
ttbott
|
|
tb_con: ssh hs@lena
|
|
tb_con: hs@lena's password:
|
|
tb_con:
|
|
tb_con: Last login: Mon Apr 25 07:03:29 2016 from 192.168.1.1
|
|
tb_con: [hs@lena ~]$
|
|
tb_con: export PS1=ttbott
|
|
ttbott
|
|
tb_con: stty cols 200
|
|
ttbott
|
|
tb_con: export TERM=vt200
|
|
ttbott
|
|
tb_con: echo $COLUMNS
|
|
200
|
|
ttbott
|
|
tb_con: kermit
|
|
C-Kermit 8.0.211, 10 Apr 2004, for Linux
|
|
Copyright (C) 1985, 2004,
|
|
Trustees of Columbia University in the City of New York.
|
|
Type ? or HELP for help.
|
|
(/home/hs/) C-Kermit>
|
|
tb_con: set line /dev/ttyUSB0
|
|
(/home/hs/) C-Kermit>
|
|
tb_con: set speed 115200
|
|
/dev/ttyUSB0, 115200 bps
|
|
(/home/hs/) C-Kermit>
|
|
tb_con: set flow-control none
|
|
(/home/hs/) C-Kermit>
|
|
tb_con: set carrier-watch off
|
|
(/home/hs/) C-Kermit>
|
|
tb_con: connect
|
|
Connecting to /dev/ttyUSB0, speed 115200
|
|
Escape character: Ctrl-\ (ASCII 28, FS): enabled
|
|
Type the escape character followed by C to get back,
|
|
or followed by ? to see other options.
|
|
----------------------------------------------------
|
|
tb_con: <INTERRUPT>
|
|
U-Boot#
|
|
tb_con: U-Boot#
|
|
U-Boot#
|
|
tb_con: setenv Heiko Schocher
|
|
U-Boot#
|
|
tb_con: printenv Heiko
|
|
Heiko=Schocher
|
|
U-Boot#
|
|
[('tc_workfd_ssh.py', 1, 0), ('tc_workfd_connect_with_kermit.py', 1, 0), ('tc_ub_setenv.py', 1, 0)]
|
|
End of TBOT: success
|
|
hs@localhost:tbot [event-devel] $
|