mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
main: Add kernel command line support
In order to let the user choose which kernel parameters to append, the kernel boot parameters can be now specified from the command line. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
committed by
Samuel Ortiz
parent
1270d09301
commit
112418d928
13
src/main.rs
13
src/main.rs
@@ -25,6 +25,12 @@ fn main() {
|
||||
.help("Path to kernel image (vmlinux)")
|
||||
.takes_value(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("cmdline")
|
||||
.long("cmdline")
|
||||
.help("Kernel command line")
|
||||
.takes_value(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("disk")
|
||||
.long("disk")
|
||||
@@ -51,6 +57,11 @@ fn main() {
|
||||
.expect("Missing argument: kernel");
|
||||
let kernel_path = kernel_arg.as_path();
|
||||
|
||||
let cmdline = cmd_arguments
|
||||
.value_of("cmdline")
|
||||
.map(std::string::ToString::to_string)
|
||||
.expect("Missing argument: cmdline");
|
||||
|
||||
let disk_arg = cmd_arguments
|
||||
.value_of("disk")
|
||||
.map(PathBuf::from)
|
||||
@@ -70,7 +81,7 @@ fn main() {
|
||||
println!("VM [{} vCPUS {} MB of memory]", vcpus, memory);
|
||||
println!("Booting {:?}...", kernel_path);
|
||||
|
||||
let vm_config = VmConfig::new(kernel_path, disk_path, vcpus, memory).unwrap();
|
||||
let vm_config = VmConfig::new(kernel_path, disk_path, cmdline, vcpus, memory).unwrap();
|
||||
|
||||
vmm::boot_kernel(vm_config).unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user