Index of /M1-Apple/NetBSD-M1-Qemu/
Name | Last Modified | Size | Type |
../ | | - | Directory |
README.txt | 2024-Apr-01 12:27:53 | 3.6K | text/plain; charset=utf-8 |
install.sh | 2021-Sep-07 05:24:56 | 0.5K | text/x-sh; charset=utf-8 |
run.sh | 2021-Sep-07 05:25:18 | 0.5K | text/x-sh; charset=utf-8 |
_ _ _ ______ ___________ _ ____ ___ ______ _ _____ ___ ___ __
| \ | | | | | ___ \/ ___| _ \ | | / ___| / | | ___ (_) / ___| | \/ |/ |
| \| | ___| |_| |_/ /\ `--.| | | | __ _ __ _ _ __ ___| |__ / /___ / /| | | |_/ /_ __ _\ `--. _ _ _ __ | . . |`| |
| . ` |/ _ \ __| ___ \ `--. \ | | | / _` |/ _` | '__/ __| '_ \| ___ \/ /_| | | ___ \ |/ _` |`--. \ | | | '__| | |\/| | | |
| |\ | __/ |_| |_/ //\__/ / |/ / | (_| | (_| | | | (__| | | | \_/ |\___ | | |_/ / | (_| /\__/ / |_| | | | | | |_| |_
\_| \_/\___|\__\____/ \____/|___/ \__,_|\__,_|_| \___|_| |_\_____/ |_/ \____/|_|\__, \____/ \__,_|_| \_| |_/\___/
__/ |
----------------------------------------------
NetBSD/evbarm under QEMU on the Apple MacOS M1
----------------------------------------------
Building qemu on Big Sur M1
---------------------------
Clone qemu
git clone https://github.com/qemu/qemu
Change directory to qemu repository
cd qemu
Checkout to commit dated June 03, 2021 v6.0.0
git checkout 3c93dfa42c394fdd55684f2fbf24cf2f39b97d47
Apply patch series v8 by Alexander Graf
curl https://patchwork.kernel.org/series/485309/mbox/ | git am
Building qemu installer
mkdir build && cd build
../configure --target-list=aarch64-softmmu
make -j8
Install qemu
sudo make install
---------------------------------------------------
NetBSD-evbarm aarch64 setup
Get the latest QEMU_EFI image
-----------------------------
wget https://snapshots.linaro.org/components/kernel/leg-virt-tianocore-edk2-upstream/4276/QEMU-AARCH64/RELEASE_GCC5/QEMU_EFI.fd
Get the latest -current ISO installer (netbsd.iso)
--------------------------------------------------
wget http://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/latest/images/NetBSD-9.99.88-evbarm-aarch64.iso
Create qcow2 dik image
----------------------
qemu-img create -f qcow2 disk.img 20G
Create an empty file for persisting UEFI variables
---------------------------------------------------
dd if=/dev/zero conv=sync bs=1m count=64 of=ovmf_vars.fd
Booting the installer (arm64)
-----------------------------
qemu-system-aarch64 \
-M virt,highmem=off \
-accel hvf \
-cpu cortex-a72 \
-m 4G \
-device ramfb \
-device qemu-xhci \
-device usb-kbd \
-device usb-mouse \
-device usb-tablet \
-device virtio-blk,drive=system \
-drive if=none,id=system,media=cdrom,file=netbsd.iso \
-device usb-storage,drive=drive \
-drive if=none,id=drive,format=qcow2,file=disk.img \
-drive file=ovmf_vars.fd,if=pflash,index=1 \
-net nic,model=virtio \
-net user,hostfwd=tcp::2222-:22 \
-device virtio-rng-pci \
-bios QEMU_EFI.fd
Once installed don't forget to tweak the boot device in EFI !
and setup a desired resolution (1024x768 is much better in the ramfb)
Booting the system (arm64)
--------------------------
qemu-system-aarch64 \
-M virt,highmem=off \
-accel hvf \
-cpu cortex-a72 \
-m 4G \
-device ramfb \
-device qemu-xhci \
-device usb-kbd \
-device usb-mouse \
-device usb-tablet \
-device intel-hda -device hda-duplex \
-device virtio-blk,drive=system \
-drive if=none,id=system,media=cdrom,file=netbsd.iso \
-device usb-storage,drive=drive \
-drive if=none,id=drive,format=qcow2,file=disk.img \
-drive file=ovmf_vars.fd,if=pflash,index=1 \
-net nic,model=virtio \
-net user,hostfwd=tcp::2222-:22 \
-device virtio-rng-pci \
-bios QEMU_EFI.fd
You can reach the guest NetBSD over SSH from BigSur via ssh -p 2222 localhost
# Also a good idead is to diable IPV6 support in /etc/rc.conf
ip6addrctl=YES
ip6addrctl_policy="ipv4_prefer"