From e403f5ccd0581ec62fbfb86de00b8c01958ffa67 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Tue, 11 Dec 2018 16:29:26 -0800 Subject: linux: add support for loading an initrd Based on Linux boot protocol references: - x86: Documentation/x86/boot.txt - arm: Documentation/devicetree/bindings/chosen.txt BUG=None TEST=Boot Alpine Linux netboot initrd on x86_64 and aarch64 Change-Id: If4730765638f0a0b8bb8f63203c98e4765a354ee Signed-off-by: Daniel Verkamp Reviewed-on: https://chromium-review.googlesource.com/1407221 Tested-by: kokoro --- src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 31019f9..8a4fce0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -96,6 +96,7 @@ pub struct Config { memory: Option, kernel_path: PathBuf, android_fstab: Option, + initrd_path: Option, params: Vec, socket_path: Option, plugin: Option, @@ -130,6 +131,7 @@ impl Default for Config { memory: None, kernel_path: PathBuf::default(), android_fstab: None, + initrd_path: None, params: Vec::new(), socket_path: None, plugin: None, @@ -569,6 +571,9 @@ fn set_argument(cfg: &mut Config, name: &str, value: Option<&str>) -> argument:: "split-irqchip" => { cfg.split_irqchip = true; } + "initrd" => { + cfg.initrd_path = Some(PathBuf::from(value.unwrap().to_owned())); + } "help" => return Err(argument::Error::PrintHelp), _ => unreachable!(), } @@ -579,6 +584,7 @@ fn run_vm(args: std::env::Args) -> std::result::Result<(), ()> { let arguments = &[Argument::positional("KERNEL", "bzImage of kernel to run"), Argument::value("android-fstab", "PATH", "Path to Android fstab"), + Argument::short_value('i', "initrd", "PATH", "Initial ramdisk to load."), Argument::short_value('p', "params", "PARAMS", -- cgit 1.4.1