前言

  • mips: 32位大端序
  • mipel: 32位小端序
  • mips64el: 64位小端序

安装工具

1
apt install qemu-system-mips libguestfs-tools

创建

1
2
3
4
5
mkdir qemu-mips64el
cd qemu-mips64el

wget https://deb.debian.org/debian/dists/Debian12.11/main/installer-mips64el/current/images/malta/netboot/initrd.gz
wget https://deb.debian.org/debian/dists/Debian12.11/main/installer-mips64el/current/images/malta/netboot/vmlinuz-6.1.0-35-5kc-malta
1
qemu-img create -f qcow2 hda.qcow2 20G
1
2
3
4
5
6
7
8
9
10
11
12
13
qemu-system-mips64el \
-machine malta \
-m 1024 \
-cpu 5KEc \
-kernel vmlinuz-6.1.0-35-5kc-malta \
-initrd initrd.gz \
-drive if=none,file=hda.qcow2,format=qcow2,id=hd \
-device virtio-blk-pci,drive=hd \
-netdev user,id=qemunet \
-device virtio-net-pci,netdev=qemunet \
-nographic \
-no-reboot \
-append "console=ttyS0"

之后就是debian的安装流程,安装完成后就可以把vmlinuz-6.1.0-35-5kc-maltainitrd.gz删掉了。

提取安装后的kernel和initrd

1
2
3
4
5
mkdir /mnt/vda1
guestmount -a hda.qcow2 -m /dev/vda1 /mnt/vda1
cp /mnt/vda1/boot/vmlinuz .
cp /mnt/vda1/boot/initrd.img .
guestunmount /mnt/vda1

启动

1
2
3
4
5
6
7
8
9
10
11
12
13
qemu-system-mips64el \
-machine malta \
-m 1024 \
-cpu 5KEc \
-kernel vmlinux \
-initrd initrd.img \
-drive if=none,file=hda.qcow2,format=qcow2,id=hd \
-device virtio-blk-pci,drive=hd \
-netdev user,id=qemunet \
-device virtio-net-pci,netdev=qemunet \
-nographic \
-no-reboot \
-append "console=ttyS0 root=/dev/vda1"