summary refs log tree commit diff
path: root/aarch64
diff options
context:
space:
mode:
authorGreg Hartman <ghartman@google.com>2019-04-24 02:03:29 +0000
committerchrome-bot <chrome-bot@chromium.org>2019-05-02 21:02:36 -0700
commit5dd8694d77f001f581a3f839621df55f357ca1eb (patch)
tree5355230d7cd13634c3a412e104939073d0cb5a6c /aarch64
parente23231ccffb149108bb9f80d0b467b24153fcbfa (diff)
downloadcrosvm-5dd8694d77f001f581a3f839621df55f357ca1eb.tar
crosvm-5dd8694d77f001f581a3f839621df55f357ca1eb.tar.gz
crosvm-5dd8694d77f001f581a3f839621df55f357ca1eb.tar.bz2
crosvm-5dd8694d77f001f581a3f839621df55f357ca1eb.tar.lz
crosvm-5dd8694d77f001f581a3f839621df55f357ca1eb.tar.xz
crosvm-5dd8694d77f001f581a3f839621df55f357ca1eb.tar.zst
crosvm-5dd8694d77f001f581a3f839621df55f357ca1eb.zip
Add Android fstab support to aarch64, based on x86_64 version
Test: cargo test on x86_64 and aarch64, boot on aarch64
Change-Id: I29fb269abedaaca4168581aa7f92d413d51e9232
Reviewed-on: https://chromium-review.googlesource.com/1585279
Commit-Ready: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Greg Hartman <ghartman@google.com>
Diffstat (limited to 'aarch64')
-rw-r--r--aarch64/src/fdt.rs5
-rw-r--r--aarch64/src/lib.rs29
2 files changed, 21 insertions, 13 deletions
diff --git a/aarch64/src/fdt.rs b/aarch64/src/fdt.rs
index a41494d..9f5b1ab 100644
--- a/aarch64/src/fdt.rs
+++ b/aarch64/src/fdt.rs
@@ -3,6 +3,7 @@
 // found in the LICENSE file.
 
 use std::ffi::CStr;
+use std::fs::File;
 
 use arch::fdt::{
     begin_node, end_node, finish_fdt, generate_prop32, generate_prop64, property, property_cstring,
@@ -308,6 +309,7 @@ fn create_rtc_node(fdt: &mut Vec<u8>) -> Result<()> {
 /// * `pci_device_size` - The size of PCI device memory
 /// * `cmdline` - The kernel commandline
 /// * `initrd` - An optional tuple of initrd guest physical address and size
+/// * `android_fstab` - An optional file holding Android fstab entries
 pub fn create_fdt(
     fdt_max_size: usize,
     guest_mem: &GuestMemory,
@@ -318,6 +320,7 @@ pub fn create_fdt(
     pci_device_size: u64,
     cmdline: &CStr,
     initrd: Option<(GuestAddress, usize)>,
+    android_fstab: File,
 ) -> Result<()> {
     let mut fdt = vec![0; fdt_max_size];
     start_fdt(&mut fdt, fdt_max_size)?;
@@ -328,7 +331,7 @@ pub fn create_fdt(
     property_string(&mut fdt, "compatible", "linux,dummy-virt")?;
     property_u32(&mut fdt, "#address-cells", 0x2)?;
     property_u32(&mut fdt, "#size-cells", 0x2)?;
-
+    arch::android::create_android_fdt(&mut fdt, android_fstab)?;
     create_chosen_node(&mut fdt, cmdline, initrd)?;
     create_memory_node(&mut fdt, guest_mem)?;
     create_cpu_nodes(&mut fdt, num_cpus)?;
diff --git a/aarch64/src/lib.rs b/aarch64/src/lib.rs
index 53e2084..5836575 100644
--- a/aarch64/src/lib.rs
+++ b/aarch64/src/lib.rs
@@ -268,6 +268,7 @@ impl arch::LinuxArch for AArch64 {
             &CString::new(cmdline).unwrap(),
             components.initrd_image,
             pci_irqs,
+            components.android_fstab,
             kernel_end,
         )?;
 
@@ -295,6 +296,7 @@ impl AArch64 {
         cmdline: &CStr,
         initrd_file: Option<File>,
         pci_irqs: Vec<(u32, PciInterruptPin)>,
+        android_fstab: Option<File>,
         kernel_end: u64,
     ) -> Result<()> {
         let initrd = match initrd_file {
@@ -312,18 +314,21 @@ impl AArch64 {
             None => None,
         };
         let (pci_device_base, pci_device_size) = Self::get_device_addr_base_size(mem_size);
-        fdt::create_fdt(
-            AARCH64_FDT_MAX_SIZE as usize,
-            mem,
-            pci_irqs,
-            vcpu_count,
-            fdt_offset(mem_size),
-            pci_device_base,
-            pci_device_size,
-            cmdline,
-            initrd,
-        )
-        .map_err(Error::CreateFdt)?;
+        if let Some(android_fstab) = android_fstab {
+            fdt::create_fdt(
+                AARCH64_FDT_MAX_SIZE as usize,
+                mem,
+                pci_irqs,
+                vcpu_count,
+                fdt_offset(mem_size),
+                pci_device_base,
+                pci_device_size,
+                cmdline,
+                initrd,
+                android_fstab,
+            )
+            .map_err(Error::CreateFdt)?;
+        }
         Ok(())
     }