README.install 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. # Copyright (c) 2016 DENX Software Engineering GmbH
  2. # Heiko Schocher <hs@denx.de>
  3. #
  4. # SPDX-License-Identifier: GPL-2.0+
  5. #
  6. install tbot on your PC (linux only tested):
  7. ============================================
  8. - get the source code:
  9. $ git clone https://github.com/hsdenx/tbot.git
  10. [...]
  11. $
  12. cd into the tbot directory.
  13. - you need the for running tbot the python paramiko module, see:
  14. http://www.paramiko.org/installing.html
  15. paramiko is used for handling ssh sessions, and open filedescriptors
  16. on a ssh connection. Tbot open a ssh connection to a "lab PC" and
  17. opens on that connection 2 filehandles, one for control functions
  18. and one for the connection to the boards console. May it is worth
  19. to think about to open more filehandles and use them in tbot, but
  20. thats a point in the Todo list ...
  21. See [1] for more infos about tbot principles.
  22. - prepare a directory for storing the logfiles
  23. and pass it with the commandline option "-l"
  24. to tbot. Default is the directory "log" in the tbot
  25. root (don;t forget to create it, if you want to use it)
  26. - If your VL is not yet in tbot source, integrate it
  27. (This task has only to be done once for your VL):
  28. A VL has, as described in [2] "necessary tasks for a Lab PC" explained,
  29. 3 tasks:
  30. a) power on/off the board
  31. b) get power state of the board
  32. c) connect to the boards console
  33. As tbot sends only shell commands (also to the Lab PC)
  34. this tasks must be executable through shell commands on your
  35. Lab PC:
  36. Task a) power on/off board:
  37. default TC for this task is:
  38. https://github.com/hsdenx/tbot/blob/master/src/tc/tc_lab_denx_power.py
  39. - now copy this file to for example
  40. cp src/tc/tc_lab_denx_power.py src/tc/tc_lab_denx_power_XXX.py
  41. (replace XXX to a proper value)
  42. and adapt the "remote_power" command from the denx lab to your needs.
  43. As this TC powers on the board for all your boards in your VL,
  44. you can differ between the boards through the tbot class
  45. variable "tb.boardlabpowername" (which is in the default case the
  46. same as "tb.boardname"), but you may need to name the power target
  47. with an other name than boardname, so you can configure this case.
  48. The power state "tb.power_state" which the TC has to set
  49. is "on" for power on, or "off" for power off.
  50. If switching on the power is successful, call "tb.end_tc(True)"
  51. else "tb.end_tc(False)"
  52. - set in your board config file:
  53. self.tc_lab_denx_power_tc = 'tc_lab_denx_power_XXX.py'
  54. Task b) power on/off board:
  55. default TC for this task is:
  56. https://github.com/hsdenx/tbot/blob/master/src/tc/tc_lab_denx_get_power_state.py
  57. - now copy this file to for example
  58. (replace XXX to a proper value)
  59. cp src/tc/tc_lab_denx_get_power_state.py src/tc/tc_lab_denx_get_power_state_XXX.py
  60. and adapt the commands to your needs.
  61. If the power of the board is on, call "tb.end_tc(True)"
  62. else "tb.end_tc(False)"
  63. - set in your board config file:
  64. self.tc_lab_denx_get_power_state_tc = 'tc_lab_denx_get_power_state_XXX.py'
  65. Task c) connect to the boards console:
  66. default TC for this task is:
  67. https://github.com/hsdenx/tbot/blob/master/src/tc/tc_lab_denx_connect_to_board.py
  68. - now copy this file to for example
  69. (replace XXX to a proper value)
  70. cp src/tc/tc_lab_denx_connect_to_board.py src/tc/tc_lab_denx_connect_to_board_XXX.py
  71. and adapt the commands to your needs.
  72. If connect fails end this TC with "tb.end_tc(False)"
  73. else call "tb.end_tc(True)"
  74. If you want to use kermit for connecting to the boards console, you
  75. can use:
  76. https://github.com/hsdenx/tbot/blob/master/src/tc/tc_workfd_connect_with_kermit.py
  77. Example for such a board in the VL from denx:
  78. self.tc_lab_denx_connect_to_board_tc = 'tc_workfd_connect_with_kermit.py'
  79. https://github.com/hsdenx/tbot/blob/master/tbot_dxr2.cfg#L24
  80. Hopefully this works for you too.
  81. - set in your board config file:
  82. self.tc_lab_denx_connect_to_board_tc = 'tc_lab_denx_connect_to_board_XXX.py'
  83. remarks while writting this:
  84. - Currently there is only the denx VL. Original idea was to include
  85. other VL through a seperate class/file in
  86. https://github.com/hsdenx/tbot/tree/master/src/lab_api
  87. but it turned out, that if we say "ssh" is the standard way to connect
  88. to a VL, we can integrate the VL specific tasks through testcases, see
  89. above, so we should do:
  90. - rename the "denx" API to a more general name.
  91. This is a point on my ToDo list ... done, renamed to 'ssh_std'
  92. - the VL specific configuration may moved from the board config files
  93. and should be collected in VL specific config files, which boards
  94. config file simple include.
  95. - prepare password.py file:
  96. This file contains all passwords tbot needs (for example for
  97. linux login on the boards)
  98. tbot searches this file in the tbot root directory.
  99. It is a simple python file, for example:
  100. # passwords for the lab
  101. if (board == 'lab'):
  102. if (user == 'hs'):
  103. password = 'passwordforuserhs'
  104. if (user == 'root'):
  105. password = 'passwordforrootuser'
  106. # passwords for the boards
  107. elif (board == 'mcx'):
  108. if (user == 'root'):
  109. password = 'passwordformcxrootfs'
  110. else:
  111. if (user == 'root'):
  112. password = ''
  113. - prepare board config file
  114. Each board which is found in the VL needs a tbot configuration file
  115. pass the config file name with the option '-c' to tbot, tbot searches
  116. in the root dir for them.
  117. board Example (dxr2 board):
  118. https://github.com/hsdenx/tbot/blob/master/tbot_dxr2.cfg
  119. Necessary variables:
  120. line 3: boardname, here it is the "etamin" board
  121. no default value, must be set.
  122. line 4: boardlabname: name used for connecting to the board
  123. may differ from tb.boardname, default tb.boardname
  124. line 5: boardlabpowername: name used for power on/off
  125. may differ from tb.boardname, default tb.boardname
  126. line 6: tftpboardname: name used for tftp subdir (from where
  127. U-Boot loads images for example).
  128. may differ from tb.boardname, default tb.boardname
  129. line 7: labprompt: linux prompt tbot sets
  130. no defaultvalue, must be set (maybe we should introduce
  131. "ttbott" as default ...
  132. line 8: debug: If True, adds debug output on the tbot shell
  133. line 9: debugstatus: enable status debug output on the shell
  134. line 10: ip: Where tbot finds the Lab PC
  135. line 11: user: As which user does tbot logs into the Lab PC
  136. line 12: accept_all: passed to paramiko, accept all connections
  137. line 13: keepalivetimout: passed to paramiko, timeout for sending
  138. keepalive message.
  139. line 14: channel_timeout: passed to paramiko
  140. line 15: loglevel: tbots loglevel for adding entries into the logfile.
  141. line 17: wdt_timeout: timeout in seconds for tbots watchdog.
  142. Watchdog gets triggered if prompt get read.
  143. line 24: tc_lab_denx_connect_to_board_tc: Which TC is used for
  144. connecting to the boards console the TC, here:
  145. https://github.com/hsdenx/tbot/blob/master/src/tc/tc_workfd_connect_with_kermit.py
  146. line 27: uboot_prompt: boards U-Boot prompt
  147. line 28: linux_prompt: boards linux prompt
  148. Now comes a list of variables TC needs, this vary from which TC
  149. you start on the board.
  150. Thats it ... you now can call tbot and hopefully, it works ;-)
  151. Find an example log [3] for calling simple U-Boot TC for setting
  152. an U-Boot Environmentvariable.
  153. If you have problems in setting tbot up, please contact me
  154. (and may give me ssh access to your Lab PC ;-)
  155. If you have running your first TC [3], you may want to write now your own
  156. TC (and hopefully share them), so continue with:
  157. u-boot:tools/tbot/README.create_a_new_testcase
  158. Heiko Schocher <hs@denx.de>
  159. v2 2016.04.26
  160. --------------
  161. [1] tbot Dokumentation:
  162. [2] u-boot:/tools/tbot/README
  163. https://github.com/hsdenx/tbot/blob/master/README.md
  164. tbot-devel@googlegroups.com
  165. [3] Example for a first U-Boot TC which should always work:
  166. (with commandline option "-v" for verbose output):
  167. 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
  168. **** option cfg: tbot_dxr2.cfg log: log/tbot.log tc: tc_ub_setenv.py v 1
  169. ('CUR WORK PATH: ', '/home/hs/data/Entwicklung/tbot')
  170. ('CFGFILE ', 'tbot_dxr2.cfg')
  171. ('LOGFILE ', '/home/hs/data/Entwicklung/tbot/log/tbot.log')
  172. tb_ctrl: Last login: Mon Apr 25 14:52:42 2016 from 87.97.29.27
  173. *************************************************************
  174. BDI2000 Assignment: (last updated: 2015-11-20 12:30 MET)
  175. bdi1 => techem bdi2 => cetec_mx25 bdi3 => lpc3250
  176. bdi4 => - bdi5 => --Rev.B!-- bdi6 => tqm5200s
  177. bdi7 => [stefano] bdi8 => smartweb bdi9 => sigmatek-nand
  178. bdi10 => pcm052 bdi11 => socrates bdi12 => aristainetos
  179. bdi13 => imx53 bdi14 => ib8315 bdi15 => cairo
  180. bdi16 => g2c1 bdi17 => lwe090 bdi18 => symphony
  181. bdi19 => dxr2 bdi20 => ima3-mx6 bdi21 => sama5d3
  182. bdi98 => - bdi99 => - bdi0 => -
  183. Please power off unused systems when you leave! Thanks, wd.
  184. *************************************************************
  185. tb_ctrl: pollux:~ hs $
  186. tb_ctrl: export PS1=ttbott
  187. ttbott
  188. tb_ctrl: stty cols 200
  189. ttbott
  190. tb_ctrl: export TERM=vt200
  191. ttbott
  192. tb_ctrl: echo $COLUMNS
  193. 200
  194. ttbott
  195. tb_con: Last login: Tue Apr 26 06:28:59 2016 from 87.97.29.27
  196. *************************************************************
  197. BDI2000 Assignment: (last updated: 2015-11-20 12:30 MET)
  198. bdi1 => techem bdi2 => cetec_mx25 bdi3 => lpc3250
  199. bdi4 => - bdi5 => --Rev.B!-- bdi6 => tqm5200s
  200. bdi7 => [stefano] bdi8 => smartweb bdi9 => sigmatek-nand
  201. bdi10 => pcm052 bdi11 => socrates bdi12 => aristainetos
  202. bdi13 => imx53 bdi14 => ib8315 bdi15 => cairo
  203. bdi16 => g2c1 bdi17 => lwe090 bdi18 => symphony
  204. bdi19 => dxr2 bdi20 => ima3-mx6 bdi21 => sama5d3
  205. bdi98 => - bdi99 => - bdi0 => -
  206. Please power off unused systems when you leave! Thanks, wd.
  207. *************************************************************
  208. tb_con: pollux:~ hs $
  209. tb_con: export PS1=ttbot
  210. tb_con: t
  211. ttbott
  212. tb_con: stty cols 200
  213. ttbott
  214. tb_con: export TERM=vt200
  215. ttbott
  216. tb_con: echo $COLUMNS
  217. 200
  218. ttbott
  219. tb_con: ssh hs@lena
  220. tb_con: hs@lena's password:
  221. tb_con:
  222. tb_con: Last login: Mon Apr 25 07:03:29 2016 from 192.168.1.1
  223. tb_con: [hs@lena ~]$
  224. tb_con: export PS1=ttbott
  225. ttbott
  226. tb_con: stty cols 200
  227. ttbott
  228. tb_con: export TERM=vt200
  229. ttbott
  230. tb_con: echo $COLUMNS
  231. 200
  232. ttbott
  233. tb_con: kermit
  234. C-Kermit 8.0.211, 10 Apr 2004, for Linux
  235. Copyright (C) 1985, 2004,
  236. Trustees of Columbia University in the City of New York.
  237. Type ? or HELP for help.
  238. (/home/hs/) C-Kermit>
  239. tb_con: set line /dev/ttyUSB0
  240. (/home/hs/) C-Kermit>
  241. tb_con: set speed 115200
  242. /dev/ttyUSB0, 115200 bps
  243. (/home/hs/) C-Kermit>
  244. tb_con: set flow-control none
  245. (/home/hs/) C-Kermit>
  246. tb_con: set carrier-watch off
  247. (/home/hs/) C-Kermit>
  248. tb_con: connect
  249. Connecting to /dev/ttyUSB0, speed 115200
  250. Escape character: Ctrl-\ (ASCII 28, FS): enabled
  251. Type the escape character followed by C to get back,
  252. or followed by ? to see other options.
  253. ----------------------------------------------------
  254. tb_con: <INTERRUPT>
  255. U-Boot#
  256. tb_con: U-Boot#
  257. U-Boot#
  258. tb_con: setenv Heiko Schocher
  259. U-Boot#
  260. tb_con: printenv Heiko
  261. Heiko=Schocher
  262. U-Boot#
  263. [('tc_workfd_ssh.py', 1, 0), ('tc_workfd_connect_with_kermit.py', 1, 0), ('tc_ub_setenv.py', 1, 0)]
  264. End of TBOT: success
  265. hs@localhost:tbot [event-devel] $