Skip to content

Commit

Permalink
Enabled network via usermode forwarder.
Browse files Browse the repository at this point in the history
  • Loading branch information
kekyo committed Apr 20, 2022
1 parent af3642d commit acb8122
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ Perhaps the script needs to be modified slightly to match the latest image. I us

![installing](Images/installing.png)

2. Rebooted in finally installation step, choose `Execute shell` from menu and do `poweroff` command, then will exit qemu.

3. Ready to use. Run `run.sh` then raise up debian 11 mipsel on qemu!
2. Ready to use. Run `run.sh` then raise up debian 11 mipsel on qemu!

![run](Images/run.png)

Expand Down
13 changes: 12 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@

#--------------------------------------------
# Require these packages.

echo "========================================================"
echo "sudo apt install qemu qemu-system-mips qemu-utils"
sudo apt install qemu qemu-system-mips qemu-utils

#--------------------------------------------
# Enable qcow mounter.

sudo modprobe nbd max_part=8

#--------------------------------------------
# Create staging directories.

if [ ! -d artifacts ]; then
mkdir artifacts
fi
Expand All @@ -25,6 +29,7 @@ fi

#--------------------------------------------
# Download debian image.

cd artifacts

# Choose mirror server and latest image file.
Expand All @@ -46,6 +51,7 @@ sudo umount mnt/
# Create hard disk image.

cd stage
rm -f hda.qcow
qemu-img create -f qcow2 hda.qcow 16G

#--------------------------------------------
Expand All @@ -60,13 +66,18 @@ qemu-system-mipsel \
-initrd ../artifacts/initrd-netinst.gz \
-boot d \
-nographic \
-append "root=/dev/sda1 nokaslr"
-no-reboot \
-append "root=/dev/sda1 nokaslr" \
-netdev user,id=net0 \
-device e1000,netdev=net0,id=net0,mac=52:54:00:12:34:56

cd ..

#--------------------------------------------
# Extract bootable kernel image and root filesystem image.

echo "========================================================"
echo "sudo qemu-nbd --connect=/dev/nbd0 stage/hda.qcow"
sudo qemu-nbd --connect=/dev/nbd0 `pwd`/stage/hda.qcow
sudo mount -r /dev/nbd0p1 `pwd`/mnt
cp mnt/boot/vmlinuz* stage/vmlinuz
Expand Down
4 changes: 2 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ qemu-system-mipsel \
-initrd initrd.img \
-append "root=/dev/sda1 console=ttyS0 nokaslr" \
-nographic \
-net user,hostfwd=tcp:127.0.0.1:2222-:22 \
-net nic,model=e1000-82545em
-netdev user,id=net0,hostfwd=tcp:127.0.0.1:2222-:22 \
-device e1000,netdev=net0,id=net0,mac=52:54:00:12:34:56

cd ..

0 comments on commit acb8122

Please sign in to comment.