Introduction #
Here comes a interesting news that the Debian 13 Trixie1 will officially support RISC-V architecture, which is a free and open ISA (Instruction Set Architecture) based on the RISC principles. This is a great news for the RISC-V community, as it will bring more software support and development opportunities to the RISC-V ecosystem.
The following is a guide to install and boot the official Debian 13 Trixie netinst CD image
on qemu-system-riscv64
, which can be used to evaluate the performance of RISC-V architecture on your local machine (I expected you are not using a real RISC-V hardware).
Preliminary: Install qemu-system-riscv64
#
# for Debian/Ubuntu
sudo apt-get update
sudo apt-get install qemu-system
# for macOS
brew install qemu
Main: Prepare and Boot Debian 13 Trixie on qemu-system-riscv64
#
Using following Makefile
to download the necessary files2, create a disk image, install Debian 13 Trixie, and boot it on qemu-system-riscv64
.
# get uboot.elf from `u-boot-qemu` of `linux`
# ```shell
# sudo apt-get update
# sudo apt-get install opensbi qemu-system-misc u-boot-qemu
# ```
# the elf file is in /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf
ISO_NAME=debian-trixie-DI-rc2-riscv64-netinst.iso
UBOOT_PATH=./u-boot-qemu/usr/lib/u-boot/qemu-riscv64_smode/uboot.elf
get_uboot:
mkdir -p u-boot-qemu
cd u-boot-qemu \
&& wget http://http.us.debian.org/debian/pool/main/u/u-boot/u-boot-qemu_2025.01-3_all.deb
cd u-boot-qemu \
&& ar vx u-boot-qemu_2025.01-3_all.deb \
&& tar -xvf data.tar.xz
create_disk:
qemu-img create -f qcow2 debian-riscv.qcow2 16G
get_debian_iso:
# from https://www.debian.org/devel/debian-installer/
wget -O https://cdimage.debian.org/cdimage/trixie_di_rc2/riscv64/iso-cd/$(ISO_NAME)
install:
qemu-system-riscv64 \
-machine virt \
-m 2048 -smp 4 -nographic \
-serial mon:stdio \
-netdev user,id=net0 \
-device virtio-net-device,netdev=eth0 -netdev user,id=eth0 \
-device virtio-rng-pci \
-kernel $(UBOOT_PATH) \
-drive file=debian-riscv.qcow2,format=qcow2,if=virtio \
-boot d \
-cdrom $(ISO_NAME)
boot:
qemu-system-riscv64 \
-machine virt \
-m 2048 -smp 4 -nographic \
-serial mon:stdio \
-netdev user,id=net0 \
-device virtio-net-device,netdev=eth0 -netdev user,id=eth0 \
-device virtio-rng-pci \
-kernel $(UBOOT_PATH) \
-drive file=debian-riscv.qcow2,format=qcow2,if=virtio
gui_boot:
qemu-system-riscv64 \
-machine virt \
-m 2048 -smp 4 \
-device virtio-vga \
-device virtio-keyboard \
-device virtio-mouse \
-device virtio-sound \
-serial mon:stdio \
-netdev user,id=net0 \
-device virtio-net-device,netdev=eth0 -netdev user,id=eth0 \
-device virtio-rng-pci \
-kernel $(UBOOT_PATH) \
-drive file=debian-riscv.qcow2,format=qcow2,if=virtio
After copying the above Makefile
to a file named Makefile
, following below commands:
make get_uboot
make create_disk
make get_debian_iso
make install # please follow the instructions to install Debian 13 Trixie
make boot
# or
make gui_boot
Example Output of make boot
#
Click to expand
$ make boot
qemu-system-riscv64 \
-machine virt \
-m 2048 -smp 4 -nographic \
-serial mon:stdio \
-netdev user,id=net0 \
-device virtio-net-device,netdev=eth0 -netdev user,id=eth0 \
-device virtio-rng-pci \
-kernel ./u-boot-qemu/usr/lib/u-boot/qemu-riscv64_smode/uboot.elf \
-drive file=debian-riscv.qcow2,format=qcow2,if=virtio
qemu-system-riscv64: warning: netdev net0 has no peer
OpenSBI v1.5.1
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : riscv-virtio,qemu
Platform Features : medeleg
Platform HART Count : 4
Platform IPI Device : aclint-mswi
Platform Timer Device : aclint-mtimer @ 10000000Hz
Platform Console Device : uart8250
Platform HSM Device : ---
Platform PMU Device : ---
Platform Reboot Device : syscon-reboot
Platform Shutdown Device : syscon-poweroff
Platform Suspend Device : ---
Platform CPPC Device : ---
Firmware Base : 0x80000000
Firmware Size : 357 KB
Firmware RW Offset : 0x40000
Firmware RW Size : 101 KB
Firmware Heap Offset : 0x4f000
Firmware Heap Size : 41 KB (total), 2 KB (reserved), 11 KB (used), 27 KB (free)
Firmware Scratch Size : 4096 B (total), 416 B (used), 3680 B (free)
Runtime SBI Version : 2.0
Domain0 Name : root
Domain0 Boot HART : 0
Domain0 HARTs : 0*,1*,2*,3*
Domain0 Region00 : 0x0000000000100000-0x0000000000100fff M: (I,R,W) S/U: (R,W)
Domain0 Region01 : 0x0000000010000000-0x0000000010000fff M: (I,R,W) S/U: (R,W)
Domain0 Region02 : 0x0000000002000000-0x000000000200ffff M: (I,R,W) S/U: ()
Domain0 Region03 : 0x0000000080040000-0x000000008005ffff M: (R,W) S/U: ()
Domain0 Region04 : 0x0000000080000000-0x000000008003ffff M: (R,X) S/U: ()
Domain0 Region05 : 0x000000000c400000-0x000000000c5fffff M: (I,R,W) S/U: (R,W)
Domain0 Region06 : 0x000000000c000000-0x000000000c3fffff M: (I,R,W) S/U: (R,W)
Domain0 Region07 : 0x0000000000000000-0xffffffffffffffff M: () S/U: (R,W,X)
Domain0 Next Address : 0x0000000080200000
Domain0 Next Arg1 : 0x00000000ffe00000
Domain0 Next Mode : S-mode
Domain0 SysReset : yes
Domain0 SysSuspend : yes
Boot HART ID : 0
Boot HART Domain : root
Boot HART Priv Version : v1.12
Boot HART Base ISA : rv64imafdch
Boot HART ISA Extensions : sstc,zicntr,zihpm,zicboz,zicbom,sdtrig,svadu
Boot HART PMP Count : 16
Boot HART PMP Granularity : 2 bits
Boot HART PMP Address Bits: 54
Boot HART MHPM Info : 16 (0x0007fff8)
Boot HART Debug Triggers : 2 triggers
Boot HART MIDELEG : 0x0000000000001666
Boot HART MEDELEG : 0x0000000000f0b509
U-Boot 2025.01-3 (Apr 08 2025 - 23:07:41 +0000)
CPU: riscv
Model: riscv-virtio,qemu
DRAM: 2 GiB
Core: 30 devices, 13 uclasses, devicetree: board
Flash: 32 MiB
Loading Environment from nowhere... OK
In: serial,usbkbd
Out: serial,vidconsole
Err: serial,vidconsole
No USB controllers found
Net: eth0: virtio-net#0
Working FDT set to feee5ac0
Hit any key to stop autoboot: 0
Device 0: unknown device
Device 0: 1af4 VirtIO Block Device
Type: Hard Disk
Capacity: 16384.0 MB = 16.0 GB (33554432 x 512)
... is now current device
Scanning virtio 0:1...
Failed to load '/'
Failed to load '/dtb/'
Booting: virtio 0
error: no suitable video mode found.
error: no video mode activated.
GNU GRUB version 2.12-9
┌─────────────────────────────────────────────────────────────────────────────────┐
│*Debian GNU/Linux │
│ Advanced options for Debian GNU/Linux │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
Use the ▲ and ▼ keys to select which entry is highlighted.
Press enter to boot the selected OS, `e' to edit the commands before
booting or `c' for a command-line.
Loading Linux 6.12.33+deb13-riscv64 ...
Loading initial ramdisk ...
cpu3: rdtime lacks granularity needed to measure unaligned access speed
cpu1: rdtime lacks granularity needed to measure unaligned access speed
cpu2: rdtime lacks granularity needed to measure unaligned access speed
cpu0: rdtime lacks granularity needed to measure unaligned access speed
pci-host-generic 30000000.pci: Memory resource size exceeds max for 32 bits
/dev/vda2: recovering journal
/dev/vda2: clean, 121735/938400 files, 1130433/3748096 blocks
systemd-journald[290]: File /var/log/journal/f67b748edadc4cb4a20e9606d1faa267/system.journal corrupted or uncleanly shut down, renaming and replacing.
[ OK ] Finished console-setup.service - Set console font and keymap.
[ OK ] Finished plymouth-read-write.servi…Plymouth To Write Out Runtime Data.
Mounting proc-sys-fs-binfmt_misc.m…cutable File Formats File System...
[ OK ] Mounted proc-sys-fs-binfmt_misc.mo…xecutable File Formats File System.
[ OK ] Finished systemd-binfmt.service - Set Up Additional Binary Formats.
[ OK ] Finished systemd-tmpfiles-setup.se…reate System Files and Directories.
[ OK ] Finished apparmor.service - Load AppArmor profiles.
[ OK ] Reached target sysinit.target - System Initialization.
[ OK ] Started cups.path - CUPS Scheduler.
[ OK ] Started anacron.timer - Trigger anacron every hour.
[ OK ] Started apt-daily.timer - Daily apt download activities.
[ OK ] Started apt-daily-upgrade.timer - …y apt upgrade and clean activities.
[ OK ] Started apt-listchanges.timer - Tr…e apt-listchanges database for APT.
[ OK ] Started dpkg-db-backup.timer - Daily dpkg database backup timer.
[ OK ] Started e2scrub_all.timer - Period…Metadata Check for All Filesystems.
[ OK ] Started fstrim.timer - Discard unused filesystem blocks once a week.
[ OK ] Started logrotate.timer - Daily rotation of log files.
[ OK ] Started man-db.timer - Daily man-db regeneration.
[ OK ] Started systemd-tmpfiles-clean.tim…y Cleanup of Temporary Directories.
[ OK ] Reached target paths.target - Path Units.
[ OK ] Reached target timers.target - Timer Units.
[ OK ] Listening on avahi-daemon.socket -…DNS/DNS-SD Stack Activation Socket.
[ OK ] Listening on cups.socket - CUPS Scheduler.
[ OK ] Listening on dbus.socket - D-Bus System Message Bus Socket.
[ OK ] Listening on sshd-unix-local.socke…temd-ssh-generator, AF_UNIX Local).
[ OK ] Listening on sshd-vsock.socket - O… (systemd-ssh-generator, AF_VSOCK).
[ OK ] Reached target ssh-access.target - SSH Access Available.
[ OK ] Listening on systemd-hostnamed.socket - Hostname Service Socket.
[ OK ] Reached target sockets.target - Socket Units.
Starting networking.service - Raise network interfaces...
[ OK ] Reached target basic.target - Basic System.
[ OK ] Started anacron.service - Run anacron jobs.
Starting avahi-daemon.service - Avahi mDNS/DNS-SD Stack...
[ OK ] Started cron.service - Regular background program processing daemon.
Starting dbus.service - D-Bus System Message Bus...
Starting e2scrub_reap.service - Re…ne ext4 Metadata Check Snapshots...
Starting grub-common.service - Record successful boot for GRUB...
Starting lm-sensors.service - Init…lize hardware monitoring sensors...
Starting polkit.service - Authorization Manager...
Starting systemd-logind.service - User Login Management...
Starting udisks2.service - Disk Manager...
Starting wtmpdb-update-boot.servic…t and shutdown times into wtmpdb...
[ OK ] Finished e2scrub_reap.service - Re…line ext4 Metadata Check Snapshots.
[ OK ] Started dbus.service - D-Bus System Message Bus.
[ OK ] Started systemd-logind.service - User Login Management.
[ OK ] Finished networking.service - Raise network interfaces.
Starting NetworkManager.service - Network Manager...
Starting wpa_supplicant.service - WPA supplicant...
[ OK ] Finished grub-common.service - Record successful boot for GRUB.
[ OK ] Started avahi-daemon.service - Avahi mDNS/DNS-SD Stack.
[ OK ] Finished lm-sensors.service - Initialize hardware monitoring sensors.
[ OK ] Finished wtmpdb-update-boot.servic…oot and shutdown times into wtmpdb.
[ OK ] Started wpa_supplicant.service - WPA supplicant.
[ OK ] Started polkit.service - Authorization Manager.
Starting ModemManager.service - Modem Manager...
Starting systemd-hostnamed.service - Hostname Service...
[ OK ] Started udisks2.service - Disk Manager.
[ OK ] Started ModemManager.service - Modem Manager.
[ OK ] Started systemd-hostnamed.service - Hostname Service.
[ OK ] Listening on systemd-rfkill.socket…ll Switch Status /dev/rfkill Watch.
Starting NetworkManager-dispatcher…anager Script Dispatcher Service...
[ OK ] Started NetworkManager-dispatcher.… Manager Script Dispatcher Service.
[ OK ] Started NetworkManager.service - Network Manager.
[ OK ] Reached target network.target - Network.
Starting NetworkManager-wait-onlin…ce - Network Manager Wait Online...
Starting cups.service - CUPS Scheduler...
Starting ssh.service - OpenBSD Secure Shell server...
Starting systemd-user-sessions.service - Permit User Sessions...
[ OK ] Finished systemd-user-sessions.service - Permit User Sessions.
Starting lightdm.service - Light Display Manager...
Starting plymouth-quit-wait.servic…d until boot process finishes up...
[ OK ] Started cups.service - CUPS Scheduler.
[ OK ] Finished NetworkManager-wait-onlin…vice - Network Manager Wait Online.
[ OK ] Reached target network-online.target - Network is Online.
[ OK ] Started cups-browsed.service - Mak…te CUPS printers available locally.
[ OK ] Started ssh.service - OpenBSD Secure Shell server.
Debian GNU/Linux 13 debian ttyS0
debian login: user
Password:
Linux debian 6.12.33+deb13-riscv64 #1 SMP Debian 6.12.33-1 (2025-06-19) riscv64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
user@debian:~$ uname -a
Linux debian 6.12.33+deb13-riscv64 #1 SMP Debian 6.12.33-1 (2025-06-19) riscv64 GNU/Linux
user@debian:~$ lscpu
Architecture: riscv64
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Vendor ID: 0x0
Model name: -
CPU family: 0x0
Model: 0x0
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
NUMA:
NUMA node(s): 1
NUMA node0 CPU(s): 0-3
Vulnerabilities:
Gather data sampling: Not affected
Indirect target selection: Not affected
Itlb multihit: Not affected
L1tf: Not affected
Mds: Not affected
Meltdown: Not affected
Mmio stale data: Not affected
Reg file data sampling: Not affected
Retbleed: Not affected
Spec rstack overflow: Not affected
Spec store bypass: Not affected
Spectre v1: Not affected
Spectre v2: Not affected
Srbds: Not affected
Tsx async abort: Not affected
user@debian:~$
Example Screenshots of make gui_boot
#
Performance Evaluation on Apple Silicon M4 Pro
#
CoreMark 3 is a popular benchmark for evaluating the performance of CPU cores. It is designed to measure the performance of a CPU core in terms of iterations per second.
coremark $ cat run1.log
2K performance run parameters for coremark.
CoreMark Size : 666
Total ticks : 17651
Total time (secs): 17.651000
Iterations/Sec : 6231.941533
Iterations : 110000
Compiler version : GCC14.2.0
Compiler flags : -O2 -DPERFORMANCE_RUN=1 -lrt
Memory location : Please put data memory location here
(e.g. code in flash, data on heap etc)
seedcrc : 0xe9f5
[0]crclist : 0xe714
[0]crcmatrix : 0x1fd7
[0]crcstate : 0x8e3a
[0]crcfinal : 0x33ff
Correct operation validated. See README.md for run and reporting rules.
CoreMark 1.0 : 6231.941533 / GCC14.2.0 -O2 -DPERFORMANCE_RUN=1 -lrt / Heap