Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@extremecoders-re
Last active September 24, 2023 20:10
Show Gist options
  • Star 28 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save extremecoders-re/3ddddce9416fc8b293198cd13891b68c to your computer and use it in GitHub Desktop.
Save extremecoders-re/3ddddce9416fc8b293198cd13891b68c to your computer and use it in GitHub Desktop.
Installing debian stretch mipsel on qemu

Installing debian "stretch" mipsel on qemu

Download debian iso

http://cdimage.debian.org/cdimage/release/current/mipsel/iso-cd/debian-9.1.0-mipsel-netinst.iso

Download initrd & vmlinux

http://ftp.debian.org/debian/dists/stretch/main/installer-mipsel/current/images/malta/netboot/initrd.gz

http://ftp.debian.org/debian/dists/stretch/main/installer-mipsel/current/images/malta/netboot/vmlinux-4.9.0-3-4kc-malta

Create a new hard disk

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

Install debian

$ qemu-system-mipsel -cdrom debian-9.1.0-mipsel-netinst.iso \
-hda hda.qcow \
-M malta \
-kernel vmlinux-4.9.0-3-4kc-malta \
-boot d \
-initrd initrd.gz \
-m 512 \
-nographic \
-append "root=/dev/sda1 nokaslr" 

Allow for the installation to complete. When done copy over the vmlinux-4.9.0-3-4kc-malta file from the Debian VM to the host machine. See references [4] on how to copy vmlinux-4.9.0-3-4kc-malta from hda.qcow to your host.

Boot from hda

$ qemu-system-mipsel -hda hda.qcow \
-M malta \
-kernel vmlinux-4.9.0-3-4kc-malta \
-initrd initrd.gz \
-m 512 \
-nographic \
-append "root=/dev/sda1 nokaslr" 

Important note: vmlinux-4.9.0-3-4kc-malta is the file copied from hda.qcow in the previous step and NOT the original one downloaded from ftp.debian.org. If you use the original file the Debian installer will rerun.

References

Copy link

ghost commented Dec 20, 2017

Possible I could get you to write something similar for a generic armv7 32 bit installation using qemu? This one for mips was perfect, although I had to add some changes to get it to not boot to the installer the second time through:
bear in mind that this is not showing the \s in the comments!!

wget https://cdimage.debian.org/debian-cd/current/mips/iso-cd/debian-9.3.0-mips-netinst.iso
wget http://ftp.debian.org/debian/dists/jessie/main/installer-mipsel/current/images/malta/netboot/initrd.gz
wget http://ftp.debian.org/debian/dists/jessie/main/installer-mipsel/current/images/malta/netboot/vmlinux-3.16.0-4-4kc-malta
qemu-img create -f qcow2 hda.qcow 10G
qemu-system-mipsel -cdrom debian-9.3.0-mips-netinst.iso
-hda hda.qcow
-M malta
-kernel vmlinux-3.16.0-4-4kc-malta
-boot d
-initrd initrd.gz
-m 512
-nographic
-append "root=/dev/sda1 nokaslr"

qemu-system-mipsel -hda hda.qcow
-M malta
-kernel vmlinux-3.16.0-4-4kc-malta
-m 512
-nographic
-append "root=/dev/sda1 nokaslr"

@mxi1
Copy link

mxi1 commented Jul 1, 2018

Hey, the URL "http://cdimage.debian.org/cdimage/release/current/mipsel/iso-cd/debian-9.1.0-mipsel-netinst.iso" has been already out of date, and the latest version is 9.4.0;

@monkey-jsun
Copy link

I followed the instructions exactly (except that I have to update some URL links to use the latest versions). However, in the last step, "Boot from hda", the system still comes out in installer mode, which is strange. To make sure I'm not crazy, I even deleted iso file, and it still does so. I patently went through the installation again. At the very end, it still reboots to installer screen.

Is there anything I did wrong?

@monkey-jsun
Copy link

I read one of your references, https://github.com/kholia/mips-hacking, and realized that there is a key missing step in current instruction. That is, after installation from CD, one need to copy the initrd.img-4.9.0-3-4kc-malta file from inside VM to the host machine. And then start the final image with the new initrd file.

This link gives instructions on how to mount hcow image on host so that one can copy the file, http://ask.xmodulo.com/mount-qcow2-disk-image-linux.html

@pmatos
Copy link

pmatos commented Jun 14, 2019

Thanks @monkey-jsun I just hit the same issue

@extremecoders-re
Copy link
Author

Thanks @monkey-jsun @pmatos. Updated the gist.

@kekyo
Copy link

kekyo commented Apr 20, 2022

Thanks explained installation!, I made a repo for installing process script.

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