diff options
author | Anup Patel <anup.patel@wdc.com> | 2020-02-14 11:31:38 +0530 |
---|---|---|
committer | Chih-Min Chao <chihmin.chao@sifive.com> | 2020-02-19 18:52:32 -0800 |
commit | 08cf745aaab48d67fafc995663ec96757ff6b816 (patch) | |
tree | 186884928fdc24b1b0ead7e32bb8c464d0717fdd /riscv/dts.cc | |
parent | dceafddd8b9ab3cf5fd1f7526ea53ca8bc0e13dc (diff) | |
download | spike-08cf745aaab48d67fafc995663ec96757ff6b816.zip spike-08cf745aaab48d67fafc995663ec96757ff6b816.tar.gz spike-08cf745aaab48d67fafc995663ec96757ff6b816.tar.bz2 |
Make spike capable of booting Linux
Latest Linux does not boot Spike mainly because:
1. Spike does not set bootargs in DTS
2. Spike does not provide mechanism to load initrd for Linux
This patch addresses both above issues and we can now
get latest Linux to prompt on Spike.
Signed-off-by: Anup Patel <anup.patel@wdc.com>
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
Diffstat (limited to 'riscv/dts.cc')
-rw-r--r-- | riscv/dts.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/riscv/dts.cc b/riscv/dts.cc index f730293..246773e 100644 --- a/riscv/dts.cc +++ b/riscv/dts.cc @@ -9,6 +9,7 @@ #include <sys/types.h> std::string make_dts(size_t insns_per_rtc_tick, size_t cpu_hz, + reg_t initrd_start, reg_t initrd_end, std::vector<processor_t*> procs, std::vector<std::pair<reg_t, mem_t*>> mems) { @@ -21,6 +22,15 @@ std::string make_dts(size_t insns_per_rtc_tick, size_t cpu_hz, " #size-cells = <2>;\n" " compatible = \"ucbbar,spike-bare-dev\";\n" " model = \"ucbbar,spike-bare\";\n" + " chosen {\n"; + if (initrd_start < initrd_end) { + s << " bootargs = \"root=/dev/ram console=hvc0 earlycon=sbi\";\n" + " linux,initrd-start = <" << (size_t)initrd_start << ">;\n" + " linux,initrd-end = <" << (size_t)initrd_end << ">;\n"; + } else { + s << " bootargs = \"console=hvc0 earlycon=sbi\";\n"; + } + s << " };\n" " cpus {\n" " #address-cells = <1>;\n" " #size-cells = <0>;\n" |