Compare commits
No commits in common. "ccf41b441d8400c4648d45fa8d1ca009fa0a9e39" and "f19f5b19ae15b32ac5999345595aac0d68d23ab2" have entirely different histories.
ccf41b441d
...
f19f5b19ae
14
JOURNAL.md
14
JOURNAL.md
@ -5291,17 +5291,3 @@ benchmarks too.
|
|||||||
|
|
||||||
At some point we may want to be able to specify the bootcmd from fpgactl
|
At some point we may want to be able to specify the bootcmd from fpgactl
|
||||||
directly.
|
directly.
|
||||||
|
|
||||||
## 2024-10-11
|
|
||||||
|
|
||||||
Another successful execution of SPEC mini:
|
|
||||||
|
|
||||||
<https://pm.bsc.es/gitlab/rarias/nixos-riscv/-/jobs/34518>
|
|
||||||
|
|
||||||
benchmark size tune iter time_s
|
|
||||||
600.perlbench_s test base 1 5380.726590000
|
|
||||||
602.gcc_s test base 1 2.525468000
|
|
||||||
605.mcf_s test base 1 1927.921307000
|
|
||||||
620.omnetpp_s test base 1 1110.200756000
|
|
||||||
641.leela_s test base 1 779.333069000
|
|
||||||
648.exchange2_s test base 1 2916.464893000
|
|
||||||
|
52
README.md
52
README.md
@ -2,49 +2,45 @@
|
|||||||
|
|
||||||
This repository contains NixOS configurations for different RISC-V machines.
|
This repository contains NixOS configurations for different RISC-V machines.
|
||||||
|
|
||||||
## Lagarto Ox on FPGA Alveo U55C
|
## QEMU
|
||||||
|
|
||||||
To build the system and boot it on an FPGA of the MEEP cluster, you can run the
|
To boot the system in QEMU, first enter the development shell:
|
||||||
following:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
$ nix develop -L '.#lagarto-ox' --command fpga/run-remotely.sh fpgalogin1:ci
|
$ nix develop
|
||||||
```
|
```
|
||||||
|
|
||||||
To do it manually, you can first enter the development shell:
|
Then run the boot script:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ nix develop -L '.#lagarto-ox'
|
$ ./boot.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
Then upload the files to the target machine (fpgalogin1 by default):
|
To prevent the GC from erasing the system:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ nix build .#devShells.x86_64-linux.default --out-link result-env
|
||||||
|
```
|
||||||
|
|
||||||
|
## Lagarto Hun on FPGA Alveo U55C
|
||||||
|
|
||||||
|
First build required dependencies:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ nix develop '.#lagarto-hun'
|
||||||
|
```
|
||||||
|
|
||||||
|
Then upload to destination:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ fpga/upload.sh
|
$ fpga/upload.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
Then connect to the fpgalogin1 machine, allocate a FPGA node and load the
|
And then boot the system there:
|
||||||
environment there:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
$ cd nixos
|
cucu$ ./boot.sh
|
||||||
$ . env.sh
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
Flash the images to the FPGA:
|
In the U-Boot prompt, paste the commands of the `uboot.env` file.
|
||||||
|
|
||||||
```
|
|
||||||
$ ./fpgactl -w bitstream.bit -b opensbi.bin -k kernel.bin -i initrd.bin -r rootfs.img
|
|
||||||
```
|
|
||||||
|
|
||||||
And monitor the serial line:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ picocom -q -b 115200 $FPGACTL_UART
|
|
||||||
```
|
|
||||||
|
|
||||||
It should boot without any user interaction.
|
|
||||||
|
|
||||||
## Lagarto Hun
|
|
||||||
|
|
||||||
WIP
|
|
||||||
|
@ -205,7 +205,7 @@
|
|||||||
* property is described in
|
* property is described in
|
||||||
* Documentation/devicetree/bindings/riscv/cpus.yaml
|
* Documentation/devicetree/bindings/riscv/cpus.yaml
|
||||||
*/
|
*/
|
||||||
clint: clint@CLINT_ADDR {
|
clint: clint@40100000 {
|
||||||
reg = /bits/ 64 <CLINT_ADDR CLINT_SIZE>;
|
reg = /bits/ 64 <CLINT_ADDR CLINT_SIZE>;
|
||||||
reg-names = "control";
|
reg-names = "control";
|
||||||
interrupts-extended = <&HLIC0 3>, <&HLIC0 7>;
|
interrupts-extended = <&HLIC0 3>, <&HLIC0 7>;
|
||||||
@ -217,8 +217,8 @@
|
|||||||
/* There is another auxiliar clint (timer) at 40010000 for
|
/* There is another auxiliar clint (timer) at 40010000 for
|
||||||
* tests, but we don't tell the kernel so we can use it for
|
* tests, but we don't tell the kernel so we can use it for
|
||||||
* testing interrupts manually. */
|
* testing interrupts manually. */
|
||||||
aux_timer: clint@AUXTIMER_ADDR {
|
aux_timer: clint@40010000 {
|
||||||
reg = /bits/ 64 <AUXTIMER_ADDR AUXTIMER_SIZE>;
|
reg = /bits/ 64 <0x0 0x40010000 0x0 0x00010000>;
|
||||||
reg-names = "control";
|
reg-names = "control";
|
||||||
interrupts = <4>; /* PLIC input source 4 */
|
interrupts = <4>; /* PLIC input source 4 */
|
||||||
interrupt-parent = <&PLIC>;
|
interrupt-parent = <&PLIC>;
|
||||||
@ -227,23 +227,23 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_SPI
|
#ifdef ENABLE_SPI
|
||||||
serial@UART2_ADDR {
|
uart16750: serial@40005000 {
|
||||||
compatible = "ns16750";
|
compatible = "ns16750";
|
||||||
reg = /bits/ 64 <UART2_ADDR UART2_SIZE>;
|
reg = <0x00000000 0x40005000 0x00000000 0x00001000>;
|
||||||
interrupt-parent = <&PLIC>;
|
interrupt-parent = <&PLIC>;
|
||||||
interrupts = <5>;
|
interrupts = <5>;
|
||||||
clock-frequency = <CPU_FREQ>;
|
clock-frequency = <CPU_FREQ>;
|
||||||
current-speed = <UART2_SPEED>;
|
current-speed = <0x0001c200>;
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
spi@SPI_ADDR {
|
spi0: spi@40007000 {
|
||||||
compatible = "ti,keystone-spi";
|
compatible = "ti,keystone-spi";
|
||||||
reg = /bits/ 64 <SPI_ADDR SPI_SIZE>;
|
reg = <0x00000000 0x40007000 0x00000000 0x00001000>;
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
interrupt-parent = <&PLIC>;
|
interrupt-parent = <&PLIC>;
|
||||||
interrupt-names = "intvec0", "intvec1";
|
interrupt-names = "intvec0", "intvec1";
|
||||||
interrupts = <6 0>, <7 0>;
|
interrupts = <6 0>, <0x00000007 0>;
|
||||||
ti,davinci-spi-intr-line = <0>;
|
ti,davinci-spi-intr-line = <0>;
|
||||||
spi-max-frequency = <24000000>;
|
spi-max-frequency = <24000000>;
|
||||||
loopback-mode = <1>;
|
loopback-mode = <1>;
|
||||||
|
@ -1,13 +1,3 @@
|
|||||||
/* Toggles */
|
|
||||||
|
|
||||||
#define ENABLE_UART0
|
|
||||||
#define ENABLE_UART1
|
|
||||||
#define ENABLE_ETHERNET
|
|
||||||
#define ENABLE_AXIDMA
|
|
||||||
#define ENABLE_PLIC
|
|
||||||
#define ENABLE_CLINT
|
|
||||||
//#define ENABLE_SPI
|
|
||||||
|
|
||||||
#define CPU_FREQ 50000000 /* 50 MHz */
|
#define CPU_FREQ 50000000 /* 50 MHz */
|
||||||
/* FIXME: The real RTC frequency is around half that, as the divider was wrongly
|
/* FIXME: The real RTC frequency is around half that, as the divider was wrongly
|
||||||
* configured. So for now lets use the real frequency:
|
* configured. So for now lets use the real frequency:
|
||||||
@ -19,8 +9,7 @@
|
|||||||
* [0x0_4000_0000, 0x0_6000_0000) -> IO (512 MiB)
|
* [0x0_4000_0000, 0x0_6000_0000) -> IO (512 MiB)
|
||||||
* [0x0_6000_0000, 0x0_7000_0000) -> DMA pool (256 MiB)
|
* [0x0_6000_0000, 0x0_7000_0000) -> DMA pool (256 MiB)
|
||||||
* [0x0_7000_0000, 0x0_8000_0000) -> DMA pool (256 MiB)
|
* [0x0_7000_0000, 0x0_8000_0000) -> DMA pool (256 MiB)
|
||||||
* [0x0_8000_0000, 0x1_8000_0000) -> RAM memory (4 GiB)
|
* [0x0_8000_0000, 0x1_c000_0000) -> RAM memory (5 GiB)
|
||||||
* [0x1_8000_0000, 0x1_c000_0000) -> Unused (1 GiB)
|
|
||||||
* [0x1_c000_0000, 0x2_8000_0000) -> PMEM (3 GiB)
|
* [0x1_c000_0000, 0x2_8000_0000) -> PMEM (3 GiB)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -32,14 +21,6 @@
|
|||||||
#define UART1_ADDR 0x40003000
|
#define UART1_ADDR 0x40003000
|
||||||
#define UART1_SIZE 0x00001000
|
#define UART1_SIZE 0x00001000
|
||||||
|
|
||||||
/* UART2 via SPI */
|
|
||||||
#define UART2_SPEED UART0_SPEED
|
|
||||||
#define UART2_ADDR 0x40005000
|
|
||||||
#define UART2_SIZE 0x00001000
|
|
||||||
|
|
||||||
#define SPI_ADDR 0x40007000
|
|
||||||
#define SPI_SIZE 0x00001000
|
|
||||||
|
|
||||||
#define AUXTIMER_ADDR 0x40010000
|
#define AUXTIMER_ADDR 0x40010000
|
||||||
#define AUXTIMER_SIZE 0x00010000
|
#define AUXTIMER_SIZE 0x00010000
|
||||||
|
|
||||||
@ -54,12 +35,7 @@
|
|||||||
|
|
||||||
#define PLIC_ADDR 0x40800000
|
#define PLIC_ADDR 0x40800000
|
||||||
#define PLIC_SIZE 0x00400000
|
#define PLIC_SIZE 0x00400000
|
||||||
|
#define PLIC_NDEV 4
|
||||||
#ifdef ENABLE_SPI
|
|
||||||
# define PLIC_NDEV 7 /* extra UART2 + 2 x SPI */
|
|
||||||
#else
|
|
||||||
# define PLIC_NDEV 4
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ETHPOOL_ADDR 0x60000000
|
#define ETHPOOL_ADDR 0x60000000
|
||||||
#define ETHPOOL_SIZE 0x10000000
|
#define ETHPOOL_SIZE 0x10000000
|
||||||
@ -70,7 +46,17 @@
|
|||||||
/* Notice addresses > 32 bits from here */
|
/* Notice addresses > 32 bits from here */
|
||||||
|
|
||||||
#define MEM_ADDR 0x080000000
|
#define MEM_ADDR 0x080000000
|
||||||
#define MEM_SIZE 0x100000000
|
#define MEM_SIZE 0x140000000
|
||||||
|
|
||||||
#define PMEM_ADDR 0x1c0000000
|
#define PMEM_ADDR 0x1c0000000
|
||||||
#define PMEM_SIZE 0x0c0000000
|
#define PMEM_SIZE 0x0c0000000
|
||||||
|
|
||||||
|
/* Toggles */
|
||||||
|
|
||||||
|
#define ENABLE_UART0
|
||||||
|
#define ENABLE_UART1
|
||||||
|
#define ENABLE_ETHERNET
|
||||||
|
#define ENABLE_AXIDMA
|
||||||
|
#define ENABLE_PLIC
|
||||||
|
#define ENABLE_CLINT
|
||||||
|
//#define ENABLE_SPI
|
||||||
|
@ -42,7 +42,7 @@ fi
|
|||||||
|
|
||||||
# If this point is reached there is one job running
|
# If this point is reached there is one job running
|
||||||
|
|
||||||
host=$(squeue --me -h -o %N)
|
host=$(squeue -h -o %N)
|
||||||
echo "Switching to $host"
|
echo "Switching to $host"
|
||||||
|
|
||||||
# Continue the execution there
|
# Continue the execution there
|
||||||
|
@ -21,12 +21,12 @@ set -x
|
|||||||
./fpgactl -w bitstream.bit -b opensbi.bin -k kernel.bin -i initrd.bin -r rootfs.img
|
./fpgactl -w bitstream.bit -b opensbi.bin -k kernel.bin -i initrd.bin -r rootfs.img
|
||||||
|
|
||||||
# Normal timeouts
|
# Normal timeouts
|
||||||
timeout=$((30 * 60)) # Always stop after 30 min
|
#timeout=$((30 * 60)) # Always stop after 30 min
|
||||||
timeout_silent=$((3 * 60)) # Stop if 3 min without output
|
#timeout_silent=$((3 * 60)) # Stop if 3 min without output
|
||||||
|
|
||||||
# Timeouts for SPEC benchmarks
|
# Timeouts for SPEC benchmarks
|
||||||
#timeout=$((12 * 60 * 60)) # Always stop after 12 h
|
timeout=$((6 * 60 * 60)) # Always stop after 6 h
|
||||||
#timeout_silent=$((4 * 60 * 60)) # Stop if 4 h without output (some benchmarks take 1.6h)
|
timeout_silent=$((2 * 60 * 60)) # Stop if 2 h without output (some benchmarks take 1.6h)
|
||||||
|
|
||||||
# Set dead switch
|
# Set dead switch
|
||||||
sleep $timeout && killall picocom &
|
sleep $timeout && killall picocom &
|
||||||
|
@ -453,16 +453,16 @@
|
|||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
cp ${final.uboot-env} board/emulation/qemu-riscv/environ.env
|
cp ${final.uboot-env} board/emulation/qemu-riscv/environ.env
|
||||||
'';
|
'';
|
||||||
#postConfigure = ''
|
postConfigure = ''
|
||||||
# echo --------------------------- generated config:
|
echo --------------------------- generated config:
|
||||||
# cat .config
|
cat .config
|
||||||
# echo ---------------------------
|
echo ---------------------------
|
||||||
#'';
|
'';
|
||||||
#postBuild = ''
|
postBuild = ''
|
||||||
# echo --------------------------- generated env starts
|
echo --------------------------- generated env starts
|
||||||
# cat include/generated/env.in
|
cat include/generated/env.in
|
||||||
# echo --------------------------- generated env ends
|
echo --------------------------- generated env ends
|
||||||
#'';
|
'';
|
||||||
#
|
#
|
||||||
# CONFIG_SERIAL_PRESENT=n
|
# CONFIG_SERIAL_PRESENT=n
|
||||||
# CONFIG_SYS_NS16550=n
|
# CONFIG_SYS_NS16550=n
|
||||||
@ -502,7 +502,7 @@
|
|||||||
# ''
|
# ''
|
||||||
;
|
;
|
||||||
extraMakeFlags = [
|
extraMakeFlags = [
|
||||||
#"V=1"
|
"V=1"
|
||||||
#"KCPPFLAGS=-DLOG_DEBUG"
|
#"KCPPFLAGS=-DLOG_DEBUG"
|
||||||
#"EXT_DTB=${final.ox-dtb}/lagarto_ox.dtb"
|
#"EXT_DTB=${final.ox-dtb}/lagarto_ox.dtb"
|
||||||
];
|
];
|
||||||
@ -540,7 +540,7 @@
|
|||||||
in prev.runCommand "uboot.txt" {} ''
|
in prev.runCommand "uboot.txt" {} ''
|
||||||
cat > $out <<EOF
|
cat > $out <<EOF
|
||||||
xtrace=yes
|
xtrace=yes
|
||||||
bootargs=root=/dev/ram0 loglevel=7 rw earlycon=sbi console=hvc0 debug2 init=${init}
|
bootargs=root=/dev/ram0 loglevel=7 rw earlycon=sbi console=hvc0 bench2 init=${init}
|
||||||
ramdisk_size=$(stat --format %s $(readlink -f ${initrd}))
|
ramdisk_size=$(stat --format %s $(readlink -f ${initrd}))
|
||||||
bootcmd=fdt print; booti \''${kernel_addr_r} \''${ramdisk_addr_r}:\''${ramdisk_size} \''${fdtcontroladdr}
|
bootcmd=fdt print; booti \''${kernel_addr_r} \''${ramdisk_addr_r}:\''${ramdisk_size} \''${fdtcontroladdr}
|
||||||
EOF
|
EOF
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#! @shell@
|
#! @shell@
|
||||||
|
|
||||||
#set -x
|
set -x
|
||||||
|
|
||||||
|
echo "--- starting stage 2 ---"
|
||||||
|
|
||||||
systemConfig=@systemConfig@
|
systemConfig=@systemConfig@
|
||||||
|
|
||||||
@ -8,11 +10,6 @@ export HOME=/root PATH="@path@"
|
|||||||
|
|
||||||
|
|
||||||
if [ "${IN_NIXOS_SYSTEMD_STAGE1:-}" != true ]; then
|
if [ "${IN_NIXOS_SYSTEMD_STAGE1:-}" != true ]; then
|
||||||
# Print a greeting.
|
|
||||||
echo
|
|
||||||
echo -e "\e[1;32m<<< @distroName@ Stage 2 >>>\e[0m"
|
|
||||||
echo
|
|
||||||
|
|
||||||
# Process the kernel command line.
|
# Process the kernel command line.
|
||||||
for o in $(</proc/cmdline); do
|
for o in $(</proc/cmdline); do
|
||||||
case $o in
|
case $o in
|
||||||
@ -31,6 +28,13 @@ if [ "${IN_NIXOS_SYSTEMD_STAGE1:-}" != true ]; then
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# Print a greeting.
|
||||||
|
echo
|
||||||
|
echo -e "\e[1;32m<<< @distroName@ Stage 2 >>>\e[0m"
|
||||||
|
echo
|
||||||
|
|
||||||
|
|
||||||
# Normally, stage 1 mounts the root filesystem read/writable.
|
# Normally, stage 1 mounts the root filesystem read/writable.
|
||||||
# However, in some environments, stage 2 is executed directly, and the
|
# However, in some environments, stage 2 is executed directly, and the
|
||||||
# root is read-only. So make it writable here.
|
# root is read-only. So make it writable here.
|
||||||
|
Loading…
Reference in New Issue
Block a user