[tbot] [DENX] tbot: board hangs if no autoload
Stefano Babic
sbabic at denx.de
Fri Nov 16 09:19:03 UTC 2018
Hi Heiko,
On 16/11/18 08:19, Heiko Schocher wrote:
> Hello Harald,
>
> Am 16.11.2018 um 06:41 schrieb Heiko Schocher:
>> Hello Harald, Stefano,
>>
>> Am 15.11.2018 um 19:22 schrieb Stefano Babic:
>>> Hi Harald,
>>>
>>> On 15/11/18 16:59, Harald Seiler wrote:
>>>> Hi Stefano, Heiko,
> [...]
>>>> If you want a board to work in multiple labs, you could make
>>>> the board-config check which lab was selected and use a different
>>>> base class depending on that:
>>>>
>>>> if tbot.selectable.LabHost.name == "pollux":
>>>> # Use pollux specific config
>>>> import denx
>>>> BoardBase = denx.DenxBoard
-- there is a nitpick, here is "BoardBase", later
"BaseBoard". Of course, they have to match.
>>>> elif tbot.selectable.LabHost.name == "sbabic":
>>>> # Use your personal lab config
>>>> import sbabic
>>>> BoardBase = sbabic.SbabicBoard
>>>> else:
>>>> raise NotImplementedError("Board not available on this
>>>> labhost!")
>>>>
>>>> class Mira(BaseBoard):
>>>> ...
>>>
>>> Good idea, thanks, I will do in this way.
>>
>> I try it.
>
> Doe not work for me ... I am a dummy pyhton user ...
>
> I have:
>
> class Tbot2goLab(lab.SSHLabHost):
>
> @property
> def name(self) -> str:
> return "tbot2go"
>
> namestr = "tbot2go"
>
> (namestr only for testing)
>
> If I add in your example:
>
> print(" ======= ", tbot.selectable.LabHost.name,
> tbot.selectable.LabHost.namestr)
>
> if tbot.selectable.LabHost.name == "pollux":
>
> I see:
>
> TBot starting ...
> ======= <property object at 0x7f2e67756b38> tbot2go
>
> So tbot.selectable.LabHost.name does not return the string ...
>
> tbot.selectable.LabHost.name() also does not work:
>
> TBot starting ...
> ======= <property object at 0x7f8e45febb38> tbot2go
> Traceback (most recent call last):
> File "/home/hs/.local/bin/tbot", line 12, in <module>
> sys.exit(main())
> File
> "/home/hs/.local/lib/python3.6/site-packages/tbot-0.6.0-py3.6.egg/tbot/main.py",
> line 177, in main
> board = loader.load_module(pathlib.Path(args.board).resolve())
> File
> "/home/hs/.local/lib/python3.6/site-packages/tbot-0.6.0-py3.6.egg/tbot/loader.py",
> line 63, in load_module
> module_spec.loader.exec_module(module)
> File "<frozen importlib._bootstrap_external>", line 678, in exec_module
> File "<frozen importlib._bootstrap>", line 219, in
> _call_with_frames_removed
> File "/home/hs/data/Entwicklung/newtbot/tbot-tbot2go/boards/k30rf.py",
> line 7, in <module>
> print(" ======= ", tbot.selectable.LabHost.name())
> TypeError: 'property' object is not callable
>
It works fine for me - this is my board definition for mira:
from tbot.machine import board
from tbot.machine import linux
import tbot
if tbot.selectable.LabHost.name == "pollux":
# Use pollux specific config
import denx
BaseBoard = denx.DenxBoard
elif tbot.selectable.LabHost.name == "local":
import augsburg
# Use your personal lab config
BaseBoard = augsburg.MylabBoard
else:
raise NotImplementedError("Board not available on this labhost!")
class mira(BaseBoard):
name = "mira"
class miraUBoot(board.UBootMachine[mira]):
prompt = "=> "
class miraLinux(board.LinuxWithUBootMachine[mira]):
uboot = miraUBoot
username = "root"
password = None
shell = linux.shell.Bash
boot_commands = [
["echo", "Hello", "U-Boot"],
["run", "net_nfs"],
]
BOARD = mira
UBOOT = miraUBoot
LINUX = miraLinux
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: sbabic at denx.de
=====================================================================
More information about the tbot
mailing list