pyplugins.hyper.uboot module¶
U-Boot Plugin¶
This module implements a plugin for the Penguin hypervisor environment that simulates U-Boot environment variable
management. It provides handlers for U-Boot hypercalls such as fw_setenv, fw_getenv, and fw_printenv, allowing
the guest to set, get, and print U-Boot environment variables. All changes are logged to a file for auditing.
Usage¶
The plugin is loaded by the Penguin framework and responds to U-Boot-related hypercalls.
Example Log Output¶
bootcmd=run boot_flash
baudrate=115200
ethaddr
Arguments¶
outdir: Output directory for the U-Boot log file.conf: Configuration dictionary, may containuboot_envfor initial environment.verbose: If set, enables debug logging.
Classes¶
UBoot: Main plugin class for handling U-Boot environment variable operations.
- class pyplugins.hyper.uboot.UBoot[source]¶
Bases:
PluginUBoot is a plugin that simulates U-Boot environment variable management.
Arguments: - outdir (str): Output directory for the U-Boot log file. - conf (dict): Configuration dictionary, may contain uboot_env for initial environment. - verbose (bool): Enables debug logging if True.
- cmd_fw_getenv(var)[source]¶
Get the value of a U-Boot environment variable.
Parameters: - var (str): The environment variable name.
Returns: - (int, str): Tuple containing status code (0 for success, 1 if not found) and the value or empty string.
- Parameters:
var (str)
- Return type:
tuple[int, str]
- cmd_fw_printenv(arg)[source]¶
Print the U-Boot environment variables.
Parameters: - arg (str): Argument for printenv (unused).
Raises: NotImplementedError
Returns: None
- Parameters:
arg (str)
- Return type:
None
- cmd_fw_setenv(var, val)[source]¶
Set a U-Boot environment variable and log the change.
Parameters: - var (str): The environment variable name. - val (str): The value to set.
Returns: - (int, str): Tuple containing status code (0 for success) and an empty string.
- Parameters:
var (str)
val (str)
- Return type:
tuple[int, str]