Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

duo/duo256m: Add NixOS #157

Merged
merged 1 commit into from
Feb 12, 2025
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
125 changes: 125 additions & 0 deletions Duo/NixOS/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
---
sys: NixOS
sys_ver: null
sys_var: null

status: basic
last_update: 2025-01-27
---

# NixOS Milk-V Duo Test Report

## Test Environment

### Operating System Information

- System version: 25.05.20250119
- Source code link: https://github.com/NickCao/nixos-riscv
- Reference Installation Document: https://github.com/NickCao/nixos-riscv/README.md

### Hardware Information

- Milk-V Duo
- A USB-A Power Adapter
- A USB-A to C Cable
- A microSD Card
- A microSD Card Reader
- A USB to UART Debugger (e.g., CH340, CH341, FT2232, etc.)
- Three DuPont Wires

## Installation Steps

### Compiling Image

Run `nix build ".#hydraJobs.duo"` if you happen to be using NixOS on your host.

It is not recommended to install and use the `nix` package manager on other distributions. Try using e.g. the official Docker image instead:
```shell
docker run -ti -v $(pwd):/work ghcr.io/nixos/nix
```

Inside the Docker container:

```shell
echo "max-jobs = auto" >> /etc/nix/nix.conf # Enable multi-threaded compilation
echo "substituters = https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store https://cache.nixos.org/" >> /etc/nix/nix.conf # Switch to another mirror
cd /work
nix build ".#hydraJobs.visionfive2" --extra-experimental-features nix-command --extra-experimental-features flakes
```

The resulting image will reside at `./result/sd-image/`, with a filename similar to `nixos-image-sd-card-25.05.20250119.00e0195-riscv64-linux.img.zst`。

### Flashing Image to microSD Card

Use `dd` to flash the image to the microSD card.

### Logging into the System

Logging into the system via the serial port.

No password are set and will automatically login by default.

## Expected Results

The system should boot normally and allow login via the onboard serial port.

## Actual Results

The system booted successfully and login via the onboard serial port was also successful.

### Boot Log

```log

<<< Welcome to NixOS sd-card-25.05.20250119.00e0195 (riscv64) - ttyS0 >>>

Run 'nixos-help' for the NixOS manual.

nixos login: root (automatic login)


[root@nixos:~]# uname -a
Linux nixos 5.10.4 #1-NixOS PREEMPT Tue Jan 1 00:00:00 UTC 1980 riscv64 GNU/Linux

[root@nixos:~]# cat /etc/os-release
ANSI_COLOR="0;38;2;126;186;228"
BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues"
BUILD_ID="25.05.20250119.00e0195"
CPE_NAME="cpe:/o:nixos:nixos:25.05"
DEFAULT_HOSTNAME=nixos
DOCUMENTATION_URL="https://nixos.org/learn.html"
HOME_URL="https://nixos.org/"
ID=nixos
ID_LIKE=""
IMAGE_ID=""
IMAGE_VERSION=""
LOGO="nix-snowflake"
NAME=NixOS
PRETTY_NAME="NixOS 25.05 (Warbler)"
SUPPORT_URL="https://nixos.org/community.html"
VARIANT=""
VARIANT_ID=""
VENDOR_NAME=NixOS
VENDOR_URL="https://nixos.org/"
VERSION="25.05 (Warbler)"
VERSION_CODENAME=warbler
VERSION_ID="25.05"

[root@nixos:~]# lscpu
Architecture: riscv64
Byte Order: Little Endian
CPU(s): 1
On-line CPU(s) list: 0

[root@nixos:~]#
```

## Test Criteria

Successful: The actual result matches the expected result.

Failed: The actual result does not match the expected result.

## Test Conclusion

Test successful.
116 changes: 116 additions & 0 deletions Duo/NixOS/README_zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# NixOS Milk-V Duo 测试报告

## 测试环境

### 操作系统信息

- 系统版本:25.05.20250119
- 源码链接: https://github.com/NickCao/nixos-riscv
- 参考安装文档: https://github.com/NickCao/nixos-riscv/README.md

### 硬件信息

- Milk-V Duo
- USB-A 电源一个
- USB-A to C 线缆一条
- microSD 卡一张
- microSD 读卡器一个
- USB to UART 调试器一个(如:CH340, CH341, FT2232 等)
- 杜邦线三根

## 安装步骤

### 编译镜像

如果主机运行 NixOS, 使用 `nix build ".#hydraJobs.duo"` 编译镜像即可。
对于其他发行版,不建议直接安装并使用 `nix` 包管理器,推荐使用 Nix 的官方 Docker 镜像:

```shell
docker run -ti -v $(pwd):/work ghcr.io/nixos/nix
```

在 Docker 容器中:

```shell
echo "max-jobs = auto" >> /etc/nix/nix.conf # 使用多核编译
echo "substituters = https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store https://cache.nixos.org/" >> /etc/nix/nix.conf # 更换镜像源
cd /work
nix build ".#hydraJobs.visionfive2" --extra-experimental-features nix-command --extra-experimental-features flakes
```

生成的镜像位于 `./result/sd-image/` 目录下,文件名形如 `nixos-image-sd-card-25.05.20250119.00e0195-riscv64-linux.img.zst`。

### 刷写镜像到 microSD 卡

使用 `dd` 将镜像写入至 microSD 卡。

### 登录系统

通过串口登录系统。

默认为无密码且自动登录。

## 预期结果

系统正常启动,能够通过板载串口登录。

## 实际结果

系统正常启动,成功通过板载串口登录。

### 启动信息

```log

<<< Welcome to NixOS sd-card-25.05.20250119.00e0195 (riscv64) - ttyS0 >>>

Run 'nixos-help' for the NixOS manual.

nixos login: root (automatic login)


[root@nixos:~]# uname -a
Linux nixos 5.10.4 #1-NixOS PREEMPT Tue Jan 1 00:00:00 UTC 1980 riscv64 GNU/Linux

[root@nixos:~]# cat /etc/os-release
ANSI_COLOR="0;38;2;126;186;228"
BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues"
BUILD_ID="25.05.20250119.00e0195"
CPE_NAME="cpe:/o:nixos:nixos:25.05"
DEFAULT_HOSTNAME=nixos
DOCUMENTATION_URL="https://nixos.org/learn.html"
HOME_URL="https://nixos.org/"
ID=nixos
ID_LIKE=""
IMAGE_ID=""
IMAGE_VERSION=""
LOGO="nix-snowflake"
NAME=NixOS
PRETTY_NAME="NixOS 25.05 (Warbler)"
SUPPORT_URL="https://nixos.org/community.html"
VARIANT=""
VARIANT_ID=""
VENDOR_NAME=NixOS
VENDOR_URL="https://nixos.org/"
VERSION="25.05 (Warbler)"
VERSION_CODENAME=warbler
VERSION_ID="25.05"

[root@nixos:~]# lscpu
Architecture: riscv64
Byte Order: Little Endian
CPU(s): 1
On-line CPU(s) list: 0

[root@nixos:~]#
```

## 测试判定标准

测试成功:实际结果与预期结果相符。

测试失败:实际结果与预期结果不符。

## 测试结论

测试成功。
7 changes: 6 additions & 1 deletion Duo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ cpu_core: XuanTie C906
- Yocto
- Source Code Link: https://github.com/kinsamanka/meta-milkv
- Reference Installation Document: https://github.com/kinsamanka/meta-milkv/blob/master/README.md
- NixOS
- Source code link: https://github.com/NickCao/nixos-riscv
- Reference Installation Document: https://github.com/NickCao/nixos-riscv/README.md

### Hardware Information

Expand All @@ -85,6 +88,7 @@ cpu_core: XuanTie C906
| UniProton Boot | N/A | [Success][UniProton] |
| Ubuntu Boot | N/A | [Success][Ubuntu] |
| Yocto Image Build and Boot | N/A | [Success][Yocto] |
| NixOS Image Build and Boot | N/A | [Success][NixOS] |

[Duo]: ./BuildRoot/README.md
[Arch]: ./ArchLinux/README.md
Expand All @@ -99,4 +103,5 @@ cpu_core: XuanTie C906
[Zephyr]: ./Zephyr/README.md
[UniProton]: ./UniProton/README.md
[Ubuntu]: ./Ubuntu/README.md
[Yocto]: ./Yocto/README.md
[Yocto]: ./Yocto/README.md
[NixOS]: ./NixOS/README.md
9 changes: 7 additions & 2 deletions Duo/README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
- Yocto
- 源码链接:https://github.com/kinsamanka/meta-milkv
- 参考安装文档:https://github.com/kinsamanka/meta-milkv/blob/master/README.md
- NixOS
- 源码链接: https://github.com/NickCao/nixos-riscv
- 参考安装文档: https://github.com/NickCao/nixos-riscv/README.md

### 硬件开发板信息

Expand All @@ -77,7 +80,8 @@
| Zephyr 镜像构建及启动 | N/A | [成功][Zephyr] |
| UniProton 启动 | N/A | [成功][UniProton] |
| Ubuntu 启动 | N/A | [成功][Ubuntu] |
| Yocto 镜像构建及启动 | N/A | [成功][Ubuntu] |
| Yocto 镜像构建及启动 | N/A | [成功][Yocto] |
| NixOS 镜像构建及启动 | N/A | [成功][NixOS] |

[Duo]: ./BuildRoot/README_zh.md
[Arch]: ./ArchLinux/README_zh.md
Expand All @@ -92,4 +96,5 @@
[Zephyr]: ./Zephyr/README_zh.md
[UniProton]: ./UniProton/README_zh.md
[Ubuntu]: ./Ubuntu/README_zh.md
[Yocto]: ./Yocto/README_zh.md
[Yocto]: ./Yocto/README_zh.md
[NixOS]: ./NixOS/README_zh.md
Loading
Loading