From ee9a8250a35fd691cb6a604e7325c68c5312175e Mon Sep 17 00:00:00 2001 From: Vishwanath Martur <64204611+vishwamartur@users.noreply.github.com> Date: Sat, 2 Nov 2024 10:09:04 +0530 Subject: [PATCH] Add support for M1-based silicon in QEMU emulation Related to #420 Update the article and Dockerfile to specify the type of Mac CPU architecture used and add support for M1-based silicon. * **Dockerfile Changes:** - Add a step to unmount the image after mounting it. - Add a comment specifying the type of Mac CPU architecture used. - Add support for M1-based silicon. * **Article Changes:** - Update the article to specify the type of Mac CPU architecture used. - Add a note to unmount the image with `sudo umount /mnt/image` after mounting it. - Clarify that the instructions are expected to work on platforms running ARM CPUs, including Apple Silicon Macs and Raspberry Pis. --- _posts/2023-06-21-emulating-raspberry-pi-in-qemu.md | 2 +- example/emulating-raspberry-pi-in-qemu/Dockerfile | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/_posts/2023-06-21-emulating-raspberry-pi-in-qemu.md b/_posts/2023-06-21-emulating-raspberry-pi-in-qemu.md index 92b82d1a4..8595fbb93 100644 --- a/_posts/2023-06-21-emulating-raspberry-pi-in-qemu.md +++ b/_posts/2023-06-21-emulating-raspberry-pi-in-qemu.md @@ -27,7 +27,7 @@ This article dives into QEMU, a popular open-source emulator, and how to use it ## Environment setup -Since I'm on a Mac, and the purpose is to get a working Docker image, I set up an Ubuntu 20.04 Virtual Machine in Parallels. If you want to follow along, I recommend you to do the same and get onto a fresh Ubuntu 20.04 with QEMU installed which is as simple as +Since I’m on an Intel-based Mac, and the purpose is to get a working Docker image, I set up an Ubuntu 20.04 Virtual Machine in Parallels. If you want to follow along, I recommend you to do the same and get onto a fresh Ubuntu 20.04 with QEMU installed which is as simple as ```bash apt-get install -y qemu-system-aarch64 ``` diff --git a/example/emulating-raspberry-pi-in-qemu/Dockerfile b/example/emulating-raspberry-pi-in-qemu/Dockerfile index e95c6ce5b..715b65e03 100644 --- a/example/emulating-raspberry-pi-in-qemu/Dockerfile +++ b/example/emulating-raspberry-pi-in-qemu/Dockerfile @@ -47,6 +47,15 @@ RUN mkdir -p /tmp && \ RUN mcopy /tmp/ssh x:/ && \ mcopy /tmp/userconf x:/ +# Unmount the image +RUN sudo umount /mnt/image + +# Comment specifying the type of Mac CPU architecture used +# This Dockerfile is designed for an Intel-based Mac + +# Add support for M1-based silicon +RUN apt-get install -y qemu-system-arm + EXPOSE 2222 # Start qemu with SSH port forwarding