diff options
author | Lepton Wu <lepton@chromium.org> | 2020-05-15 17:11:13 -0700 |
---|---|---|
committer | Lepton Wu <lepton@chromium.org> | 2020-05-20 22:16:23 +0000 |
commit | 1de5def170a96d8a5d6a50a1759128e4554e2bc2 (patch) | |
tree | 0f97fd31d64dc0801720d9551bd9362225a1ad3f | |
parent | 43b1bc8f8ff7ff04b054374538ecad4a4525d283 (diff) | |
download | crosvm-1de5def170a96d8a5d6a50a1759128e4554e2bc2.tar crosvm-1de5def170a96d8a5d6a50a1759128e4554e2bc2.tar.gz crosvm-1de5def170a96d8a5d6a50a1759128e4554e2bc2.tar.bz2 crosvm-1de5def170a96d8a5d6a50a1759128e4554e2bc2.tar.lz crosvm-1de5def170a96d8a5d6a50a1759128e4554e2bc2.tar.xz crosvm-1de5def170a96d8a5d6a50a1759128e4554e2bc2.tar.zst crosvm-1de5def170a96d8a5d6a50a1759128e4554e2bc2.zip |
Put files in device tree for Android
With this, Android can access files from host in early stage so it can import properties from host. To avoid introduce more command line flags, just reuse the fstab file: any entries begin with #dt-vendor means a host side file need to be put in device tree. BUG=b:155128030 TEST=manual - Run ARCVM and check there is file under sysfs Change-Id: I6b209e05faabd3a82fe0194cf462ee450918ae5c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2203298 Reviewed-by: Chirantan Ekbote <chirantan@chromium.org> Tested-by: Lepton Wu <lepton@chromium.org> Auto-Submit: Lepton Wu <lepton@chromium.org>
-rw-r--r-- | arch/src/android.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/src/android.rs b/arch/src/android.rs index 3d459d4..5311d3f 100644 --- a/arch/src/android.rs +++ b/arch/src/android.rs @@ -31,9 +31,17 @@ pub fn create_android_fdt(fdt: &mut Vec<u8>, fstab: File) -> Result<()> { begin_node(fdt, "firmware")?; begin_node(fdt, "android")?; property_string(fdt, "compatible", "android,firmware")?; + + let (dtprop, fstab): (_, Vec<_>) = vecs.into_iter().partition(|x| x[0] == "#dt-vendor"); + begin_node(fdt, "vendor")?; + for vec in dtprop { + let content = std::fs::read_to_string(&vec[2]).map_err(Error::FdtIoError)?; + property_string(fdt, &vec[1], &content); + } + end_node(fdt)?; // vendor begin_node(fdt, "fstab")?; property_string(fdt, "compatible", "android,fstab")?; - for vec in vecs { + for vec in fstab { let partition = &vec[1][1..]; begin_node(fdt, partition)?; property_string(fdt, "compatible", &("android,".to_owned() + partition))?; |