Debian PowerPC VM
Credits to this Gist which helped me going through most of the steps;
NOTE: I ran all the commands on a Fedora Workstation 36 system, with Linux 5.19.11 kernel.
Preparation
- Install the QEMU binaries
sudo dnf install qemu-system-ppc
- Download the OS ISO file:
wget https://cdimage.debian.org/cdimage/archive/8.11.0/powerpc/iso-dvd/debian-8.11.0-powerpc-DVD-1.iso -O debian-ppc.iso
- Extract RAMdisk and vmlinux files from ISO:
udisksctl loop-setup -f debian-ppc.iso
cp /run/media/$USER/Debian\ 8.11.0\ ppc\ 1/install/powerpc/initrd.gz .
cp /run/media/$USER/Debian\ 8.11.0\ ppc\ 1/install/powerpc/vmlinux .
sudo udisksctl unmount -b /dev/loop1p1
- Create the QCOW2 storage volume for the VM:
qemu-img create -f qcow2 debian-ppc.img 12G
First boot to install OS
- Run the following command to start the VM with text-only console and ISO as USB CD
qemu-system-ppc -m 1024 -boot d -hda debian-ppc.img -initrd initrd.gz -kernel vmlinux -append "cdrom-detect/try-usb=true" -device qemu-xhci,id=xhci -device usb-storage,bus=xhci.0,drive=dvd -drive file=debian-ppc.iso,media=cdrom,if=none,id=dvd -nographic
-
For partitioning, select “Guided - entire disk” without LVM, ans all data in a single partition.
-
From the package selection prompt, install OpenSSH Server; you may also deselect the Desktop environment and print server.
-
Choose to not install the
quik
bootloader, and select “Continue without bootloader” -
Do not continue on the “Finish installation” prompt to remove the CD, and shutdown or kill the VM
Boot after the install
Extract RAMdisk and vmlinux files from IMG
Use the kernel module nbd
to mount the IMG file and copy the needed files:
sudo modprobe nbd
sudo qemu-nbd -c /dev/nbd0 debian-ppc.img
udisksctl mount -b /dev/nbd0p2 | cut -d ' ' -f 4 | export IMG_MOUNT=$(cat)
cp $IMG_MOUNT/initrd.img-3.16.0-6-powerpc .
cp $IMG_MOUNT/vmlinux-3.16.0-6-powerpc .
udisksctl unmount -b /dev/nbd0p2
sudo qemu-nbd -d /dev/nbd0
sudo rmmod nbd
Run the VM in text-only console mode
To run the VM, use the following command:
qemu-system-ppc -m 1024 -hda debian-ppc.img -initrd initrd.img-3.16.0-6-powerpc -kernel vmlinux-3.16.0-6-powerpc -append "root=/dev/sda3" -nographic
NOTE: If you have installed libvirt
, or you create a virtual network bridge called virbr0
, you may as well run the VM with the following command, enabling Internet access:
qemu-system-ppc -m 1024 -hda debian-ppc.img -initrd initrd.img-3.16.0-6-powerpc -kernel vmlinux-3.16.0-6-powerpc -append "root=/dev/sda3" -nographic -net nic -net bridge,br=virbr0
At that point, you may also connect to the VM through SSH (use your own IP and username):
ssh root@192.168.122.253 -o PubkeyAuthentication=no -o PasswordAuthentication=yes
Enable repositories
To install additional software, you will need to edit the sources.list
file: log in to an account on the VM and run
su - root
echo 'deb http://archive.debian.org/debian jessie-backports main contrib non-free' > /etc/apt/sources.list
echo 'deb-src http://archive.debian.org/debian jessie-backports main contrib non-free' >> /etc/apt/sources.list
apt update -o Acquire::Check-Valid-Until=false
apt upgrade -y
systemctl poweroff
WARN: If after upgrading the system a new initrd
file is generated, you must repeat the step from this section