StarryOS 快速上手
StarryOS 的快速上手建议先选择板卡配置,再执行常规构建或运行命令。cargo starry config ls 用于查看当前支持的板卡名称,cargo starry defconfig <board> 会把选中的板卡配置写入默认构建配置并记录到 StarryOS 命令快照,后续 cargo starry build、cargo starry qemu、cargo starry uboot 或 cargo starry board 会沿用这份配置。
1. 选择板卡配置
先查看仓库当前支持的 StarryOS 板卡配置:
cargo starry config ls
输出中的名称可以直接传给 defconfig:
cargo starry defconfig <board>
完成 defconfig 后,后续命令通常不需要再重复传 --config、--target 或 --arch。quick-start 是旧的便捷入口,后续会废弃;新的快速上手路径请使用 config ls、defconfig 和常规 cargo starry 子命令。
2. QEMU 快速启动
StarryOS 的 QEMU 启动通常包含 rootfs。当前 qemu 路径会在缺少 rootfs 时自动补齐,也可以显式先执行 rootfs。
2.1 RISC-V 64
riscv64 仍然是最适合作为首条验证路径的架构。它在文档和测试套件中都较常用,适合先确认 rootfs 和 QEMU 路径是否已经接通。
推荐第一次从 riscv64 开始:
cargo starry defconfig qemu-riscv64
cargo starry qemu
或显式分步执行:
cargo starry defconfig qemu-riscv64
cargo starry rootfs --arch riscv64
cargo starry build
cargo starry qemu
2.2 AArch64
如果后续会继续关注板级路径或与 Axvisor 的 AArch64 环境对齐,可以尽快补跑这一条。它也是 StarryOS 当前非常重要的一条验证路径。
cargo starry defconfig qemu-aarch64
cargo starry qemu
分步执行:
cargo starry defconfig qemu-aarch64
cargo starry rootfs --arch aarch64
cargo starry build
cargo starry qemu
2.3 x86_64
x86_64 适合作为 PC 类平台的补充验证路径。命令和其它架构基本一致,差异主要体现在目标 triple 和对应的 QEMU 配置上。
cargo starry defconfig qemu-x86_64
cargo starry qemu
分步执行:
cargo starry defconfig qemu-x86_64
cargo starry rootfs --arch x86_64
cargo starry build
cargo starry qemu
2.4 LoongArch64
LoongArch64 路径更适合在主流架构已经跑通之后再验证。这样出现问题时,也更容易区分是环境问题还是实验性架构路径带来的差异。
cargo starry defconfig qemu-loongarch64
cargo starry qemu
分步执行:
cargo starry defconfig qemu-loongarch64
cargo starry rootfs --arch loongarch64
cargo starry build
cargo starry qemu
starry rootfs当前使用--arch,不是--target。
starry qemu的--target可接受完整 target triple,也可接受简写架构名。
3. 开发板快速启动
3.1 LicheeRV-Nano-SG2002
LicheeRV-Nano-SG2002 当前走 U-Boot 串口启动路径,适合在已经烧录并能正常进入 Linux 的开发板上验证 StarryOS。StarryOS 直接使用板上的 Linux 原生 ext4 根文件系统,默认根分区为 root=/dev/mmcblk0p2,不需要再单独制作 Starry rootfs 分区。
先选择 SG2002 构建配置:
cargo starry defconfig licheerv-nano-sg2002
cargo starry build
本地 U-Boot 串口启动使用常规 uboot 子命令。默认串口配置来自 os/StarryOS/configs/board/licheerv-nano-sg2002-uboot.toml,默认串口是 /dev/ttyUSB0,波特率为 115200:
cargo starry uboot \
--uboot-config os/StarryOS/configs/board/licheerv-nano-sg2002-uboot.toml
这条路径会构建 riscv64gc-unknown-none-elf 目标,并根据 SG2002 的 ITS 模板生成 FIT image,随后通过 U-Boot 的 loady 串口传输到 fit_load_addr = 0x82200000,再执行 bootm 0x82200000。内核入口地址为 kernel_load_addr = 0x80200000。
远端板卡服务器启动使用常规 board 子命令:
cargo starry board \
--board-config os/StarryOS/configs/board/licheerv-nano-sg2002-board.toml \
--server <ip> \
--port <port>
如果要运行完整板级测试,再使用 test-suit 入口:
cargo starry test board --board licheerv-nano-sg2002 --server <ip> --port <port>
这里的 --board licheerv-nano-sg2002 用于选择 test-suit/starryos 下的 LicheeRV-Nano-SG2002 用例;实际向 ostool-server 申请的物理板卡类型写在用例配置中,当前同样为 LicheeRV-Nano-SG2002。
4. 测试入口
StarryOS 除了单次启动外,更常见的验证方式是直接进入测试套件。这里的命令会读取 test-suit/starryos 下的用例配置并运行;迁出的压力测试通过 Starry app 命令显式选择。
# 全部 test-suit QEMU 测试
cargo starry test qemu --target riscv64gc-unknown-none-elf
# 压力测试
cargo starry app qemu -t stress/git --arch riscv64
# 仅运行指定用例
cargo starry test qemu --target aarch64-unknown-none-softfloat -c qemu-smp1/system
# 其他架构
cargo starry test qemu --target x86_64-unknown-none
cargo starry test qemu --target loongarch64-unknown-none-softfloat
如果需要板测:
cargo starry test board --board orangepi-5-plus --server <ip> --port <port>
cargo starry test board --board licheerv-nano-sg2002 --server <ip> --port <port>
详细说明见:StarryOS 测试套件设计
若需要继续了解 case 结构、rootfs 组织方式和测试实现细节,可以继续阅读: