Skip to content

Commit 78c7e90

Browse files
authored
Merge pull request #5 from project-inochi/upstream-1
buildroot: Add initial upstreamd buildroot support (sim with hypervisor)
2 parents ae0c080 + addf0fb commit 78c7e90

20 files changed

Lines changed: 382 additions & 288 deletions

buildroot/Config.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
source "$BR2_EXTERNAL_NAXRISCV_SIM_PATH/package/opensbi-ext/Config.in"
21

buildroot/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
```
55
cd $NAXRISCV/..
66
export NAX_SOFTWARE=$NAXRISCV/ext/NaxSoftware
7-
git clone https://github.com/buildroot/buildroot.git --branch master
7+
git clone https://github.com/buildroot/buildroot.git --branch 2026.02.x
88
cd buildroot
9-
git checkout 9ef54b7d
109
$NAX_SOFTWARE/buildroot/naxriscv_sim_setup.sh rv32ima
1110
make BR2_EXTERNAL=$NAX_SOFTWARE/buildroot/ naxriscv_sim_defconfig
1211
make
@@ -15,10 +14,11 @@ make
1514
## Opensbi
1615

1716
```
18-
git clone https://github.com/riscv-software-src/opensbi.git --branch v0.8
17+
git clone https://github.com/riscv-software-src/opensbi.git --branch v1.8.1
1918
cd opensbi
19+
git am $NAX_SOFTWARE/buildroot/opensbi/0001-spinal-sim-related-device.patch
2020
export CROSS_COMPILE=riscv64-unknown-elf-
21-
make PLATFORM_RISCV_XLEN=64 PLATFORM_RISCV_ABI=lp64d PLATFORM_RISCV_ISA=rv64gc PLATFORM=out-of-tree
21+
make PLATFORM_RISCV_XLEN=64 PLATFORM_RISCV_ABI=lp64d BUILD_INFO=y DEBUG=1 FW_PIC=y PLATFORM=generic FW_TEXT_START=0x80000000 FW_JUMP_ADDR=0x80400000 FW_JUMP_FDT_ADDR=0x80F80000
2222
```
2323

2424
## How to run sim
@@ -33,4 +33,4 @@ Follow the readme to build the simulator, then
3333
--load-bin $LINUX_IMAGES/rootfs.cpio,0x81000000
3434
```
3535

36-
<3
36+
<3

buildroot/boards/naxriscv_sim/linux/linux_raw.config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ CONFIG_SECTION_MISMATCH_WARN_ONLY=y
22

33
## Architecture
44
CONFIG_ARCH_DEFCONFIG="arch/riscv/configs/defconfig"
5+
CONFIG_NONPORTABLE=y
56
#ifdef RV32
67
CONFIG_ARCH_RV32I=y
78
#endif
@@ -17,6 +18,10 @@ CONFIG_FPU=y
1718
#else
1819
CONFIG_FPU=n
1920
#endif
21+
#ifdef RVH
22+
CONFIG_VIRTUALIZATION=y
23+
CONFIG_KVM=y
24+
#endif
2025
CONFIG_SMP=y
2126
CONFIG_STRICT_KERNEL_RWX=n
2227
CONFIG_EFI=n

buildroot/boards/naxriscv_sim/linux/linux_raw.dts

Lines changed: 55 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,62 @@
33
##include <dt-bindings/input/input.h>
44
##include <dt-bindings/interrupt-controller/irq.h>
55

6+
/ {
7+
compatible = "spinal,vexiiriscv";
8+
##address-cells = <1>;
9+
##size-cells = <1>;
610

11+
chosen {
12+
bootargs = "rootwait console=hvc0 earlycon=sbi root=/dev/ram0 init=/sbin/init";
13+
linux,initrd-start = <0x81000000>;
14+
linux,initrd-end = <0x81800000>;
15+
};
716

8-
/ {
9-
##address-cells = <0x1>;
10-
##size-cells = <0x1>;
11-
compatible = "spinal,naxriscv";
12-
model = "spinal,naxriscv_sim";
13-
14-
chosen {
15-
bootargs = "rootwait console=hvc0 earlycon=sbi root=/dev/ram0 init=/sbin/init";
16-
linux,initrd-start = <0x81000000>;
17-
linux,initrd-end = <0x81800000>;
18-
};
19-
20-
cpus {
21-
##address-cells = <0x1>;
22-
##size-cells = <0x0>;
23-
timebase-frequency = <100000000>;
24-
cpu@0 {
25-
device_type = "cpu";
26-
compatible = "riscv";
27-
riscv,isa = ISA_STR;
28-
mmu-type = MMU_TYPE;
29-
reg = <0>;
30-
status = "okay";
31-
L0: interrupt-controller {
32-
##interrupt-cells = <0x00000001>;
33-
interrupt-controller;
34-
compatible = "riscv,cpu-intc";
35-
};
36-
};
37-
};
38-
39-
memory@80000000 {
40-
device_type = "memory";
41-
reg = <0x80400000 0x0FC00000>;
42-
};
43-
};
17+
cpus {
18+
##address-cells = <1>;
19+
##size-cells = <0>;
20+
timebase-frequency = <100000000>;
21+
22+
cpu@0 {
23+
compatible = "spinal,vexiiriscv", "riscv";
24+
reg = <0>;
25+
device_type = "cpu";
26+
mmu-type = MMU_TYPE;
27+
riscv,isa-base = ISA_BASE;
28+
riscv,isa-extensions = ISA_STR;
29+
30+
cpu0_intc: interrupt-controller {
31+
compatible = "riscv,cpu-intc";
32+
interrupt-controller;
33+
##interrupt-cells = <1>;
34+
};
35+
};
36+
};
4437

38+
memory@80000000 {
39+
device_type = "memory";
40+
reg = <0x80000000 0x40000000>;
41+
};
4542

43+
soc {
44+
compatible = "simple-bus";
45+
##address-cells = <1>;
46+
##size-cells = <1>;
47+
ranges;
48+
49+
serial0: serial@10000000 {
50+
compatible = "spinal,vexiiriscv-uart";
51+
reg = <0x10000000 0x1000>;
52+
};
53+
54+
clint: timer@10010000 {
55+
compatible = "sifive,clint0";
56+
reg = <0x10010000 0x10000>;
57+
interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>;
58+
};
59+
};
60+
61+
poweroff {
62+
compatible = "spinal-poweroff";
63+
};
64+
};

buildroot/boards/naxriscv_sim/opensbi/config_raw.mk

Lines changed: 0 additions & 30 deletions
This file was deleted.

buildroot/boards/naxriscv_sim/opensbi/objects.mk

Lines changed: 0 additions & 12 deletions
This file was deleted.

buildroot/boards/naxriscv_sim/opensbi/platform.c

Lines changed: 0 additions & 156 deletions
This file was deleted.

0 commit comments

Comments
 (0)