Skip to content

For emulating and building an image for the Wombat on a qemu virtual machine

License

Notifications You must be signed in to change notification settings

kipr/qemu-wombat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Creating a Virtual Wombat Image

Resources:

https://1xv447d.257.cz/posts/2022-04-29-raspbian-emulation-in-qemu

Raspberrry Pi OS Downloads:

https://www.raspberrypi.com/software/operating-systems/

https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2022-09-07/2022-09-06-raspios-bullseye-arm64-lite.img.xz

Building the image from scratch:

  1. Install QEMU system emulation binaries for ARM processors
sudo apt-get qemu-system-arm
  1. Create new folder and put these downloads in it
mkdir Wombat-Bullseye
  1. Download Pi Image with desktop and unzip to Wombat-Bullseye

  2. Change image name to Wombat-Bullseye

mv 2022-09-06-raspios-bullseye-arm64-lite.img Wombat-Bullseye.img
  1. Mount the partitions
sudo losetup --show --find --partscan Wombat-Bullseye.img
sudo mkdir /mnt/{raspbian-boot,raspbian-root}
sudo mount /dev/loop1p1 /mnt/raspbian-boot;
sudo mount /dev/loop1p2 /mnt/raspbian-root
  1. Create a userconf.txt file and copy it to raspbian-boot (you can change the password and username if desired)
touch userconf.txt ;
echo -n 'kipr:' > userconf.txt ;
echo 'botball' | openssl passwd -6 -stdin >> userconf.txt
sudo cp userconf.txt /mnt/raspbian-boot/userconf.txt
  1. Copy the kernel device tree file to Wombat-Bullseye
sudo cp /mnt/raspbian-boot/bcm2710-rpi-3-b.dtb .;
sudo cp /mnt/raspbian-boot/kernel8.img .
  1. Unmount the image
sudo umount /dev/loop1p1;
sudo umount /dev/loop1p2;
sudo rmdir /mnt/{raspbian-boot,raspbian-root};
sudo losetup --detach /dev/loop1
  1. Convert image to qcow2 format
qemu-img convert -f raw -O qcow2 Wombat-Bullseye.img Wombat-Bullseye.qcow2
  1. Increase disk size to 8G (or whatever size your SD card is) using qemu-img
    • Warning: It may be a good idea to create a backup copy of the image before resizing it at this point
qemu-img resize Wombat-Bullseye.qcow2 8G
  1. Create Wombat_Start.sh to run with correct dtb and kernel (or use the one in the repository)
#!/usr/bin/env bash
sudo qemu-system-aarch64 \
  -M raspi3b \
  -m 1024 \
  -kernel kernel8.img \
  -dtb bcm2710-rpi-3-b.dtb \
  -drive "format=qcow2,file=Wombat-Bullseye.qcow2" \
  -append "console=ttyAMA0 root=/dev/mmcblk0p2 rw rootwait rootfstype=ext4" \
  -device usb-net,netdev=net0 -netdev user,id=net0,hostfwd=tcp::5555-:22 \
  -serial stdio -usb -device usb-mouse -device usb-kbd
  1. Run Wombat_Start.sh
./Wombat_Start.sh
  1. After logging in enable ssh on bootup
sudo systemctl enable --now ssh.service
  1. You can remain in this terminal or you can also connect locally
ssh kipr@127.0.0.1 -p 5555
  1. Run fdisk to recreate the second partition
sudo fdisk /dev/mmcblk0
  1. In fdisk, run these commands:

To show the current disk layout (note the starting sector of the second partition)

print

Delete the old partition 2

d
2

Create a new partition and make it the primary partition

n
p
2

Put in the starting sector of the old partition and enter to accept

xxxxx

Answer no to changing ext4 signature

n

Write all changes to disk and exit fdisk

w
  1. Complete the resizing operation
sudo resize2fs /dev/mmcblk0p2
  1. Confirm expanded disk size
df -h
  1. Get updates now that there is enough space for them
sudo apt-get update
sudo apt-get upgrade

About

For emulating and building an image for the Wombat on a qemu virtual machine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages