main: Make supplying the commandline optional

If no commandline is supplied replace with an empty string. No kernel
commandline is needed when using the firmware to boot.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2019-05-10 10:52:15 +01:00 committed by Samuel Ortiz
parent 2c94529660
commit adb0abf400

View File

@ -69,17 +69,21 @@ 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)
.expect("Missing argument: disk");
let disk_path = disk_arg.as_path();
let cmdline = if cmd_arguments.is_present("cmdline") {
cmd_arguments
.value_of("cmdline")
.map(std::string::ToString::to_string)
.unwrap()
} else {
String::new()
};
let mut net_params = None;
if cmd_arguments.is_present("net") {
if let Some(net) = cmd_arguments.value_of("net") {