Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fabre-thibaud/f57258e367ceb6edd100 to your computer and use it in GitHub Desktop.
Save fabre-thibaud/f57258e367ceb6edd100 to your computer and use it in GitHub Desktop.
Instructions to setup a MIPS emulated VM

Debian / MIPS on QEMU

Based on https://gmplib.org/~tege/qemu.html and http://www.aurel32.net/info/debian_mips_qemu.php

Install QEMU and fetch Debian Jessie installer

sudo apt-get install qemu
wget http://ftp.debian.org/debian/dists/jessie/main/installer-mips/current/images/malta/netboot/initrd.gz
wget http://ftp.debian.org/debian/dists/jessie/main/installer-mips/current/images/malta/netboot/vmlinux-3.16.0-4-4kc-malta
qemu-img create -f qcow hda.img 10G

Install guest

qemu-system-mips64 -M malta \
  -drive file=hda.img,if=virtio,index=0 \
  -net nic,macaddr=52:54:00:fa:ce:08 \
  -net user,hostfwd=tcp::2008-:22 \
  -kernel vmlinux-3.16.0-4-4kc-malta \
  -initrd initrd.gz \
  -append "console=ttyS0" \
  -nographic

Go through the Debian install (might take a while)

DO NOT REBOOT WHEN PROMPTED AT THE END OF INSTALL, INSTEAD DROP BACK TO SHELL

Copy bootloader from guest to host

From guest

Run these commands inside the MIPS VM

mount -t proc proc /target/proc
mount --rbind /sys /target/sys
mount --rbind /dev /target/dev
chroot /target bash
apt-get install openssh-server
/etc/init.d/ssh start

From host

Run these commands from your host

ssh -p 2008 root@localhost "tar -c -f - --exclude=lost+found /boot" | tar xf -

Run guest

qemu-system-mips64 -M malta -cpu 5Kc \
  -drive file=hda.img,if=virtio,index=0 \
  -net nic,macaddr=52:54:00:fa:ce:08 \
  -net user,hostfwd=tcp::2008-:22 \
  -kernel boot/vmlinux-3.16.0-4-5kc-malta \
  -initrd boot/initrd.img-3.16.0-4-5kc-malta \
  -append "console=ttyS0 root=/dev/vda1" \
  -nographic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment