Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ endif
# from it through the print-buildroot-version target, so a bump here is enough.
BUILDROOT_VERSION := 2026.08
BUILDROOT_DIR := build/buildroot
# DEFAULT_DTB=nutshell or nutshell-* -> nutshell_defconfig; otherwise xiangshan_defconfig.
BUILDROOT_DEFCONFIG := $(if $(filter nutshell nutshell-%,$(DEFAULT_DTB)),nutshell_defconfig,xiangshan_defconfig)
BUILDROOT_CONFIG_STAMP := build/buildroot-config/$(BUILDROOT_DEFCONFIG)
$(BUILDROOT_DIR)/Makefile:
mkdir -p build
wget https://buildroot.org/downloads/buildroot-$(BUILDROOT_VERSION).tar.gz -O build/buildroot.tar.gz
Expand All @@ -56,17 +59,22 @@ $(BUILDROOT_DIR)/Makefile:
print-buildroot-version:
@echo $(BUILDROOT_VERSION)

$(BUILDROOT_CONFIG_STAMP): br2-external/configs/$(BUILDROOT_DEFCONFIG) $(BUILDROOT_DIR)/Makefile
mkdir -p "$(@D)"
rm -f build/buildroot-config/*
touch $@

# Prepare buildroot SDK
TOOLCHAIN_WRAPPER := $(BUILDROOT_DIR)/output/host/bin/toolchain-wrapper
$(TOOLCHAIN_WRAPPER): br2-external/configs/nemu_defconfig $(BUILDROOT_DIR)/Makefile
$(MAKE) -C $(BUILDROOT_DIR) BR2_EXTERNAL=$(abspath br2-external) nemu_defconfig
$(TOOLCHAIN_WRAPPER): $(BUILDROOT_CONFIG_STAMP)
$(MAKE) -C $(BUILDROOT_DIR) BR2_EXTERNAL=$(abspath br2-external) $(BUILDROOT_DEFCONFIG)
$(MAKE) -C $(BUILDROOT_DIR) BR2_EXTERNAL=$(abspath br2-external) prepare-sdk
touch $(TOOLCHAIN_WRAPPER)

# Build Linux kernel
LINUX_IMAGE := $(BUILDROOT_DIR)/output/images/Image
$(LINUX_IMAGE): $(TOOLCHAIN_WRAPPER) br2-external/configs/nemu_defconfig br2-external/board/openxiangshan/nemu/linux.config
$(MAKE) -C $(BUILDROOT_DIR) BR2_EXTERNAL=$(abspath br2-external) nemu_defconfig
$(LINUX_IMAGE): $(TOOLCHAIN_WRAPPER) $(BUILDROOT_CONFIG_STAMP) br2-external/board/openxiangshan/nemu/linux.config $(if $(filter nutshell_defconfig,$(BUILDROOT_DEFCONFIG)),br2-external/board/openxiangshan/nemu/linux-nutshell.fragment)
$(MAKE) -C $(BUILDROOT_DIR) BR2_EXTERNAL=$(abspath br2-external) $(BUILDROOT_DEFCONFIG)
$(MAKE) -C $(BUILDROOT_DIR) BR2_EXTERNAL=$(abspath br2-external)

# Build GCPT. Single-core firmware keeps LibCheckpointAlpha; LibCheckpoint is
Expand Down Expand Up @@ -217,7 +225,7 @@ prepare-sdk: $(TOOLCHAIN_WRAPPER)

# Download all source files needed by buildroot
source: $(BUILDROOT_DIR)/Makefile
make -C $(BUILDROOT_DIR) BR2_EXTERNAL=$(abspath br2-external) nemu_defconfig
make -C $(BUILDROOT_DIR) BR2_EXTERNAL=$(abspath br2-external) $(BUILDROOT_DEFCONFIG)
make -C $(BUILDROOT_DIR) BR2_EXTERNAL=$(abspath br2-external) source

# Build all all-in-one firmware images
Expand Down
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,20 @@ builds default `GCPT_SERIAL_PORT` to the QEMU 16550A TX register at
## Workload Compatibility

Not all workloads can run on all NEMU or QEMU configurations. QEMU support is
limited to `linux/coremark`, `linux/spec2006`, and `linux/spec2017`; the only workload supported by
`riscv64-nutshell_defconfig` is `linux/hello`, since all other workloads require
hardware floating point, which is not supported by nutshell. RVV related workloads
require the vector ISA extension, and hypervisor related workloads require the
hypervisor ISA extension.
limited to `linux/coremark`, `linux/spec2006`, and `linux/spec2017`. RVV related
workloads require the vector ISA extension, and hypervisor related workloads
require the hypervisor ISA extension.

NutShell uses the RV64IMAC/LP64 software stack. See the
`xiangshan_defconfig` is the XiangShan/NEMU Buildroot tree. NutShell is RV64IMAC;
Linux images use `nutshell_defconfig` (lp64) when `DEFAULT_DTB` is `nutshell`,
`nutshell-mem2g`, or `nutshell-fpga`:

```sh
make linux/hello DEFAULT_DTB=nutshell
make linux/spec2006 BENCH=mcf DEFAULT_DTB=nutshell-mem2g SPEC2006_ISO=/path/to/cpu2006.iso
```

See the
[SPEC2006 configuration](workloads/linux/spec2006/README.md#configuration)
section for `riscv_gcc16_rv64imac_lp64.cfg`.

Expand Down
6 changes: 6 additions & 0 deletions br2-external/board/openxiangshan/nemu/linux-nutshell.fragment
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# NutShell is RV64IMAC. Share linux.config with XiangShan; turn off ISA
# the core does not implement. linux.config enables KVM.
# CONFIG_FPU is not set
# CONFIG_RISCV_ISA_V is not set
# CONFIG_VIRTUALIZATION is not set
# CONFIG_KVM is not set
22 changes: 22 additions & 0 deletions br2-external/configs/nutshell_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# NutShell RV64IMAC/LP64. Bootlin only ships lp64d, so Buildroot builds gcc.
# Keep xiangshan_defconfig for XiangShan/NEMU.
BR2_riscv=y
BR2_riscv_custom=y
BR2_RISCV_ISA_RVM=y
BR2_RISCV_ISA_RVA=y
BR2_RISCV_ISA_RVC=y
BR2_RISCV_64=y
BR2_RISCV_ABI_LP64=y
BR2_TOOLCHAIN_BUILDROOT=y
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
BR2_TARGET_GENERIC_HOSTNAME="nutshell"
BR2_TARGET_GENERIC_ISSUE="NutShell rv64imac/lp64"
BR2_TARGET_GENERIC_ROOT_PASSWD="xiangshan"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="${BR2_EXTERNAL}/board/openxiangshan/nemu/linux.config"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="${BR2_EXTERNAL}/board/openxiangshan/nemu/linux-nutshell.fragment"
BR2_TARGET_ROOTFS_INITRAMFS=y
BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="${BR2_EXTERNAL}/board/openxiangshan/nemu/busybox-taskset.fragment"
BR2_PACKAGE_NEMU_TRAP=y
BR2_PACKAGE_NEMU_EXEC=y
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# XiangShan/NEMU (Bootlin rv64gc). NutShell uses nutshell_defconfig.
BR2_riscv=y
BR2_RISCV_ISA_RVC=y
BR2_TOOLCHAIN_EXTERNAL=y
Expand Down
3 changes: 3 additions & 0 deletions dts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ profiles, FPGA noAIA names, and QEMU `nemu` names of the form
custom template passed through `--custom-template-dir`; otherwise generation
fails with an `unsupported DTS basename` error.

Linux images with `DEFAULT_DTB=nutshell` or `nutshell-*` use
`nutshell_defconfig` (RV64IMAC/LP64) instead of `xiangshan_defconfig`.

`nutshell` is the 128 MiB machine description used by NEMU's
`riscv64-nutshell_defconfig`: uartlite at `0x40600000`, no PLIC.
NutShell simulation uses the same map. `nutshell-mem2g` keeps that
Expand Down
6 changes: 5 additions & 1 deletion workloads/linux/spec2006/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,16 @@ For GCC 15, select:
workloads/linux/spec2006/configs/riscv_gcc15_base.cfg
```

For NutShell, select the RV64IMAC/lp64 configuration:
For NutShell (`DEFAULT_DTB=nutshell`, `nutshell-mem2g`, or `nutshell-fpga`),
the default is the RV64IMAC/lp64 configuration:

```text
workloads/linux/spec2006/configs/riscv_gcc16_rv64imac_lp64.cfg
```

That compiler must be an rv64imac/lp64 `riscv64-unknown-linux-gnu-gcc`, not
the XiangShan RVA23 toolchain that uses the same triple.

Override it with:

```sh
Expand Down
2 changes: 1 addition & 1 deletion workloads/linux/spec2006/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SPEC2006_SCRIPTS_DIR := $(SPEC2006_REPO_ROOT)/scripts
SPEC2006_DTS_DIR := $(SPEC2006_REPO_ROOT)/build/generated-dts
SPEC2006_BUILD_DIR ?= $(SPEC2006_REPO_ROOT)/build/linux-workloads/spec2006
SPEC2006_CASE_CONFIG := $(SPEC2006_WORKLOAD_DIR)/spec06.json
SPEC2006_CFG ?= $(SPEC2006_WORKLOAD_DIR)/configs/gcc16-linux-riscv64-rva23u64_novec.cfg
SPEC2006_CFG ?= $(SPEC2006_WORKLOAD_DIR)/configs/$(if $(filter nutshell nutshell-%,$(DEFAULT_DTB)),riscv_gcc16_rv64imac_lp64.cfg,gcc16-linux-riscv64-rva23u64_novec.cfg)
SPEC2006_HELPER := $(SPEC2006_WORKLOAD_DIR)/spec2006-package.py
QEMU_DEFAULT_DTB ?= xiangshan-qemu-nemu-mem2g
SPEC2006_SOURCE_SPEC_ISO := $(SPEC2006_ISO)
Expand Down
Loading