MCPcopy Create free account
hub / github.com/ClangBuiltLinux/boot-utils / run_kernel

Function run_kernel

boot-uml.py:42–56  ·  view source on GitHub ↗

Run UML command with path to rootfs and additional arguments based on user input. Parameters: * kernel_image (Path): kernel Path object containing full path to kernel. * rootfs (Path): rootfs Path object containing full path to rootfs. * interactive (bool): Whet

(kernel_image: Path, rootfs: Path, interactive: bool)

Source from the content-addressed store, hash-verified

40
41
42def run_kernel(kernel_image: Path, rootfs: Path, interactive: bool) -> None:
43 """
44 Run UML command with path to rootfs and additional arguments based on user
45 input.
46
47 Parameters:
48 * kernel_image (Path): kernel Path object containing full path to kernel.
49 * rootfs (Path): rootfs Path object containing full path to rootfs.
50 * interactive (bool): Whether or not to run UML interactively.
51 """
52 uml_cmd = [kernel_image, f"ubd0={rootfs}"]
53 if interactive:
54 uml_cmd += ["init=/bin/sh"]
55 print(f"$ {' '.join([str(element) for element in uml_cmd])}")
56 subprocess.run(uml_cmd, check=True)
57
58
59if __name__ == '__main__':

Callers 1

boot-uml.pyFile · 0.85

Calls 1

runMethod · 0.45

Tested by

no test coverage detected