Skip to content

Instantly share code, notes, and snippets.

@emersion
Forked from extremecoders-re/debian-mipsel-on-qemu.md
Last active January 7, 2023 12:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emersion/0fb4a0266eb26d0677140d7cb9a50fa2 to your computer and use it in GitHub Desktop.
Save emersion/0fb4a0266eb26d0677140d7cb9a50fa2 to your computer and use it in GitHub Desktop.
Installing debian stretch mips64el on qemu

Download

Download debian ISO, see http://cdimage.debian.org/cdimage/release/current/mips64el/iso-cd

curl -OL 'http://cdimage.debian.org/cdimage/release/current/mips64el/iso-cd/debian-9.4.0-mips64el-netinst.iso'

Download initrd & vmlinux, see http://ftp.debian.org/debian/dists/stretch/main/installer-mips64el/current/images/malta/netboot

curl -OL 'http://ftp.debian.org/debian/dists/stretch/main/installer-mips64el/current/images/malta/netboot/initrd.gz'
curl -OL 'http://ftp.debian.org/debian/dists/stretch/main/installer-mips64el/current/images/malta/netboot/vmlinux-4.9.0-6-5kc-malta'

Install

Create a new hard disk

qemu-img create -f qcow2 hda.qcow 10G

Install debian

qemu-system-mips64el -cdrom debian-9.4.0-mips64el-netinst.iso \
-hda hda.qcow \
-M malta \
-kernel vmlinux-4.9.0-6-5kc-malta \
-boot d \
-initrd initrd.gz \
-m 512 \
-cpu 5KEc \
-nographic \
-append "root=/dev/sda1 nokaslr" 

Allow for the installation to complete.

Extract initrd

sudo modprobe nbd max_part=8
sudo qemu-nbd --connect=/dev/nbd0 hda.qcow
mkdir hda
sudo mount /dev/nbd0p1 hda
cp hda/boot/initrd.img-4.9.0-6-5kc-malta .
sudo umount hda
sudo qemu-nbd -d /dev/nbd0

Boot

Boot from hda

qemu-system-mips64el -hda hda.qcow \
-M malta \
-kernel vmlinux-4.9.0-6-5kc-malta \
-initrd initrd.img-4.9.0-6-5kc-malta \
-m 512 \
-cpu 5KEc \
-nographic \
-append "root=/dev/sda1 nokaslr" 

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment