Ubuntu下运行QEMU模拟riscv64跑Debian

1.安装QEMU

下载地址:

https://www.qemu.org/download/

建议选择稳定版本,下载后解压,然后make

wget https://download.qemu.org/qemu-8.0.3.tar.xz

tar xjvf qemu-8.0.3.tar.xz

cd qemu-8.0.3

./configure --enable-kvm --enable-virtfs

make

--enable-virtfs 用户虚拟机和宿主机之间共享文件

2.安装u-boot-qemu

sudo apt install u-boot-qemu

3.下载Debian的riscv64 image

下载地址:https://cdn.artifacts.gitlab-static.net/9d/f6/9df69d693033f3071b9dee279b40dead9517d1ec9a95eb4bf3404e5d8767b683/@final/4c/40/b1a5e7823e522f8e18d15a30458eb6bf7a81b06fb4e5d1446abf0a994e8a?Expires=1693379985&KeyName=gprd-artifacts-cdn&Signature=v7OlQeXqgcjDlFjmMu38g7wZ2S4=

下载后解压,得到 image.qcow2

4.启动Qemu

qemu-system-riscv64 -machine virt -cpu rv64 -m 8G -smp 4 -nographic \

-append "console=ttyS0 rw root=/dev/vda1" \

-device virtio-blk-device,drive=hd \

-drive file=imge.qcow2,if=none,id=hd \

-device virtio-net-device,netdev=net \

-netdev user,id=net,hostfwd=tcp::2222-:22 \

-kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf \

-object rng-random,filename=/dev/urandom,id=rng \

-device virtio-rng-device,rng=rng \

-virtfs local,path=~/shared,mount_tag=host0,security_model=passthrough,id=host0

5.访问Debian

可直接在Qemu上登录,账号密码是 root : root

相关推荐
嵌入式Linux,1 天前
RISC-V 只会越来越好(2)
risc-v
kobe_OKOK_2 天前
windows 下载 pip包,debian离线安装
windows·debian·pip
ONE_SIX_MIX2 天前
Debian 的 网络管理器 被意外卸载,修复过程
服务器·网络·debian
迷路爸爸1802 天前
源码编译安装最新 tmux 教程(含 Debian/Ubuntu/CentOS/Arch/macOS 等系统)
linux·ubuntu·macos·centos·debian·tmux·archlinux
坐吃山猪3 天前
zk02-知识演进
运维·zookeeper·debian
国科安芯4 天前
抗辐照MCU芯片在低轨商业卫星原子钟中的适配与优化
单片机·嵌入式硬件·fpga开发·架构·risc-v
木亦汐丫7 天前
Docker 镜像版本Alpine、Slim、Bookworm、Bullseye、Stretch、Jessie
运维·docker·容器·debian·alpine·slim·bullseye
云澈ovo7 天前
RISC-V 架构适配:开源 AI 工具链的跨平台编译优化全流程(附实战指南)
架构·开源·risc-v
Blossom.1189 天前
用一颗MCU跑通7B大模型:RISC-V+SRAM极致量化实战
人工智能·python·单片机·嵌入式硬件·opencv·机器学习·risc-v
天朝八阿哥10 天前
关于xfce4-pulseaudio-plugin中文翻译的bug
linux·debian