2022年9月3日 星期六

[rasp, qemu] How to install Raspberry Pi on QEMU on Windows

 How to install Raspberry Pi on QEMU on Windows


This document follows the proedures method by the document[1].


Table of Contents

1. Create the VM 1

2. Connect to the VM 4

3. References 6



1. Create the VM 

Step 1: download the Image

Loc: http://downloads.raspberrypi.org/raspbian/images/raspbian-2020-02-14/

File: 2020-02-13-raspbian-buster.zip



Step 2: Download Kernel

Loc: https://github.com/dhruvvyas90/qemu-rpi-kernel

Fiile: kernel-qemu-4.4.34-jessie

File: kernel-qemu-5.4.51-buster (found issue)


Step 3: Create a BAT file


File: 2020-02-13-raspbian-buster-ker-jessie.bat

"c:\Program Files\qemu\qemu-system-arm.exe" ^

-kernel  .\kernel-qemu-4.4.34-jessie ^

-cpu arm1176 ^

-m 256 ^

-M versatilepb ^

-serial stdio ^

-append "root=/dev/sda2 rootfstype=ext4 rw" ^

-hda .\2020-02-13-raspbian-buster.img ^

-net nic ^

-net user,hostfwd=tcp::5022-:22 ^

-no-reboot

The default network mode is NAT. In order to connect to the VM from Host, the hostfwd option was used. The command is ssh pi@localhost:5022

Result


2. Connect to the VM

Step 1: Enable the ssh Inteface

Menu -> [Perference] -> [Raspberry Pi Configuration]: Interfaces: ssh


Step 2: Connect to the PI using ssh

Command

ssh pi@localhost -p 5022


3. References

1. How to emulate a Raspbian OS in QEMU on Windows 10, https://dominoc925.blogspot.com/2019/09/how-to-emulate-raspbian-os-in-qemu-on.html