gem5.components.boards.kernel_disk_workload.html
gem5.components.boards.kernel_disk_workload module¶
- class gem5.components.boards.kernel_disk_workload.KernelDiskWorkload¶
Bases:
object
The purpose of this abstract class is to enable a full-system boot consisting of of a kernel which will then load a disk image.
For this to function correctly, the KernelDiskWorkload class should be added as a superclass to a board and the abstract methods implemented. E.g.:
class X86Board(AbstractBoard, KernelDiskWorkload): ... @overrides(KernelDiskWorkload) def get_default_kernel_args(self) -> List[str]: return [ "earlyprintk=ttyS0", "console=ttyS0", "lpj=7999923", "root={root_value}", ] ...
Note
This assumes only one disk is set.
This assumes the Linux kernel is used.
- append_kernel_arg(arg: str) None ¶
Append a kernel argument to the list of kernel arguments.
- Parameters:
arg – The kernel argument to append.
- abstract get_default_kernel_args() List[str] ¶
Returns a default list of arguments for the workload kernel. We assume the following strings may be used as placeholders, to be replaced when
set_kernel_disk_workload
is executed:{root_value} : set to
get_default_kernel_root_val()
.
- Returns:
A default list of arguments for the workload kernel.
- get_default_kernel_root_val(disk_image: DiskImageResource) str ¶
Get the default kernel root value to be passed to the kernel. This is determined by the user-passed or board-default
disk_device
, and the disk image partition obtained fromget_disk_root_partition()
.- Parameters:
disk_image – The disk image to be added to the system.
- Returns:
The default value for the
root
argument to be passed to the kernel.
- abstract get_disk_device() str ¶
Set a default disk device, in case user does not specify a disk device.
- Returns:
The disk device.
- get_disk_root_partition(disk_image: DiskImageResource) str | None ¶
Obtains the root partition of a disk image by inspecting the resource’s metadata.
- Returns:
The disk image’s root partition.
- set_binary_to_run(application: BinaryResource, args: List[str])¶
Set the binary to run on the board.
The binary could be an application or any executable script. Note: this will override the readfile or readfile_contents set in the set_kernel_disk_workload function.
- Parameters:
application – The binary to run.
args – The arguments to pass to the binary.
- set_kernel_disk_workload(kernel: KernelResource, disk_image: DiskImageResource, bootloader: BootloaderResource | None = None, disk_device: str | None = None, readfile: str | None = None, readfile_contents: str | None = None, kernel_args: List[str] | None = None, exit_on_work_items: bool = True, checkpoint: Path | CheckpointResource | None = None) None ¶
This function allows the setting of a full-system run with a Kernel and a disk image.
- Parameters:
kernel – The kernel to boot.
disk_image – The disk image to mount.
bootloader – The current implementation of the ARM board requires three resources to operate – kernel, disk image, and, a bootloader.
readfile – An optional parameter stating the file to be read by by
m5 readfile
.readfile_contents – An optional parameter stating the contents of the readfile file. If set with
readfile
, the contents of readfile will be overwritten withreadfile_contents
, otherwise a new file will be created with the value ofreadfile_contents
.kernel_args – An optional parameter for setting arguments to be passed to the kernel. By default set to
get_default_kernel_args()
.exit_on_work_items – Whether the simulation should exit on work items.
True
by default.checkpoint – The checkpoint directory. Used to restore the simulation to that checkpoint.