From f5c858cceacb01d4340c6a1e696775d955297d01 Mon Sep 17 00:00:00 2001 From: Tony Kuker <34318535+akuker@users.noreply.github.com> Date: Mon, 24 Apr 2023 21:18:31 -0500 Subject: [PATCH] Created Run PiSCSI Under Qemu (markdown) --- Run-PiSCSI-Under-Qemu.md | 70 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Run-PiSCSI-Under-Qemu.md diff --git a/Run-PiSCSI-Under-Qemu.md b/Run-PiSCSI-Under-Qemu.md new file mode 100644 index 0000000..8cd36d7 --- /dev/null +++ b/Run-PiSCSI-Under-Qemu.md @@ -0,0 +1,70 @@ +# Background + +You can run the pre-built PiSCSI disk images under Qemu on other hosts. This process is only loosely documented and intended to be used by developers or "power users". + +These commands have been used on a M1 Macbook Pro, but should also work the same on an Intel Linux host. The performance on x86_64 is going to be substantially slower than using another ARM platform. + +Note: The instructions have only been tested for 64-bit images. The 32-bit instructions may not work and may need updates. + +# Download the PiSCSI disk image. + +Take note whether it is the 32 or 64 bit variant. These can be pulled from the [Releases Page](https://github.com/PiSCSI/piscsi/releases) + +- Unzip the image and resize it to a multiple of 2GB. 4GB should be plenty. +``` +unzip image_20xx-xx-xx-PiSCSI-vxx.xx.xx-arm64-lite.zip +qemu-img resize 20xx-xx-xx-PiSCSI-vxx.xx.xx-arm64-lite.img 4G +``` + +- Download custom Kernel and Device Tree for Qemu + - [Raspberry Pi 3 Device Tree](https://github.com/farabimahmud/emulate-raspberry-pi3-in-qemu/blob/main/bcm2710-rpi-3-b-plus.dtb) + - [64 bit Linux Kernel 8](https://github.com/farabimahmud/emulate-raspberry-pi3-in-qemu/blob/main/kernel8.img) (If you're using a 64 bit image) + - [32 bit Linux Kernel 7](https://github.com/dhruvvyas90/qemu-rpi-kernel/blob/master/kernel-qemu-5.10.63-bullseye) (If you're using a 32 bit "Hard Float" image) + +# Create launch script + +Create a script named `launch.sh` (or whatever you want) in the same directory as the above files. Use the appropriate 32-bit or 64-bit command. + +## 32-bit Qemu Launcher + +``` +TBD... +``` + +## 64-bit Qemu Launcher + +``` +#!/bin/bash + +qemu-system-aarch64 \ + -M raspi3b \ + -cpu cortex-a72 \ + -append "rw earlyprintk loglevel=8 console=ttyAMA0,115200 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootdelay=1" \ + -dtb bcm2710-rpi-3-b-plus.dtb \ + -sd 2023-04-25-PiSCSI-v23.04.01-arm64-lite.img \ + -kernel kernel8.img \ + -m 1G -smp 4 \ + -serial stdio \ + -usb -device usb-mouse -device usb-kbd \ + -device usb-net,netdev=net0 \ + -netdev user,id=net0,hostfwd=tcp::5555-:22 \ +``` + +# Make the script executable and launch it +``` +chmod +x launch.sh +./launch.sh +``` + +# What do the kernel names mean? + +* kernel.img is 32-bit for BCM2835 (RPi1 & Zero) +* kernel7.img is 32-bit for BCM2836 (RPi2) and BCM2837 (RPi3) +* kernel7l.img is 32-bit for BCM2711 (RPi4) +* kernel8.img is 64-bit for BCM2837 (RPi3) or BCM2711 (RPi4) + + +# References + +* https://github.com/dhruvvyas90/qemu-rpi-kernel/wiki +* https://github.com/farabimahmud/emulate-raspberry-pi3-in-qemu