Emuko:用Rust编写的快速RISC-V模拟器,可启动Linux。
Emuko: Fast RISC-V emulator written in Rust, boots Linux

原始链接: https://github.com/wkoszek/emuko

## emuko:一款快速的RISC-V模拟器 emuko是一个基于Rust的RISC-V模拟器,旨在实现速度和功能。它支持RV64IMAFDC,具有M/S/U权限级别和Sv39虚拟内存,并为ARM64和x86_64主机提供JIT编译,具有自适应后端选择。 主要功能包括使用BusyBox完全启动Linux、交互式shell以及快照/恢复功能,用于保存和恢复机器状态。守护模式提供HTTP API和实时UART命令注入,实现远程控制和交互。值得注意的是,emuko包含一个差异检查器,用于验证其JIT编译器与解释器的一致性。 与QEMU、Spike和Renode相比,emuko独特地提供了一个内置的JIT、HTTP API、WebSocket控制台以及一键Debian内核下载和验证。它依赖于单个依赖项(zstd),并以单个自包含二进制文件的形式分发。

## Emuko:一款新型RISC-V模拟器 一款名为Emuko的新型、快速的RISC-V模拟器,使用Rust编写,正受到关注——尤其是在嵌入式开发社区中。在Hacker News上分享,讨论强调了它对使用RISC-V系统(如ESP系列)的开发人员的潜在好处。 虽然编译器通常会抽象掉指令集,但开放架构如RISC-V具有吸引力。Emuko提供了一种在*无需*反复刷新硬件的情况下测试代码的方法,从而加快开发速度。 用户讨论了利用Emuko进行低级任务——例如自定义字符串操作——在嵌入式环境中标准库受限,从而实现便捷的“无设备”工作流程。 替代方案,如带有GDB和UART桥的QEMU,也被提及,提供类似调试和控制功能。最终,Emuko为RISC-V开发中的快速原型设计和测试提供了一个有价值的工具。
相关文章

原文

Fast RISC-V emulator written in Rust. Boots Linux.

emuko.dev

  • RV64IMAFDC with M/S/U privilege levels and Sv39 virtual memory
  • JIT compilation for ARM64 and x86_64 hosts (adaptive selection)
  • Full Linux boot with BusyBox userland and interactive shell
  • Snapshot/restore for saving and resuming full machine state
  • Daemon mode with HTTP API and live UART command injection
  • Differential checker to validate JIT against interpreter
  • Peripherals: UART 16550, CLINT, PLIC, SBI 1.0, FDT generation
  • Single dependency (zstd), pure Rust

RISC-V Emulator Comparison (emuko vs others)

This is a direct comparison with commonly used RISC-V emulators/simulators: QEMU, Spike, and Renode.

Legend: = built in / directly documented, = not built in (or not documented in the referenced source).

Feature emuko QEMU (RISC-V virt) Spike (riscv-isa-sim) Renode
JIT / dynamic translation backend
Snapshot save + restore
Autosnapshot (periodic)
HTTP API for machine control
WebSocket UART console endpoint
Scriptable UART host bridge primitives
One-command Debian kernel/initrd download with SHA256 verification
Built-in JIT-vs-interpreter differential checker
GDB debugging workflow
Large RISC-V board/device ecosystem (PCIe/virtio on virt)
Multi-node simulation focus
Broad ISA extension coverage (incl. RVV, crypto, etc.)

Sources:

The main binary is target/release/emuko.

alias emuko=target/release/emuko
emuko dow

Downloads the Debian RISC-V netboot kernel and initrd to ~/.emuko/ with SHA256 verification.

This starts the emulator daemon and attaches an interactive console. You'll see the kernel boot and get a shell prompt. Keyboard shortcuts:

Key Action
Ctrl+] Detach from console (daemon keeps running)
Ctrl+C Sent to guest (interrupt running command)
Ctrl+D Sent to guest (EOF)
emuko start            # reattach console to running daemon
emuko dump             # print CPU state
emuko stop             # pause execution
emuko con              # continue execution
emuko step 1000        # step N instructions
emuko snap             # take a snapshot
emuko kill             # shut down daemon

The daemon exposes an HTTP API at http://127.0.0.1:7788/v1/api/ and a WebSocket console at ws://127.0.0.1:7788/v1/ws/uart.

emuko snap                 # take a snapshot now
emuko snap 5000000         # auto-snapshot every 5M steps
emuko snap stop            # disable auto-snapshots
emuko ls                   # list snapshots
emuko restore <snapshot>   # restore a snapshot

Pass options after emuko start, or set via environment variables or emuko.yml:

Option Env Var Default Description
--ram-size RAM_SIZE 1 GB RAM in bytes
--backend EMUKO_BACKEND adaptive adaptive, arm64_jit, amd64_jit, arm64, x86_64
--bootargs BOOTARGS serial console Kernel command line

Use emuko dow (see Quick Start above) or grab pre-built images from DQIB (Debian Quick Image Baker). To download a specific set:

Apache 2.0. See LICENSE.

联系我们 contact @ memedata.com