Let's install Debian 9.0 "Stretch" on QEMU MIPS32 under Ubuntu.
sudo apt install qemu-system-mips
wget http://ftp.debian.org/debian/dists/stretch/main/installer-mipsel/current/images/malta/netboot/vmlinux-4.9.0-11-4kc-malta
wget http://ftp.debian.org/debian/dists/stretch/main/installer-mipsel/current/images/malta/netboot/initrd.gz
qemu-img create -f qcow2 hda.qcow 8G
qemu-system-mipsel \
-cpu 4KEc \
-M malta \
-m 512 \
-hda hda.qcow \
-kernel vmlinux-4.9.0-11-4kc-malta \
-initrd initrd.gz \
-append "root=/dev/sda1 nokaslr" \
-nographic
Proceed with the installation to complete.
During installation process, the installer has created a initrd.img that contains all the needed drivers for booting the system. We need to extract this file from the disk. Utility qemu-nbd helps to mount the QEMU disk image.
sudo apt-get install qemu-utils
sudo modprobe nbd max_part=8
sudo qemu-nbd --connect=/dev/nbd0 hda.qcow
sudo mount /dev/nbd0p1 /mnt
cp /mnt/boot/initrd.img-4.9.0-1-4kc-malta .
sudo umount /mnt
sudo qemu-nbd --disconnect /dev/nbd0
qemu-system-mipsel \
-cpu 4KEc \
-M malta \
-m 2048 \
-hda hda.qcow \
-kernel vmlinux-4.9.0-11-4kc-malta \
-initrd initrd.img-4.9.0-11-4kc-malta \
-append root=/dev/sda1 \
-nographic
See protocol-debian-mipsel for a protocol of booting the resulting system.
See device-tree-mipsel-on-qemu for a device tree.
Thank you for these instructions. I could install Debian MIPS 32. One thing I noticed: after image extraction I also needed to run
sudo qemu-nbd --disconnect /dev/nbd0
Otherwise my image file was locked: