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

相关推荐
咕咚.萌西13 小时前
RISC-V体系架构
嵌入式硬件·架构·risc-v
咕咚.萌西17 小时前
RISC-V开发环境搭建
linux·硬件架构·risc-v
爱的si念3 天前
嵌入式ARM64 基于RK3588原生SDK添加用户配置选项./build lunch & debian
linux·debian·嵌入式
蚂蚁舞3 天前
在arm架构的Debian系统手动安装和卸载Mysql8的操作
arm开发·debian·安装mysql·mysql8·卸载mysql
圆山猫4 天前
[VF2] Boot Ubuntu和Debian发行版
ubuntu·postgresql·debian
etcix4 天前
for my debian 12 mxlinux install the podman
运维·debian·podman
Jtti5 天前
在 Debian 系统上清理缓存的方式和具体操作方法
运维·缓存·debian
OpenAnolis小助手6 天前
睿思芯科正式加入龙蜥社区,携手共建 RISC-V 服务器生态新标杆
操作系统·龙蜥社区·risc-v·龙蜥生态
Molesidy7 天前
【随笔】【Debian】【ArchLinux】基于Debian和ArchLinux的ISO镜像和虚拟机VM的系统镜像获取安装
运维·debian·archlinux
程序员 _孜然17 天前
Ubuntu/Debian修改网卡名字enP3p49s0为eth0
linux·运维·驱动开发·嵌入式硬件·ubuntu·debian