Anw*_*mam 16 arm qemu raspberry-pi raspberry-pi4
我想使用 QEMU 模拟 Raspberry Pi 4,但我找不到 RPi4 的任何图像。我需要一个 QEMU 可以模拟 Cortex-A72 的内核。
小智 7
我只是在x86 ubuntu笔记本上启动raspios bullseye,它可以显示桌面,可以登录。但是速度很慢。
qemu-system-aarch64 -M virt,highmem=off -smp 8 -m 2G -cpu cortex-a72 -kernel linux-stable/arch/arm64/boot/Image -append root=PARTUUID=d97f5830-02 rw console=ttyAMA0 -serial telnet:localhost:4321,server,nowait -monitor telnet:localhost:4322,server,nowait -device VGA,id=vga1 -device secondary-vga,id=vga2 -object iothread,id=io1 -device virtio-blk-pci,drive=disk0,iothread=io1 -drive data/images/2022-01-28-raspios-bullseye-arm64.img
Run Code Online (Sandbox Code Playgroud)
我按照本指南构建内核映像。
https://github.com/anholt/linux/wiki/Raspberry-Pi-development-environment#building-the-Kernel
当然,由于 raspios 是在 x86 笔记本电脑上模拟的,所以速度肯定很慢。所以,如果你可以在arm64主机上虚拟化它,你就可以使用kvm、hvf等加速器。
qemu-system-aarch64 \
-M virt,highmem=off,accel=hvf \
-cpu host \
-m 1G \
-smp 4 \
-kernel $KERNEL_IMAGE_PATH -append "root=/dev/vda2 rw console=ttyAMA0" \
-netdev user,id=n1,ipv6=off,hostfwd=tcp::5555-:22 -device e1000,netdev=n1 \
-hda data/images/2022-01-28-raspios-bullseye-arm64.img \
-serial telnet:localhost:4321,server,nowait \
-monitor telnet:localhost:4322,server,nowait \
-device VGA,id=vga2 \
-drive file=data/images/2021-10-30-raspios-bullseye-armhf.img,if=virtio
Run Code Online (Sandbox Code Playgroud)
QEMU 目前没有树莓派 4 的型号(只有 0、1ap、2b、3ap 和 3b)。如果 QEMU 支持的其他机器类型对您来说足够好,您可以为该机器类型构建一个内核并使用它。(例如,对于很多人来说,他们真正想要的是“启动 64 位 Linux 用户空间”,并且不需要它与 Raspberry Pi 板硬件完全匹配;对于这些人来说,“虚拟”板通常是一个不错的选择。)
无论你做什么,你都需要确保你要求 QEMU 模拟的机器类型与你为其构建内核的机器类型相匹配——如果你尝试在不支持的板上启动内核,它将无法工作。
| 归档时间: |
|
| 查看次数: |
20119 次 |
| 最近记录: |