summary refs log tree commit diff
path: root/src/main.rs
diff options
context:
space:
mode:
authorDaniel Verkamp <dverkamp@chromium.org>2018-12-11 16:29:26 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-02-07 03:02:08 -0800
commite403f5ccd0581ec62fbfb86de00b8c01958ffa67 (patch)
tree8bc44cbdeba1e57780a27d8092918b00a870bb54 /src/main.rs
parente54b33834c6adba8921947330583afa19fbd100a (diff)
downloadcrosvm-e403f5ccd0581ec62fbfb86de00b8c01958ffa67.tar
crosvm-e403f5ccd0581ec62fbfb86de00b8c01958ffa67.tar.gz
crosvm-e403f5ccd0581ec62fbfb86de00b8c01958ffa67.tar.bz2
crosvm-e403f5ccd0581ec62fbfb86de00b8c01958ffa67.tar.lz
crosvm-e403f5ccd0581ec62fbfb86de00b8c01958ffa67.tar.xz
crosvm-e403f5ccd0581ec62fbfb86de00b8c01958ffa67.tar.zst
crosvm-e403f5ccd0581ec62fbfb86de00b8c01958ffa67.zip
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 <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1407221
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs6
1 files changed, 6 insertions, 0 deletions
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<usize>,
     kernel_path: PathBuf,
     android_fstab: Option<PathBuf>,
+    initrd_path: Option<PathBuf>,
     params: Vec<String>,
     socket_path: Option<PathBuf>,
     plugin: Option<PathBuf>,
@@ -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",