Skip to content

Instantly share code, notes, and snippets.

@KarolPWr
Created May 6, 2024 07:00
Show Gist options
  • Save KarolPWr/fd049503c3ae417f6250d325f996a26d to your computer and use it in GitHub Desktop.
Save KarolPWr/fd049503c3ae417f6250d325f996a26d to your computer and use it in GitHub Desktop.
QEMU dla Raspberry Pi 3b
#!/bin/bash
set -x
RPI_DIR=$1
cd "$RPI_DIR" || exit
# Ściągamy obraz dla Raspberry Pi 3b+
wget https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2023-05-03/2023-05-03-raspios-bullseye-arm64.img.xz
xz -d 2023-05-03-raspios-bullseye-arm64.img.xz
sudo mkdir -p /mnt/image
sudo mount -o loop,offset=4194304 "$RPI_DIR"/2023-05-03-raspios-bullseye-arm64.img /mnt/image/
# Kopiujemy potrzebne pliki z obrazu
cp /mnt/image/bcm2710-rpi-3-b-plus.dtb "$RPI_DIR"
cp /mnt/image/kernel8.img "$RPI_DIR"
qemu-img resize "$RPI_DIR"/2023-05-03-raspios-bullseye-arm64.img 8G
# Generujemy hasło
PASSWORD="malina"
PASSWORD_HASH=$(echo "$PASSWORD" | openssl passwd -6 -stdin)
echo pi:"$PASSWORD_HASH" | tee /mnt/image/userconf
# Ostateczna komenda
qemu-system-aarch64 \
-machine raspi3b \
-cpu cortex-a72 \
-nographic \
-dtb bcm2710-rpi-3-b-plus.dtb \
-m 1G \
-smp 4 \
-kernel kernel8.img \
-sd 2023-05-03-raspios-bullseye-arm64.img \
-append "rw earlyprintk loglevel=8 console=ttyAMA0,115200 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootdelay=1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment