summary refs log tree commit diff
path: root/src/plugin/mod.rs
diff options
context:
space:
mode:
authorCody Schuffelen <schuffelen@google.com>2019-05-21 12:12:38 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-05-31 17:21:46 -0700
commit6d1ab5094375afb653d9955fe7ccb818eca48665 (patch)
tree863d07e2334dec3f66961afbdcb8a618b08384e1 /src/plugin/mod.rs
parent580d4186562c9c1e5b399885c6c5647cdde15243 (diff)
downloadcrosvm-6d1ab5094375afb653d9955fe7ccb818eca48665.tar
crosvm-6d1ab5094375afb653d9955fe7ccb818eca48665.tar.gz
crosvm-6d1ab5094375afb653d9955fe7ccb818eca48665.tar.bz2
crosvm-6d1ab5094375afb653d9955fe7ccb818eca48665.tar.lz
crosvm-6d1ab5094375afb653d9955fe7ccb818eca48665.tar.xz
crosvm-6d1ab5094375afb653d9955fe7ccb818eca48665.tar.zst
crosvm-6d1ab5094375afb653d9955fe7ccb818eca48665.zip
Initial BIOS support.
The --bios argument is added as an alternative to the kernel positional
argument. The BIOS runs in unreal mode (16-bit cs selector set to the
end of 32-bit address space), which matches the default state KVM puts
the segment and data registers into.

Example usage:
Build u-boot with "make qemu-x86_defconfig && make"
Run crosvm with "crosvm_wrapper.sh run --bios=u-boot.rom"

This produces the following message:
"""
U-Boot 2019.01-00017-gdc76aabe6a-dirty (May 21 2019 - 12:17:02 -0700)

CPU:
DRAM:  16 MiB
unable to get online cpu number: -19
Warning: MP init failure
Model: QEMU x86 (I440FX)
Net:   No ethernet found.
error: can't find etc/table-loader
Hit any key to stop autoboot:  0
=>
"""

At this point the u-boot shell works with stdin/stdout, but virtual
disks passed with --rwdisk weren't immediately visible from running
"virtio scan" and "virtio info".

This change puts the bios loading together with the linux kernel loading
code since there is a lot of overlap in functionality.

Bug: b/133358982
Test: ./crosvm_wrapper.sh run --mem=4097 --bios=u-boot.rom
Change-Id: I65b0e1044233af662a642c592d35b106217f3c13
Reviewed-on: https://chromium-review.googlesource.com/1622648
Commit-Ready: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Diffstat (limited to 'src/plugin/mod.rs')
-rw-r--r--src/plugin/mod.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugin/mod.rs b/src/plugin/mod.rs
index 6fbb9e7..1cb3e57 100644
--- a/src/plugin/mod.rs
+++ b/src/plugin/mod.rs
@@ -38,7 +38,7 @@ use sys_util::{
 
 use self::process::*;
 use self::vcpu::*;
-use crate::Config;
+use crate::{Config, Executable};
 
 const MAX_DATAGRAM_SIZE: usize = 4096;
 const MAX_VCPU_DATAGRAM_SIZE: usize = 0x40000;
@@ -598,7 +598,10 @@ pub fn run_config(cfg: Config) -> Result<()> {
 
     let plugin_args: Vec<&str> = cfg.params.iter().map(|s| &s[..]).collect();
 
-    let plugin_path = cfg.plugin.as_ref().unwrap().as_path();
+    let plugin_path = match cfg.executable_path {
+        Some(Executable::Plugin(ref plugin_path)) => plugin_path.as_path(),
+        _ => panic!("Executable was not a plugin"),
+    };
     let vcpu_count = cfg.vcpu_count.unwrap_or(1);
     let mem = GuestMemory::new(&[]).unwrap();
     let kvm = Kvm::new().map_err(Error::CreateKvm)?;