host.binary_loader¶
Pluggable binary load strategy for embedded hosts.
Loading a binary into a device’s executable runtime — Zephyr’s LLEXT
llext load_hex is the first example — is not a file transfer: there is
no destination file or filesystem, the binary goes straight into the kernel’s
loader. A BinaryLoader is a small stateless value object (mirroring
CommandFrame) that formats the device’s
load/unload commands and reads their output. The host executes; the loader never
touches the session.
A project can register additional loaders via register_binary_loader()
from a .otto init module — the same extension hook
otto.host.command_frame.register_command_frame() follows.
- class otto.host.binary_loader.BinaryLoader¶
Bases:
ABCHow to load/unload a binary into an embedded target’s runtime.
- type_name : ClassVar[str]¶
Lab-data string for this loader (e.g.
'llext-hex'); unique across loaders.
-
max_unload_rounds : ClassVar[int] =
16¶ Cap on the unload-to-eviction loop the host drives (see
otto.host.embedded_host.EmbeddedHost.unload()). Some loaders (LLEXT) refcount a resident binary, so one unload may decrement without evicting.
- abstract load_command(name: str, payload: bytes) str¶
Return the device command that loads payload under name.
- class otto.host.binary_loader.LlextHexLoader¶
Bases:
BinaryLoaderZephyr LLEXT shell loader:
llext load_hex/llext unload.load_hextakes the hex-encoded ELF inline as one shell-command argument. LLEXT refcounts a resident extension, so a full eviction may need severalunloadrounds —is_fully_unloaded()is True only once the shell reportsNo such extension.-
type_name : ClassVar[str] =
'llext-hex'¶ Lab-data string for this loader (e.g.
'llext-hex'); unique across loaders.
- load_command(name: str, payload: bytes) str¶
Return the device command that loads payload under name.
-
type_name : ClassVar[str] =
- otto.host.binary_loader.register_binary_loader(type_name: str, cls: type[BinaryLoader]) None¶
Make a custom
BinaryLoadersubclass available to lab data.Call from an init module listed in
.otto/settings.toml— the same patternotto.host.command_frame.register_command_frame()follows.
- otto.host.binary_loader.build_binary_loader(type_name: str) BinaryLoader¶
Construct the
BinaryLoaderregistered under type_name.