Skip to content

Commit

Permalink
Merge pull request rcore-os#206 from elliott10/xly-master
Browse files Browse the repository at this point in the history
Parsing kernel command line from device tree to CI test
  • Loading branch information
chyyuu authored Aug 13, 2021
2 parents b515d7f + 83edc1e commit d6e251a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Reimplement [Zircon][zircon] microkernel in safe Rust as a userspace program!

## Quick start for RISCV64
```
make rv64-image
make riscv-image
cd zCore
make run arch=riscv64 linux=1
```
Expand Down
12 changes: 11 additions & 1 deletion zCore/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,18 @@ pub extern "C" fn rust_main(hartid: usize, device_tree_paddr: usize) -> ! {
dtb: device_tree_vaddr,
});

use alloc::{format, string::ToString};
use kernel_hal_bare::virtio::CMDLINE;
let cmdline_dt = CMDLINE.read();
let mut cmdline = boot_info.cmdline.to_string();

if !cmdline_dt.is_empty() {
cmdline = format!("{}:{}", boot_info.cmdline, cmdline_dt);
};
warn!("cmdline: {:?}", cmdline);

// 正常由bootloader载入文件系统镜像到内存, 这里不用,而使用后面的virtio
main(&mut [], boot_info.cmdline);
main(&mut [], &cmdline);
}

#[cfg(feature = "linux")]
Expand Down

0 comments on commit d6e251a

Please sign in to comment.