ARM Lab on Mac Apple Silicon — M1

KomSr3ll
2 min readDec 29, 2023

--

  1. Install QEMU on the system on Mac.
brew install qemu

2. QEMU for ARM

qemu-system-arm

3. Download Images.

https://downloads.raspberrypi.org/raspbian/images/
https://github.com/dhruvvyas90/qemu-rpi-kernel/tree/master

Ensure the qemu-rpi-kernel versions are

4.Run QEMU with the downloaded images and kernel

qemu-system-arm -kernel kernel-qemu-<version> \
-cpu arm1176 -m 256 -M versatilepb -serial stdio \
-append "root=/dev/sda2 rootfstype=ext4 rw" \
-hda <version>.img \
-nic user,hostfwd=tcp::2022-:22 \
-no-reboot &

Note: Please do not copy-paste the command from the page; ensure you are changing the <version> to the right one which you have downloaded.

The above command is explained in detail here below for better understanding ( you can avoid googling)

qemu-system-arm : To run with ARM
-kernel : To set the kernel file
-cpu : To set the architecture of the CPU to run
-m : To set the RAM for the machine
-M : machine type for the emulation
-serial : Redirects the serial output to the terminal for interaction and debugging.
-append : Appends kernel boot parameters.
root=/dev/sda2 rootfstype=ext4 rw : the root filesystem (/dev/sda2) as ext4 and mounts it as read-write.
-hda : Sets the disk image
-nic : Configures a user-mode network stack.
hostfwd : Forwards traffic from port 5022 on the host to port 22 on the emulated machine.
-no-reboot : Specifies that the virtual machine should not automatically reboot after shutdown

Note: Assuming the system is running

5. SSH to Pi QEMU

ssh pi@127.0.0.1 -p 2022
raspberry

Manage QEMU

  1. List Running Machines QEMU Machines
ps -ef | awk '/qemu/ && !/awk/' | sed -e 's/[^/]*//' -e 's/ -/\n\t-/g'

2. Shutdown Machine Command line.

Ctr + A and then X

Note: I’m planning to add a UTM-based lab setup soon

--

--

KomSr3ll
KomSr3ll

Written by KomSr3ll

Error 404!! Buy me a coffee here: buymeacoffee.com/komsr3ll. PS: I'm sharing my learnings with you.

No responses yet