qemu - running Raspberry Pi


View Mac configuration

uname -a

I am an x86 architecture, and the return is as follows:

$ uname -a
Darwin S-iMac.local 22.5.0 Darwin Kernel Version 22.5.0: Mon Apr 24 20:51:50 PDT 2023; root:xnu-8796.121.2~5/RELEASE_X86_64 x86_64

install qemu

According to the official download: https://www.qemu.org/download/#macos
we can use brew to install qemu

brew install qemu

It will be installed /usr/local/Cellar/qemu/7.0.0_1to , and there are the following executable files in the bin directory

  • elf2dmp
  • qemu-system-avr
  • qemu-system-mips64el
  • qemu-system-s390x
  • qemu eds
  • qemu-system-cris
  • qemu-system-mipsel
  • qemu-system-sh4
  • qemu-img
  • qemu-system-hppa
  • qemu-system-nios2
  • qemu-system-sh4eb
  • qemu-io
  • qemu-system-i386
  • qemu-system-or1k
  • qemu-system-sparc
  • qemu-nbd
  • qemu-system-m68k
  • qemu-system-ppc
  • qemu-system-sparc64
  • qemu-storage-daemon
  • qemu-system-microblaze
  • qemu-system-ppc64
  • qemu-system-tricore
  • qemu-system-aarch64
  • qemu-system-microblazeel
  • qemu-system-riscv32
  • qemu-system-x86_64
  • qemu-system-alpha
  • qemu-system-mips
  • qemu-system-riscv64
  • qemu-system-xtensa
  • qemu-system-arm
  • qemu-system-mips64
  • qemu-system-rx
  • qemu-system-xtensaeb

You can also compile from source code, package download address:
https://download.qemu.org


Download Raspberry Pi Kernel

Raspberry Pi kernel image download address:

http://downloads.raspberrypi.org/raspbian/images/


Here I download 2020-02-13-raspbian-buster.zip
http://downloads.raspberrypi.org/raspbian/images/raspbian-2020-02-14/2020-02-13-raspbian-buster.zip
and decompress it to get2020-02-13-raspbian-buster.img


Download Raspberry Pi Kernel


Start Raspberry Pi with qemu

Before starting, remember the shortcut key to exit the mouse from the qemu window: Control+ Option+G

qemu-system-arm -M versatilepb -cpu arm1176 -m 256 \
-hda 2020-02-13-raspbian-buster.img \
-dtb versatile-pb-buster.dtb \
-kernel kernel-qemu-4.19.50-buster \
-append 'root=/dev/sda2 panic=1' \
-no-reboot -netdev user,id=unet \
-device virtio-net-pci,netdev=unet \
-net nic,model=virtio \
-net user,hostfwd=tcp::5022-:22

Parameter Description

  • -M versatilepbIt is equivalent to -machine versatilepbthe machine used to configure the simulation, you can qemu-system-arm -machine helpview the configurable list through the command.
  • Since it will be used to practice ARM assembly later, the cpu is selected here arm1176. If you want to configure other values ​​for other purposes, you can qemu-system-arm -cpu helpview more configurable CPUs through commands.
  • -m 256Configure memory.

The following window will pop up
insert image description here


Click Next to set the language, etc., and you can enter the system
insert image description here



おすすめ

転載: blog.csdn.net/lovechris00/article/details/132416090