summary refs log tree commit diff
path: root/arch/src/lib.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 /arch/src/lib.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 'arch/src/lib.rs')
-rw-r--r--arch/src/lib.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/src/lib.rs b/arch/src/lib.rs
index 4c5fbed..1f26cb4 100644
--- a/arch/src/lib.rs
+++ b/arch/src/lib.rs
@@ -24,13 +24,18 @@ use resources::SystemAllocator;
 use sync::Mutex;
 use sys_util::{syslog, EventFd, GuestAddress, GuestMemory, GuestMemoryError};
 
+pub enum VmImage {
+    Kernel(File),
+    Bios(File),
+}
+
 /// Holds the pieces needed to build a VM. Passed to `build_vm` in the `LinuxArch` trait below to
 /// create a `RunnableLinuxVm`.
 pub struct VmComponents {
     pub memory_size: u64,
     pub vcpu_count: u32,
     pub vcpu_affinity: Vec<usize>,
-    pub kernel_image: File,
+    pub vm_image: VmImage,
     pub android_fstab: Option<File>,
     pub initrd_image: Option<File>,
     pub extra_kernel_params: Vec<String>,