MegaZeux Development VMs: Difference between revisions
(Created page with "This page contains VM images for testing MegaZeux (and potentially other software) for non-x86 architectures via [https://www.qemu.org QEMU]. Each image contains a cloned copy...") |
m (→Common: Explicitly document build-base for Alpine.) |
||
(72 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
This page contains VM images for testing MegaZeux (and potentially other software) for non-x86 architectures via [https://www.qemu.org QEMU]. Each image contains a cloned copy of the MegaZeux Git repository, all tools required to build a local copy of MegaZeux, and a minimalist window environment ([https://i3wm.org i3]) to run MegaZeux in. | This page contains VM images for testing MegaZeux (and potentially other software) for non-x86 architectures via [https://www.qemu.org QEMU]. Each image contains a cloned copy of the MegaZeux Git repository, all tools required to build a local copy of MegaZeux, and a minimalist window environment ([https://i3wm.org i3] in Debian or [https://en.wikipedia.org/wiki/CTWM CTWM] in NetBSD) to run MegaZeux in. | ||
The login for all VMs is '''mzx''' with the password '''mzx''', and the MegaZeux Git repository is typically located at '''/megazeux'''. | The login for all VMs is '''mzx''' with the password '''mzx''', and the MegaZeux Git repository is typically located at '''/megazeux'''. | ||
Line 7: | Line 7: | ||
== Linux/BSD (main architectures) == | == Linux/BSD (main architectures) == | ||
These architectures usually correspond to existing or future MegaZeux ports and are fairly well-supported by Linux and/or BSD distributions. | These architectures usually correspond to existing or future MegaZeux ports and are fairly well-supported by Linux and/or BSD distributions. Linux and BSD ports are omitted from the table for obvious reasons. | ||
Build times provided were observed using an i7-7700 running QEMU from a hypervisor guest, and are mainly intended to give a sense of scale. These may vary significantly depending on your machine and setup. | Build times provided were observed using an i7-7700 running QEMU from a hypervisor guest, and are mainly intended to give a sense of scale. These may vary significantly depending on your machine and setup. For platforms where --enable-kvm is relevant, it was not used. | ||
The current head in <code>/megazeux</code> should be the most recent head a full build was tested with. | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 16: | Line 18: | ||
! Distribution | ! Distribution | ||
! Options | ! Options | ||
! make | ! make <br> unit <br> testworlds | ||
! Fails | ! Fails | ||
! Other Issues | ! Other Issues | ||
! Image | ! Image | ||
! Links | ! Links | ||
|- | |||
<!-- x86_64 --> | |||
| '''x86_64''' <br> qemu-system-x86_64 7.2.6 | |||
| | |||
* Windows | |||
* Mac OS | |||
* Android | |||
| Debian 12.2 | |||
| <pre class="mw-collapsible mw-collapsed"> | |||
-m 2048 -smp 4 | |||
[image...] | |||
-vga qxl | |||
</pre> | |||
| 5m06s (-j4) <br> 1m17s (-j4) <br> 23s | |||
| — | |||
| '''run.serial.sh''' currently does not work, use '''run.sh''' instead. | |||
| TODO | |||
| | |||
|- | |- | ||
<!-- ARMel --> | <!-- ARMel --> | ||
| '''ARMel''' <br> qemu-system-arm | | '''ARMel''' <br> qemu-system-arm 5.2.0 | ||
| | | | ||
* Nintendo DS | * Nintendo DS | ||
* Nintendo 3DS | * Nintendo 3DS | ||
* Raspberry Pi | |||
* GP2X | * GP2X | ||
| Debian Unstable{{ref|armelsetup}} | |||
| <pre class="mw-collapsible mw-collapsed"> | |||
-M versatilepb -m 256M -cpu arm1176 | |||
-kernel [...] -dtb [...] -append "root=/dev/sda1 panic=10" | |||
-hda [...] | |||
-no-reboot | |||
</pre> | |||
| 9m24s <br> 2m44s <br> 27s | |||
| — | |||
| Testing MZX should be done in system emulation, as several vio tests and the test worlds fail with '''chroot.sh''' due to a [https://gitlab.com/qemu-project/qemu/-/issues/263 QEMU bug]. The red and blue video components are reversed. | |||
| [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-armel-debian-u20210822.tar.xz 340MB] | |||
| [https://github.com/dhruvvyas90/qemu-rpi-kernel QEMU Raspberry Pi kernels and scripts.] | |||
|- | |- | ||
Line 42: | Line 75: | ||
* PlayStation Vita | * PlayStation Vita | ||
* Pandora | * Pandora | ||
| Debian 10. | | Debian 10.10 | ||
| <pre class="mw-collapsible mw-collapsed"> | | <pre class="mw-collapsible mw-collapsed"> | ||
-M virt -m 2048 -cpu cortex-a15 -smp 4 | -M virt -m 2048 -cpu cortex-a15 -smp 4 | ||
Line 49: | Line 82: | ||
-device virtio-blk-device,drive=hd0 | -device virtio-blk-device,drive=hd0 | ||
-netdev user,id=eth0 -device virtio-net-device,netdev=eth0 | -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 | ||
- | -usb -device usb-ehci,id=ehci | ||
-device usb-mouse,bus=ehci.0 | |||
-device usb-kbd,bus=ehci.0 | |||
</pre> | </pre> | ||
| | | 2m13s (-j4) <br> 53s (-j4) <br> 17s | ||
| — | | — | ||
| | | No working video. Use '''run.serial.sh'''. | ||
| [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-armhf-debian-10. | | [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-armhf-debian-10.10.tar.xz 413MB] | ||
| | | See ARM64. | ||
|- | |- | ||
Line 66: | Line 99: | ||
* Android | * Android | ||
* Nintendo Switch | * Nintendo Switch | ||
| Debian 10. | | Debian 10.10 | ||
| <pre class="mw-collapsible mw-collapsed"> | | <pre class="mw-collapsible mw-collapsed"> | ||
-M virt -m 2048 -cpu cortex-a57 -smp 4 | -M virt -m 2048 -cpu cortex-a57 -smp 4 | ||
Line 78: | Line 111: | ||
-device usb-kbd,bus=ehci.0 | -device usb-kbd,bus=ehci.0 | ||
</pre> | </pre> | ||
| | | 2m47s (-j4) <br> 59s (-j4) <br> 23s | ||
| — | | — | ||
| — | | — | ||
| [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-arm64-debian-10. | | [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-arm64-debian-10.10.tar.xz 427MB] | ||
| [https://wiki.debian.org/Arm64Qemu Debian Wiki] [https://web.archive.org/web/20210415230009/https://wiki.debian.org/Arm64Qemu (archived)] <br> | | [https://wiki.debian.org/Arm64Qemu Debian Wiki] [https://web.archive.org/web/20210415230009/https://wiki.debian.org/Arm64Qemu (archived)] <br> | ||
[https://kennedy-han.github.io/2015/06/16/QEMU-debian-ARMv8.html Blog post with more detailed info.] [https://web.archive.org/web/20161115080530/https://kennedy-han.github.io/2015/06/16/QEMU-debian-ARMv8.html (archived)] <br> | [https://kennedy-han.github.io/2015/06/16/QEMU-debian-ARMv8.html Blog post with more detailed info.] [https://web.archive.org/web/20161115080530/https://kennedy-han.github.io/2015/06/16/QEMU-debian-ARMv8.html (archived)] <br> | ||
Line 93: | Line 124: | ||
| '''MIPSeb''' <br> qemu-system-mips 5.2.0 | | '''MIPSeb''' <br> qemu-system-mips 5.2.0 | ||
| — | | — | ||
| Debian 10. | | Debian 10.10 | ||
| <pre class="mw-collapsible mw-collapsed"> | | <pre class="mw-collapsible mw-collapsed"> | ||
-M malta -m | -M malta -m 256 | ||
-kernel [...] -initrd [...] | -kernel [...] -initrd [...] | ||
-append "root=/dev/sda1 console=tty0" | -append "root=/dev/sda1 console=tty0" | ||
Line 102: | Line 133: | ||
-vga std | -vga std | ||
</pre> | </pre> | ||
| | | 33m21s <br> 9m42s <br> 43s | ||
| — | | — | ||
| — | | — | ||
| [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-mipseb-debian-10. | | [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-mipseb-debian-10.10.tar.xz 424MB] | ||
| [https://www.aurel32.net/info/debian_mips_qemu.php Setup] [https://web.archive.org/web/20200817030436/https://www.aurel32.net/info/debian_mips_qemu.php (archived)] | | [https://www.aurel32.net/info/debian_mips_qemu.php Setup] [https://web.archive.org/web/20200817030436/https://www.aurel32.net/info/debian_mips_qemu.php (archived)] | ||
|- | |- | ||
Line 116: | Line 145: | ||
| | | | ||
* PlayStation Portable | * PlayStation Portable | ||
| Debian 10. | | Debian 10.10 | ||
| <pre class="mw-collapsible mw-collapsed"> | | <pre class="mw-collapsible mw-collapsed"> | ||
-M malta -m | -M malta -m 256 | ||
-kernel [...] -initrd [...] | -kernel [...] -initrd [...] | ||
-append "root=/dev/sda1 console=tty0" | -append "root=/dev/sda1 console=tty0" | ||
Line 124: | Line 153: | ||
-vga std | -vga std | ||
</pre> | </pre> | ||
| | | 45m52s <br> 15m06s <br> 46s | ||
| — | | — | ||
| — | | — | ||
| [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-mipsel-debian-10. | | [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-mipsel-debian-10.10.tar.xz 408MB] | ||
| [https://www.aurel32.net/info/debian_mips_qemu.php Setup] [https://web.archive.org/web/20200817030436/https://www.aurel32.net/info/debian_mips_qemu.php (archived)] | | [https://www.aurel32.net/info/debian_mips_qemu.php Setup] [https://web.archive.org/web/20200817030436/https://www.aurel32.net/info/debian_mips_qemu.php (archived)] | ||
|- | |- | ||
Line 137: | Line 164: | ||
| '''MIPS64el''' <br> qemu-system-mips64el 5.2.0 | | '''MIPS64el''' <br> qemu-system-mips64el 5.2.0 | ||
| — | | — | ||
| Debian 10. | | Debian 10.10 | ||
| <pre class="mw-collapsible mw-collapsed"> | | <pre class="mw-collapsible mw-collapsed"> | ||
-M malta -m 256 -cpu 5KEc | -M malta -m 256 -cpu 5KEc | ||
Line 145: | Line 172: | ||
-vga std | -vga std | ||
</pre> | </pre> | ||
| | | 35m20s <br> 9m08s <br> 39s | ||
| — | | — | ||
| RAM values above 256M don't work, may be a QEMU 5.2 bug or a kernel bug. | | RAM values above 256M don't work, may be a QEMU 5.2 bug or a kernel bug. | ||
| [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-mips64el-debian-10. | | [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-mips64el-debian-10.10.tar.xz 414MB] | ||
| [https://www.aurel32.net/info/debian_mips_qemu.php Setup] [https://web.archive.org/web/20200817030436/https://www.aurel32.net/info/debian_mips_qemu.php (archived)] <br> | | [https://www.aurel32.net/info/debian_mips_qemu.php Setup] [https://web.archive.org/web/20200817030436/https://www.aurel32.net/info/debian_mips_qemu.php (archived)] <br> | ||
[https://people.debian.org/~aurel32/qemu/mips/ More info] [https://web.archive.org/web/20210404205352/https://people.debian.org/~aurel32/qemu/mips/ (archived)] | [https://people.debian.org/~aurel32/qemu/mips/ More info] [https://web.archive.org/web/20210404205352/https://people.debian.org/~aurel32/qemu/mips/ (archived)] | ||
Line 157: | Line 182: | ||
<!-- PowerPC --> | <!-- PowerPC --> | ||
| '''PowerPC''' <br> qemu-system-ppc | | '''PowerPC''' <br> qemu-system-ppc 6.0.0 | ||
| | | | ||
* Mac OS X | * Mac OS X | ||
* Nintendo Wii | * Nintendo Wii | ||
* Nintendo Wii U | * Nintendo Wii U | ||
| Debian | | [https://cdimage.debian.org/cdimage/ports/10.0/powerpc/iso-cd/ Debian Unstable 10.0]{{ref|ppcsetup}} | ||
| <pre class="mw-collapsible mw-collapsed"> | |||
-L pc-bios -boot c | |||
-M mac99,via=pmu -m 1G | |||
-prom-env "boot-device=hd:,\yaboot" | |||
-prom-env "boot-args=conf=hd:,\yaboot.conf" | |||
-drive [...] | |||
-serial stdio | |||
-g 1024x768x32 | |||
</pre> | |||
| 4m50s <br> 1m26s <br> 17s | |||
| — | |||
| — | |||
| [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-ppc-debian-u20210823.tar.xz 459MB] | |||
| [https://wiki.qemu.org/Documentation/Platforms/PowerPC QEMU Wiki] [https://web.archive.org/web/20210410231026/https://wiki.qemu.org/Documentation/Platforms/PowerPC (archived)] | |||
|- | |- | ||
<!-- PowerPC 64 --> | <!-- PowerPC 64 --> | ||
| '''PowerPC 64''' <br> qemu-system-ppc64 | | '''PowerPC 64''' <br> qemu-system-ppc64 6.0.0 | ||
| | | | ||
* Mac OS X | * Mac OS X | ||
| [https://cdimage.debian.org/cdimage/ports/10.0/ppc64/iso-cd/ Debian Unstable 10.0]{{ref|ppc64setup}}{{ref|ppc64partition}} | |||
| <pre class="mw-collapsible mw-collapsed"> | |||
-L pc-bios -boot c | |||
-M mac99,via=pmu -m 2048 -cpu 970fx | |||
-prom-env "boot-device=hd:,\yaboot" | |||
-prom-env "boot-args=conf=hd:,\yaboot.conf" | |||
-drive [...] | |||
-serial stdio | |||
-g 1024x768x32 | |||
</pre> | |||
| 3m36s <br> 59s <br> 14s | |||
| — | |||
| — | |||
| [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-ppc64-debian-u20210823.tar.xz 483MB] | |||
| [https://wiki.qemu.org/Documentation/Platforms/PowerPC QEMU Wiki] [https://web.archive.org/web/20210410231026/https://wiki.qemu.org/Documentation/Platforms/PowerPC (archived)] | |||
|- | |- | ||
<!-- RISC-V RV64GC --> | <!-- RISC-V RV64GC --> | ||
| '''RISC-V RV64GC''' <br> qemu-system-riscv64 | | '''RISC-V RV64GC''' <br> qemu-system-riscv64 5.2.0 | ||
| — | | — | ||
| | | Debian Unstable{{ref|riscv64setup}} | ||
| <pre class="mw-collapsible mw-collapsed"> | |||
-M virt -smp 4 -m 2048M | |||
-bios opensbi/generic/fw_jump.elf | |||
-kernel u-boot/qemu-riscv64_smode/uboot.elf | |||
-append "console=ttyS0 rw root=/dev/vda1" | |||
-object rng-random,filename=/dev/urandom,id=rng0 | |||
-device virtio-rng-device,rng=rng0 | |||
-device virtio-blk-device,drive=hd0 | |||
-drive file=[...],format=qcow2,id=hd0 | |||
-device virtio-net-device,netdev=usernet | |||
-netdev user,id=usernet,hostfwd=tcp::22222-:22 | |||
-device VGA \ | |||
-usb -device usb-ehci,id=ehci \ | |||
-device usb-mouse,bus=ehci.0 -device usb-kbd,bus=ehci.0 \ | |||
</pre> | |||
| 2m04s (-j4) <br> 48s (-j4) <br> 18s | |||
| — | |||
| Serial terminal is required to boot even with a VGA device (Ctrl+Alt+3). | |||
| [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-riscv64-debian-u20210822.tar.xz 481MB] | |||
| [https://wiki.debian.org/RISC-V Debian Wiki RISC-V article] [https://web.archive.org/web/20210818070052/https://wiki.debian.org/RISC-V (archived)] | |||
|} | |} | ||
Line 188: | Line 262: | ||
! Distribution | ! Distribution | ||
! Options | ! Options | ||
! make | ! make <br> unit <br> testworlds | ||
! Fails | ! Fails | ||
! Other Issues | ! Other Issues | ||
Line 199: | Line 271: | ||
<!-- DEC Alpha --> | <!-- DEC Alpha --> | ||
| '''DEC Alpha''' <br> qemu-system-alpha | | '''DEC Alpha''' <br> qemu-system-alpha 5.2.0 | ||
| — | |||
| [https://cdimage.debian.org/cdimage/ports/snapshots/2021-04-17/ Debian Unstable 2021-04-17] | |||
| <pre class="mw-collapsible mw-collapsed"> | |||
-m 2048 | |||
-kernel [...] -initrd [...] | |||
-append "root=/dev/sda3 rw" | |||
-drive [...] | |||
-device VGA | |||
</pre> | |||
| 4m15s <br> 1m09s <br> 14s | |||
| — | | — | ||
| | | Use <code>--disable-stack-protector</code>. D-Bus and X11 currently do not work correctly due to alignment issues, so use '''run.serial.sh'''. | ||
| [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-alpha-debian-u20210826.tar.xz 455MB] | |||
| [https://wiki.qemu.org/Documentation/Platforms/Alpha QEMU Wiki] [https://web.archive.org/web/20210107214027/https://wiki.qemu.org/Documentation/Platforms/Alpha (archived)] | |||
|- | |- | ||
Line 212: | Line 296: | ||
-M q800 -m 1000M | -M q800 -m 1000M | ||
-kernel [...] -initrd [...] | -kernel [...] -initrd [...] | ||
-append "root/dev/sda1 rw console=ttyS0 console=tty" | -append "root=/dev/sda1 rw console=ttyS0 console=tty" | ||
-drive [...] | -drive [...] | ||
-net nic,model=dp83932 -net user | -net nic,model=dp83932 -net user | ||
-g 800x600x16 | -g 800x600x16 | ||
</pre> | </pre> | ||
| | | 4m34s <br> 1m20s <br> 20s | ||
| — | | — | ||
| | | — | ||
| [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-m68k-debian- | | [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-m68k-debian-u20210828.tar.xz 355MB] | ||
| [https://wiki.qemu.org/Documentation/Platforms/m68k QEMU Wiki] [https://web.archive.org/web/20210110025158/https://wiki.qemu.org/Documentation/Platforms/m68k (archived)] | | [https://wiki.qemu.org/Documentation/Platforms/m68k QEMU Wiki] [https://web.archive.org/web/20210110025158/https://wiki.qemu.org/Documentation/Platforms/m68k (archived)] | ||
|- | |- | ||
Line 228: | Line 310: | ||
<!-- PA-RISC --> | <!-- PA-RISC --> | ||
| '''PA-RISC''' <br> qemu-system-hppa | | '''PA-RISC''' <br> qemu-system-hppa 5.2.0 | ||
| — | | — | ||
| | | [https://cdimage.debian.org/cdimage/ports/10.0/hppa/iso-cd/ Debian Unstable 10.0]{{ref|hppasetup}} | ||
| <pre class="mw-collapsible mw-collapsed"> | |||
-m 2048 -accel tcg,thread=multi -smp 4 | |||
-drive [...] | |||
-global artist.width=800 | |||
-global artist.height=600 | |||
-serial mon:stdio | |||
</pre> | |||
| 34m51s (-j4) <br> 13m02s (-j4) <br> 1m51s | |||
| — | |||
| Use <code>--disable-stack-protector</code>. Emulation is SLOW! Video doesn't work yet; use '''run.serial.sh''' (see setup notes). | |||
| [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-hppa-debian-u20210826.tar.xz 432MB] | |||
| [https://wiki.qemu.org/Documentation/Platforms/HPPA QEMU Wiki] [https://web.archive.org/web/20201101190558/https://wiki.qemu.org/Documentation/Platforms/HPPA (archived)] <br> [https://parisc.wiki.kernel.org/index.php/Qemu PA-RISC Linux Wiki - QEMU] [https://web.archive.org/web/20210419222007/https://parisc.wiki.kernel.org/index.php/Qemu (archived)] | |||
|- | |- | ||
<!-- SPARC --> | <!-- SPARC --> | ||
| '''SPARC''' <br> qemu-system-sparc | | '''SPARC''' <br> qemu-system-sparc 6.0.0 | ||
| — | | — | ||
| | | [https://www.netbsd.org/releases/formal-9/NetBSD-9.2.html NetBSD 9.2]{{ref|sparcsetup}} | ||
| <pre class="mw-collapsible mw-collapsed"> | |||
-M SS-20 | |||
-m 512M | |||
-drive [...] | |||
-net nic -net user | |||
</pre> | |||
| 5m50s <br> 1m26s <br> 25s <br> (a173946a) | |||
| — | |||
| Use <code>--prefix /usr/pkg --disable-libsdl2</code>. SDL2 works headless but can't find a texture format and is missing -Wl,-rpath. <code>force_bpp=16</code> will match colors to the nearest indexed colors. May hang during IO operations, but so far this has only happened with '''pkgsrc'''. | |||
| [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-sparc-netbsd-9.2.tar.xz 358MB] | |||
| [https://wiki.qemu.org/Documentation/Platforms/SPARC QEMU Wiki] [https://web.archive.org/web/20210815074550/https://wiki.qemu.org/Documentation/Platforms/SPARC (archived)] | |||
|- | |- | ||
<!-- SPARC64 --> | <!-- SPARC64 --> | ||
| '''SPARC64''' <br> qemu-system-sparc64 | | '''SPARC64''' <br> qemu-system-sparc64 6.0.0 | ||
| — | | — | ||
| NetBSD 9. | | [https://www.netbsd.org/releases/formal-9/NetBSD-9.2.html NetBSD 9.2]{{ref|sparc64setup}} | ||
| <pre class="mw-collapsible mw-collapsed"> | |||
-m 2048M | |||
-drive [...] | |||
-serial mon:stdio | |||
</pre> | |||
| 14m50s <br> 3m38s <br> 33s <br> (a173946a) | |||
| — | |||
| Use <code>--prefix /usr/pkg --disable-libsdl2</code>. SDL2 works headless but can't find a texture format and is missing -Wl,-rpath. <code>force_bpp=16</code> will match colors to the nearest indexed colors. | |||
| [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-sparc64-netbsd-9.2.tar.xz 439MB] | |||
| [https://wiki.qemu.org/Documentation/Platforms/SPARC QEMU Wiki] [https://web.archive.org/web/20210815074550/https://wiki.qemu.org/Documentation/Platforms/SPARC (archived)] | |||
|- | |- | ||
<!-- Hitachi SH-4 --> | <!-- Hitachi SH-4 --> | ||
| '''SuperH SH-4''' <br> qemu- | | '''SuperH SH-4''' <br> qemu-sh4-static 5.2.0 | ||
| | | | ||
* Sega Dreamcast | * Sega Dreamcast | ||
| Debian Unstable{{ref|sh4setup}} | |||
| n/a | |||
| 1m21s (-j4) <br> 26s (-j4) <br> 22s | |||
| — | |||
| Only works using user emulation right now; use '''chroot.sh'''. Since [https://people.debian.org/~aurel32/qemu/sh4/ this] VM does boot it might be an issue with newer kernels. | |||
| [https://www.digitalmzx.com/lachesis/VMs/vm-mzx-sh4-debian-u20210828.tar.xz 414MB] | |||
| [https://blog.entek.org.uk/technology/2020/06/06/building-debian-vms-with-debootstrap.html Building Debian VMs with debootstrap] [https://web.archive.org/web/20210507031949/https://blog.entek.org.uk/technology/2020/06/06/building-debian-vms-with-debootstrap.html (archived)] | |||
|} | |} | ||
== Setup == | == Setup == | ||
If (for whatever reason) you want to set up your own VM images, this is | If (for whatever reason) you want to set up your own VM images or a similarly configured machine, this is how the VM images above were generated. | ||
=== Common === | |||
Debian is assumed in most of these steps, but they can be adapted to other distros. If one of the alternate setups is required, skip the installer steps in this section. | |||
<ol> | <ol> | ||
Line 262: | Line 388: | ||
Set up initial QEMU disk image. | Set up initial QEMU disk image. | ||
<pre> | <pre> | ||
qemu-img create -f qcow2 | qemu-img create -f qcow2 arch.debian10.qcow2 20G | ||
</pre> | </pre> | ||
</li> | </li> | ||
Line 272: | Line 398: | ||
</li> | </li> | ||
<li> | <li> | ||
If needed, extract runtime vmlinux/vmlinuz/initrd from the virtual machine (required for ARM, MIPS, RISC-V, Alpha, m68k, and SH-4). The easiest way to do this is to use the '''guestfish''' utility from '''libguestfs'''. | |||
<pre> | |||
guestfish --ro -a arch.debian10.qcow2 -i | |||
</pre> | |||
Then: | |||
<pre> | |||
copy-out /boot/vmlinux-X.XX.X-X-ARCH . | |||
copy-out /boot/initrd.img-X.XX.X-X-ARCH . | |||
</pre> | |||
</li> | |||
<li> | |||
If applicable, set up the '''run.serial.sh''' script (or '''run.sh''') and run it to start QEMU. | |||
</li> | |||
<li> | |||
Set up '''/bin/l''' (chmod a+x). | |||
<pre> | |||
#!/bin/sh | |||
LC_COLLATE="C" \ | |||
ls -la --color=always --group-directories-first "$@" | |||
</pre> | |||
</li> | |||
<li> | |||
Block the installation of dmenu. In Debian, this is done by creating a file called /etc/apt/preferences.d/no_goosesteppers with the contents: | |||
<pre> | |||
Package: suckless-tools | |||
Pin: origin * | |||
Pin-Priority: -1 | |||
</pre> | |||
Update packages. | |||
<pre> | |||
sudo apt update | |||
sudo apt upgrade | |||
</pre> | |||
</li> | |||
<li> | |||
Install packages for the tools and dependencies required to build MegaZeux: | |||
<pre> | |||
# Debian | |||
sudo apt install build-essential gdb git zlib1g-dev libpng-dev libogg-dev libvorbis-dev libsdl2-dev | |||
</pre> | |||
<pre> | |||
# Alpine | |||
sudo apk add build-base gdb git zlib-dev libpng-dev libogg-dev libvorbis-dev sdl2-dev | |||
</pre> | |||
</li> | |||
<li> | |||
Set up MegaZeux repository: | |||
<pre> | |||
cd ~ | |||
git clone https://github.com/AliceLR/megazeux | |||
</pre> | |||
</li> | |||
<li> | |||
Build MegaZeux and run the tests. Debug builds are used to measure the times in the table above, as release builds can be quite slow to make in these VMs. Video is not required for any of these steps. | |||
<pre> | |||
./config.sh --platform unix-devel --enable-fps [any other flags here] | |||
time make [use -jX with -smp] | |||
time make unittest [use -jX with -smp] | |||
time testworlds/run.sh unix-devel | |||
</pre> | |||
</li> | |||
<li> | |||
If the target supports video or needs extra packages, see "extra software". | |||
</li> | |||
<li> | |||
If preparing a VM tarball, some steps should be taken to reduce the size of the image. | |||
From the guest OS, clear the apt package cache: | |||
<pre> | |||
# Debian | |||
sudo apt clean | |||
</pre> | |||
<pre> | |||
# Alpine | |||
sudo apk cache clean | |||
</pre> | |||
Using '''guestfish''' from the host OS, fill all unused space in the image with 0s. This will increase the size of the image to its maximum size. (This method seems to be faster than using the <code>dd if=/dev/zero</code> trick some places cite or using <code>zerofree</code> from a guest rescue disk.) | |||
<pre> | |||
guestfish --rw -a arch.debian10.qcow2 -i | |||
</pre> | |||
<pre> | |||
zero-free-space / | |||
</pre> | |||
To shrink your working copy of the image, compact it using <code>qemu-img</code> (and then test it): | |||
<pre> | |||
mv arch.debian10.qcow2 arch.debian10.old.qcow2 | |||
qemu-img convert -O qcow2 arch.debian10.old.qcow2 arch.debian10.qcow2 | |||
</pre> | |||
Finally, generate a compressed tarball containing the image and scripts: | |||
<pre> | |||
mkdir arch/ | |||
cp *.sh arch.debian10.qcow2 arch/ | |||
tar -cJf vm-mzx-arch-debian-10.0.tar.xz arch/ | |||
# If you have several cores and don't mind using them all, this | |||
# makes xz use parallel compression to speed things up. | |||
XZ_OPT="-T0" tar -cJf vm-mzx-arch-debian-10.0.tar.xz arch/ | |||
</pre> | |||
</li> | |||
</ol> | |||
=== Extra software === | |||
<ol> | |||
<li> | |||
The following packages might be useful depending on the platform and setup: | |||
<pre> | |||
# Console utilities. | |||
sudo apt install dialog screen lm-sensors lynx | |||
# Graphical environment and browser. | |||
sudo apt install xorg i3 i3lock i3status rofi rxvt-unicode fonts-dejavu | |||
# Sway might work better on some setups (encountered on AML-S905X-CC v1). | |||
sudo apt install sway xwayland i3status rofi | |||
# Extra tools for building libxmp and xmp-cli from source. | |||
sudo apt install autoconf automake libtool pkg-config | |||
# clang may be useful for its sanitizers and built-in fuzzer, but it is quite large. | |||
sudo apt install clang clang-tools llvm | |||
# If this machine or VM is going to be shelled into: | |||
sudo apt install openssh-server | |||
# If memory compression is required: | |||
sudo apt install zram-tools | |||
</pre> | |||
</li> | |||
<li> | |||
You may need to preset various user roles to use a graphical desktop: | |||
<pre> | |||
# For each user that will be using this: | |||
sudo usermod -a -G video [user] | |||
sudo usermod -a -G audio [user] | |||
sudo usermod -a -G input [user] | |||
</pre> | |||
</li> | |||
<li> | |||
A launcher for i3 and/or Sway might be useful. By default, these installations use | |||
[https://github.com/dopsi/console-tdm TDM], a lightweight terminal-based startx wrapper | |||
(which also supports Wayland), but this can be done in several ways. | |||
<ul> | |||
<li> | |||
Set up tdm: | |||
<pre> | |||
sudo apt install dialog | |||
git clone https://github.com/dopsi/console-tdm | |||
cd console-tdm | |||
sudo make install | |||
</pre> | |||
For each user that will be using tdm: | |||
<pre> | |||
tdmctl init | |||
# You can skip whichever of these window managers isn't present. | |||
tdmctl add i3 /usr/bin/i3 | |||
tdmctl add sway /usr/bin/sway extra | |||
# Place the following in your .profile or .bashrc file: | |||
# Optional: Sway hardware cursors may not work in VirtualBox or QEMU. | |||
export WLR_NO_HARDWARE_CURSORS=1 | |||
# Enable tdm when starting either of the first two VTs. | |||
if [ -z "$DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -le 2 ]; then | |||
tdm --disable-long-names || true | |||
fi | |||
# Place the following line in your .xinitrc file: | |||
# i3 only: xrdb -merge "$HOME"/.Xresources | |||
exec tdm --xstart | |||
</pre> | |||
</li> | |||
<li> | |||
For a graphical login, xdm is tolerable in a VM and easy to set up: | |||
<pre> | |||
sudo make install xdm | |||
</pre> | |||
</li> | |||
<li> | |||
Alternatively, just use "startx" or "sway" manually. In the case of the former, .xinitrc needs to be preset: | |||
<pre> | |||
xrdb -merge "$HOME"/.Xresources | |||
exec i3 | |||
</pre> | |||
</li> | |||
</ul> | |||
</li> | </li> | ||
<li> | <li> | ||
Set up '''~/.Xresources | X11 only: Debian makes xterm default instead of urxvt, so fix that: | ||
<pre> | |||
sudo update-alternatives --config x-terminal-emulator | |||
</pre> | |||
Set up '''~/.Xresources''' from [https://www.digitalmzx.com/lachesis/.Xresources here]. This is required to make urxvt not look awful. | |||
<pre> | <pre> | ||
# " | cd ~ | ||
wget https://www.digitalmzx.com/lachesis/.Xresources | |||
</pre> | |||
</li> | |||
<li> | |||
If applicable, set up the '''run.sh''' script and make sure the VM can start up with graphics and run MegaZeux with the software renderer. This may take some trial and error to get right, which is why QEMU options that have worked in the past are provided in the above tables. | |||
</li> | |||
</ol> | |||
=== PowerPC/PPC64 (Debian Unstable) === | |||
Setting up working Debian Unstable builds for PowerPC/PPC64 currently requires a little bit of extra work. | |||
:1. {{note|ppcsetup}}{{note|ppc64setup}} An old image supporting Yaboot is currently required because all Debian Unstable PPC/PPC64 installers based on grub-ieee1275 have major installation issues (as of 2021-05-09). Skip setting up an apt repository, then add this to <code>/etc/apt/sources.list</code>, <code>sudo apt update</code>, and <code>sudo apt dist-upgrade</code>: | |||
deb [trusted=yes] http://ftp.debian.org/debian-ports sid main | |||
Install the following packages afterward to get the installation roughly equivalent to a standard install. | |||
sudo apt install wget curl ftp gnupg debian-keyring debian-archive-keyring | |||
Remove the old kernel and some large dependencies pulled in by '''mailutils''' (not required for these VMs): | |||
sudo apt remove linux-image-4.16.0-1-* | |||
sudo apt remove mailutils --purge | |||
sudo apt autoremove --purge | |||
:2. {{note|ppc64partition}} The version of Yaboot in older Debian Unstable PPC64 installers does not support ext4 (even though the equivalent PowerPC installer Yaboot does). Use manual partitioning instead of guided partitioning to create an ext2 <code>/boot</code> partition: | |||
#1 Apple | |||
#2 1.0 MB boot | |||
#3 256.0 MB ext2 /boot | |||
#4 (drive size - 2GB - 258MB) ext4 / | |||
#5 2.0 GB swap | |||
=== PA-RISC (Debian Unstable) === | |||
:1. {{note|hppasetup}} The Debian Installer in newer installer images crashes prior to partitioning. Like PowerPC, an older image needs to be installed, followed by a dist-update and cleanup. Follow the PowerPC instructions above. Make sure you back up the installed image once you've verified that the installation worked. The upgrade process is slow and will involve trial and error. | |||
:2. Optional: upgrading systemd may cause the VM to get stuck in an endless boot loop while attempting to run systemd-timesyncd. It may be beneficial to place holds on the relevant systemd packages until after the initial update. | |||
sudo apt-mark hold libpam-systemd | |||
sudo apt-mark hold libsystemd0 | |||
sudo apt-mark hold systemd | |||
sudo apt-mark hold systemd-sysv | |||
sudo apt-mark hold systemd-timesyncd | |||
:3. If the <code>sudo apt dist-upgrade</code> fails because of '''libgcc-s4''', do the following, then repeat the <code>sudo apt dist-upgrade</code>. | |||
sudo apt install -o Dpkg::Options::="--force-overwrite" libgcc-s4 | |||
:4. TODO: due to either Artist emulation bugs in QEMU or a lack of driver support in Linux, running this VM in graphical mode will result in the graphical terminal freezing at a certain point. The boot process will continue as usual and the VM can be used from the serial terminal in this situation. This Xorg config fragment can at least get X to successfully start, but the Artist window will still be frozen. | |||
Section "Device" | |||
Identifier "Artist" | |||
Driver "fbdev" | |||
Option "ShadowFB" "off" | |||
EndSection | |||
Section "Screen" | |||
Identifier "Screen0" | |||
Device "Artist" | |||
DefaultDepth 8 | |||
DefaultFbBpp 8 | |||
SubSection "Display" | |||
Depth 8 | |||
Modes "800x600_60.00" | |||
EndSubSection | |||
EndSection | |||
=== ARMel, RISC-V, and SH-4 (Debian Unstable) === | |||
{{note|armelsetup}}{{note|riscv64setup}}{{note|sh4setup}} No Debian Installer image is available for this architecture and it must be set up manually. Overview: | |||
<ol> | |||
<li>Install '''debootstrap''', '''qemu-user-static''', and '''debian-ports-archive-keyring'''. If you aren't using Debian as a host, '''debian-ports-archive-keyring''' is available [http://ftp.us.debian.org/debian/pool/main/d/debian-ports-archive-keyring/ here].</li> | |||
<li><pre>qemu-img create -f qcow2 [arch here].debian10.qcow2 16G</pre></li> | |||
<li>As root: | |||
<pre> | |||
modprobe nbd | |||
qemu-nbd -c /dev/nbd0 [arch here].debian10.qcow2 | |||
parted -s -a optimal -- /dev/nbd0 mklabel msdos mkpart primary ext4 1MiB -2GiB mkpart primary linux-swap -2GiB -0 | |||
mkfs -t ext4 -L root /dev/nbd0p1 | |||
mkswap -L swap /dev/nbd0p2 | |||
mount /dev/nbd0p1 /mnt | |||
# For ARMel: | |||
debootstrap --arch armel --keyring=/usr/share/keyrings/debian-archive-keyring.gpg unstable /mnt http://ftp.debian.org/debian | |||
# For RISC-V: | |||
debootstrap --arch riscv64 --keyring=/usr/share/keyrings/debian-ports-archive-keyring.gpg unstable /mnt http://ftp.ports.debian.org/debian-ports | |||
# For SH-4: | |||
debootstrap --arch sh4 --keyring=/usr/share/keyrings/debian-ports-archive-keyring.gpg unstable /mnt http://ftp.ports.debian.org/debian-ports | |||
</pre> | |||
</li> | |||
<li>Mount and chroot: | |||
<pre> | |||
cp /usr/bin/qemu-[arch here]-static /mnt/bin | |||
mount -o bind,ro /dev /mnt/dev | |||
mount -t proc none /mnt/proc | |||
mount -t sysfs none /mnt/sys | |||
chroot /mnt | |||
uname -a # Verify machine name is armv7l (ARMel), riscv64 (RISC-V), or sh4 (SH-4). | |||
</pre> | |||
</li> | |||
<li>Edit <code>/etc/fstab</code>: | |||
<pre> | |||
LABEL=swap none swap sw 0 0 | |||
LABEL=root / ext4 defaults 0 1 | |||
</pre> | |||
Create <code>/etc/network/interfaces.d/eth0</code>: | |||
<pre> | |||
# This is the device name used by Debian and is needed for QEMU system emulation. | |||
allow-hotplug eth0 | |||
iface eth0 inet dhcp | |||
</pre> | |||
Create <code>/etc/network/interfaces.d/enp1s0</code>: | |||
<pre> | |||
# This allows networking to work from a chroot from Fedora. | |||
allow-hotplug enp1s0 | |||
iface enp1s0 inet dhcp | |||
</pre> | |||
Create <code>/etc/network/interfaces.d/lo</code>: | |||
<pre> | |||
# This configures the loopback interface. | |||
# This breaks booting in ARMel and can be omitted for that platform. | |||
auto lo | |||
iface lo inet loopback | |||
</pre> | |||
</li> | |||
<li>Install and configure some required packages: | |||
<pre> | |||
apt install debian-ports-archive-keyring | |||
apt install sudo man locales console-setup wget curl ftp gnupg | |||
# These images generally use US/Mountain but the specific timezone isn't that important. | |||
dpkg-reconfigure tzdata | |||
# Only select en_US.UTF-8 here; others can be added later if needed. | |||
dpkg-reconfigure locales | |||
systemctl enable serial-getty@ttyS0.service | |||
</pre> | |||
'''RISC-V only''': install a kernel (the ~860MB install size is normal). | |||
<pre> | |||
apt install linux-image-riscv64 | |||
# Also, some extra things to do here (see Debian Wiki RISC-V page): | |||
apt install u-boot-menu openntpd ntpdate | |||
sed -i 's/^DAEMON_OPTS="/DAEMON_OPTS="-s /' /etc/default/openntpd | |||
echo ' | |||
UBOOT_PARAMETERS="rw noquiet root=/dev/vda" | |||
U_BOOT_FDT_DIR="noexist"' >> /etc/default/u-boot | |||
u-boot-update | |||
</pre> | |||
'''SH-4 only''': install a kernel. | |||
<pre> | |||
apt install linux-image-sh7751r | |||
</pre> | |||
</li> | |||
<li>Setup user: | |||
<pre> | |||
adduser mzx | |||
usermod -a -G sudo mzx | |||
passwd -l root | |||
</pre> | |||
</li> | |||
<li> | |||
'''ARMel only''': get a [https://github.com/dhruvvyas90/qemu-rpi-kernel Raspberry Pi Linux kernel (4.19.50) and versatile-pb-buster.dtb here]. | |||
</li> | |||
<li> | |||
'''RISC-V only''': get the latest copy of [https://packages.debian.org/opensbi OpenSBI] and [https://packages.debian.org/u-boot-qemu U-Boot for QEMU] from the Debian packages repository. Extract OpenSBI and the U-Boot riscv64_smode kernel; these are required to boot the virtual machine. | |||
</li> | |||
</ol> | |||
== Setup (NetBSD) == | |||
{{note|sparcsetup}}{{note|sparc64setup}} Setting up NetBSD is a little more involved than Debian. Note NetBSD also isn't aware of power management for some architectures and will use a full core while its VM is running. | |||
<ol> | |||
<li> | |||
Set up initial QEMU disk image. | |||
<pre> | |||
qemu-img create -f qcow2 arch.netbsd.qcow2 20G | |||
</pre> | </pre> | ||
</li> | </li> | ||
<li> | <li> | ||
Set up '''/bin/l''' | For whatever reason, the QEMU -kernel option doesn't seem to work with any BSD kernels, so right now any QEMU that requires -kernel should use a Linux instead. | ||
</li> | |||
<li> | |||
Run installer. Leave root password blank, create user '''mzx''' with password '''mzx''' and sudo access (if it doesn't give you the option, set the root password). Install all packages, including the X window system. Enable xdm and nptdate. If network autodetection doesn't work here (SPARC 32-bit), pkgin and pkgsrc will need to be set up manually after reboot. Otherwise, install both. | |||
</li> | |||
<li> | |||
Set up '''run.serial.sh''' script and run. | |||
</li> | |||
<li> | |||
As root, set up '''/bin/l''': | |||
<pre> | <pre> | ||
#!/bin/sh | echo '#!/bin/sh | ||
LC_COLLATE="C" \ | LC_COLLATE="C" \ | ||
ls -la | ls -la "$@"' > /bin/l | ||
chmod a+x /bin/l | |||
</pre> | |||
</li> | |||
<li> | |||
As root, set a hostname, disable IPv6, enable DHCP (if it isn't already), and reboot: | |||
<pre> | |||
# Set a hostname for this architecture e.g. SPARC, SPARC64, ARMv6. | |||
echo "SPARC" > /etc/myname | |||
# Disable IPv6 for DHCP. | |||
# This prevents issues where all downloads can hang for a long time before | |||
# the download starts (due to attempting IPv6 first and it timing out). | |||
cp /etc/dhcpcd.conf ~/ | |||
echo ' | |||
# Disable IPv6 Support. | |||
noipv6rs | |||
noipv6' >> /etc/dhcpcd.conf | |||
# If it wasn't enabled during install, you can enable DHCP like this. | |||
cp /etc/rc.conf ~/ | |||
echo "dhcpcd=yes" >> /etc/rc.conf | |||
# Reboot for these changes to take effect. | |||
reboot | |||
</pre> | </pre> | ||
</li> | </li> | ||
<li> | <li> | ||
If network wasn't available during installation, manually install '''pkgsrc'''. As root: | |||
<pre> | <pre> | ||
ftp http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc.tar.gz | |||
tar -xzf pkgsrc.tar.gz -O /usr | |||
chown root:wheel -R /usr/pkgsrc | |||
</pre> | </pre> | ||
</li> | </li> | ||
<li> | <li> | ||
If network wasn't available during installation, manually install '''pkgin'''. As root: | |||
<pre> | <pre> | ||
# Replace ARCH and VERSION for the applicable architecture (e.g. sparc) and version (e.g. 9.2). | |||
pkg_add http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/ARCH/VERSION/All/pkgin | |||
</pre> | </pre> | ||
</li> | </li> | ||
<li> | <li> | ||
As root, install packages with '''pkgin''': | |||
<pre> | <pre> | ||
pkgin install sudo bash gmake git nano p7zip | |||
pkgin install zlib png libogg libvorbis SDL SDL2 | |||
pkgin install lynx openssl ca-certificates | |||
</pre> | </pre> | ||
If precompiled packages aren't available for this architecture, use '''pkgsrc''' to build and install these packages instead. WARNING: this will take a while. | |||
</li> | </li> | ||
<li> | <li> | ||
When configuring MegaZeux, make sure to use '''/usr/pkg''' as the prefix and to use '''gmake''' to invoke Makefile targets. | |||
</li> | </li> | ||
<li> | <li> | ||
Preparing the image is a little different from Debian, mainly since the Linux kernel does not have write support for NetBSD's filesystem by default. As root, clear the pkgin cache and zero free space. | |||
<pre> | <pre> | ||
pkgin clear | |||
cat /dev/zero >delet_this | |||
sync | |||
rm delet_this | |||
</pre> | </pre> | ||
If pkgsrc was used, make sure there are no work directories leftover in the pkgsrc tree (TODO). | |||
The image is now ready to be shrunk with qemu-img. | |||
</li> | </li> | ||
</ol> | |||
=== Links === | |||
:1. [https://www.netbsd.org/docs/network/ NetBSD networking FAQ] [https://web.archive.org/web/20210425154205/https://www.netbsd.org/docs/network/ (archived)]. | |||
:2. [https://www.netbsd.org/docs/pkgsrc/getting.html NetBSD pkgsrc guide] [https://web.archive.org/web/20210506032728/https://www.netbsd.org/docs/pkgsrc/getting.html (archived)]. |
Latest revision as of 09:11, 9 November 2023
This page contains VM images for testing MegaZeux (and potentially other software) for non-x86 architectures via QEMU. Each image contains a cloned copy of the MegaZeux Git repository, all tools required to build a local copy of MegaZeux, and a minimalist window environment (i3 in Debian or CTWM in NetBSD) to run MegaZeux in.
The login for all VMs is mzx with the password mzx, and the MegaZeux Git repository is typically located at /megazeux.
This page is currently a work-in-progress. Because of this, they are behind a password; ask Lachesis for it on Discord.
Linux/BSD (main architectures)
These architectures usually correspond to existing or future MegaZeux ports and are fairly well-supported by Linux and/or BSD distributions. Linux and BSD ports are omitted from the table for obvious reasons.
Build times provided were observed using an i7-7700 running QEMU from a hypervisor guest, and are mainly intended to give a sense of scale. These may vary significantly depending on your machine and setup. For platforms where --enable-kvm is relevant, it was not used.
The current head in /megazeux
should be the most recent head a full build was tested with.
Architecture | Related Ports | Distribution | Options | make unit testworlds |
Fails | Other Issues | Image | Links |
---|---|---|---|---|---|---|---|---|
x86_64 qemu-system-x86_64 7.2.6 |
|
Debian 12.2 | -m 2048 -smp 4 [image...] -vga qxl |
5m06s (-j4) 1m17s (-j4) 23s |
— | run.serial.sh currently does not work, use run.sh instead. | TODO | |
ARMel qemu-system-arm 5.2.0 |
|
Debian Unstable[1] | -M versatilepb -m 256M -cpu arm1176 -kernel [...] -dtb [...] -append "root=/dev/sda1 panic=10" -hda [...] -no-reboot |
9m24s 2m44s 27s |
— | Testing MZX should be done in system emulation, as several vio tests and the test worlds fail with chroot.sh due to a QEMU bug. The red and blue video components are reversed. | 340MB | QEMU Raspberry Pi kernels and scripts. |
ARMhf qemu-system-arm 5.2.0 |
|
Debian 10.10 | -M virt -m 2048 -cpu cortex-a15 -smp 4 -kernel [...] -initrd [...] -append "root=/dev/vda2" -drive [...] -device virtio-blk-device,drive=hd0 -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 -usb -device usb-ehci,id=ehci -device usb-mouse,bus=ehci.0 -device usb-kbd,bus=ehci.0 |
2m13s (-j4) 53s (-j4) 17s |
— | No working video. Use run.serial.sh. | 413MB | See ARM64. |
ARM64 qemu-system-aarch64 5.2.0 |
|
Debian 10.10 | -M virt -m 2048 -cpu cortex-a57 -smp 4 -kernel [...] -initrd [...] -append "root=/dev/vda2" -drive [...] -device virtio-blk-device,drive=hd0 -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 -device VGA -usb -device usb-ehci,id=ehci -device usb-mouse,bus=ehci.0 -device usb-kbd,bus=ehci.0 |
2m47s (-j4) 59s (-j4) 23s |
— | — | 427MB | Debian Wiki (archived) Blog post with more detailed info. (archived) |
MIPSeb qemu-system-mips 5.2.0 |
— | Debian 10.10 | -M malta -m 256 -kernel [...] -initrd [...] -append "root=/dev/sda1 console=tty0" -drive [...] -device usb-mouse -device usb-kbd -vga std |
33m21s 9m42s 43s |
— | — | 424MB | Setup (archived) |
MIPSel qemu-system-mipsel 5.2.0 |
|
Debian 10.10 | -M malta -m 256 -kernel [...] -initrd [...] -append "root=/dev/sda1 console=tty0" -device usb-mouse -device usb-kbd -vga std |
45m52s 15m06s 46s |
— | — | 408MB | Setup (archived) |
MIPS64el qemu-system-mips64el 5.2.0 |
— | Debian 10.10 | -M malta -m 256 -cpu 5KEc -kernel [...] -initrd [...] -append "root=/dev/sda1 console=tty0" -device usb-mouse -device usb-kbd -vga std |
35m20s 9m08s 39s |
— | RAM values above 256M don't work, may be a QEMU 5.2 bug or a kernel bug. | 414MB | Setup (archived) |
PowerPC qemu-system-ppc 6.0.0 |
|
Debian Unstable 10.0[2] | -L pc-bios -boot c -M mac99,via=pmu -m 1G -prom-env "boot-device=hd:,\yaboot" -prom-env "boot-args=conf=hd:,\yaboot.conf" -drive [...] -serial stdio -g 1024x768x32 |
4m50s 1m26s 17s |
— | — | 459MB | QEMU Wiki (archived) |
PowerPC 64 qemu-system-ppc64 6.0.0 |
|
Debian Unstable 10.0[3][4] | -L pc-bios -boot c -M mac99,via=pmu -m 2048 -cpu 970fx -prom-env "boot-device=hd:,\yaboot" -prom-env "boot-args=conf=hd:,\yaboot.conf" -drive [...] -serial stdio -g 1024x768x32 |
3m36s 59s 14s |
— | — | 483MB | QEMU Wiki (archived) |
RISC-V RV64GC qemu-system-riscv64 5.2.0 |
— | Debian Unstable[5] | -M virt -smp 4 -m 2048M -bios opensbi/generic/fw_jump.elf -kernel u-boot/qemu-riscv64_smode/uboot.elf -append "console=ttyS0 rw root=/dev/vda1" -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0 -device virtio-blk-device,drive=hd0 -drive file=[...],format=qcow2,id=hd0 -device virtio-net-device,netdev=usernet -netdev user,id=usernet,hostfwd=tcp::22222-:22 -device VGA \ -usb -device usb-ehci,id=ehci \ -device usb-mouse,bus=ehci.0 -device usb-kbd,bus=ehci.0 \ |
2m04s (-j4) 48s (-j4) 18s |
— | Serial terminal is required to boot even with a VGA device (Ctrl+Alt+3). | 481MB | Debian Wiki RISC-V article (archived) |
Linux/BSD (secondary architectures)
These architectures do not correspond to any current MegaZeux ports (Alpha, m68k, PA-RISC, SPARC) or are generally more effort to get set up than the rest (SH-4). MegaZeux will probably never run on actual hardware several of these architectures.
Architecture | Related Ports | Distribution | Options | make unit testworlds |
Fails | Other Issues | Image | Links |
---|---|---|---|---|---|---|---|---|
DEC Alpha qemu-system-alpha 5.2.0 |
— | Debian Unstable 2021-04-17 | -m 2048 -kernel [...] -initrd [...] -append "root=/dev/sda3 rw" -drive [...] -device VGA |
4m15s 1m09s 14s |
— | Use --disable-stack-protector . D-Bus and X11 currently do not work correctly due to alignment issues, so use run.serial.sh.
|
455MB | QEMU Wiki (archived) |
Motorola 68000 qemu-system-m68k 5.2.0 |
— | Debian Unstable 2021-04-17 | -M q800 -m 1000M -kernel [...] -initrd [...] -append "root=/dev/sda1 rw console=ttyS0 console=tty" -drive [...] -net nic,model=dp83932 -net user -g 800x600x16 |
4m34s 1m20s 20s |
— | — | 355MB | QEMU Wiki (archived) |
PA-RISC qemu-system-hppa 5.2.0 |
— | Debian Unstable 10.0[6] | -m 2048 -accel tcg,thread=multi -smp 4 -drive [...] -global artist.width=800 -global artist.height=600 -serial mon:stdio |
34m51s (-j4) 13m02s (-j4) 1m51s |
— | Use --disable-stack-protector . Emulation is SLOW! Video doesn't work yet; use run.serial.sh (see setup notes).
|
432MB | QEMU Wiki (archived) PA-RISC Linux Wiki - QEMU (archived) |
SPARC qemu-system-sparc 6.0.0 |
— | NetBSD 9.2[7] | -M SS-20 -m 512M -drive [...] -net nic -net user |
5m50s 1m26s 25s (a173946a) |
— | Use --prefix /usr/pkg --disable-libsdl2 . SDL2 works headless but can't find a texture format and is missing -Wl,-rpath. force_bpp=16 will match colors to the nearest indexed colors. May hang during IO operations, but so far this has only happened with pkgsrc.
|
358MB | QEMU Wiki (archived) |
SPARC64 qemu-system-sparc64 6.0.0 |
— | NetBSD 9.2[8] | -m 2048M -drive [...] -serial mon:stdio |
14m50s 3m38s 33s (a173946a) |
— | Use --prefix /usr/pkg --disable-libsdl2 . SDL2 works headless but can't find a texture format and is missing -Wl,-rpath. force_bpp=16 will match colors to the nearest indexed colors.
|
439MB | QEMU Wiki (archived) |
SuperH SH-4 qemu-sh4-static 5.2.0 |
|
Debian Unstable[9] | n/a | 1m21s (-j4) 26s (-j4) 22s |
— | Only works using user emulation right now; use chroot.sh. Since this VM does boot it might be an issue with newer kernels. | 414MB | Building Debian VMs with debootstrap (archived) |
Setup
If (for whatever reason) you want to set up your own VM images or a similarly configured machine, this is how the VM images above were generated.
Common
Debian is assumed in most of these steps, but they can be adapted to other distros. If one of the alternate setups is required, skip the installer steps in this section.
-
Set up initial QEMU disk image.
qemu-img create -f qcow2 arch.debian10.qcow2 20G
- Extract installation media vmlinux/initrd from ISO (if needed) and set up initial install.sh script.
- Run installer. Leave root password blank, create user mzx with password mzx and sudo access. Do not install a desktop environment.
-
If needed, extract runtime vmlinux/vmlinuz/initrd from the virtual machine (required for ARM, MIPS, RISC-V, Alpha, m68k, and SH-4). The easiest way to do this is to use the guestfish utility from libguestfs.
guestfish --ro -a arch.debian10.qcow2 -i
Then:
copy-out /boot/vmlinux-X.XX.X-X-ARCH . copy-out /boot/initrd.img-X.XX.X-X-ARCH .
- If applicable, set up the run.serial.sh script (or run.sh) and run it to start QEMU.
-
Set up /bin/l (chmod a+x).
#!/bin/sh LC_COLLATE="C" \ ls -la --color=always --group-directories-first "$@"
-
Block the installation of dmenu. In Debian, this is done by creating a file called /etc/apt/preferences.d/no_goosesteppers with the contents:
Package: suckless-tools Pin: origin * Pin-Priority: -1
Update packages.
sudo apt update sudo apt upgrade
-
Install packages for the tools and dependencies required to build MegaZeux:
# Debian sudo apt install build-essential gdb git zlib1g-dev libpng-dev libogg-dev libvorbis-dev libsdl2-dev
# Alpine sudo apk add build-base gdb git zlib-dev libpng-dev libogg-dev libvorbis-dev sdl2-dev
-
Set up MegaZeux repository:
cd ~ git clone https://github.com/AliceLR/megazeux
-
Build MegaZeux and run the tests. Debug builds are used to measure the times in the table above, as release builds can be quite slow to make in these VMs. Video is not required for any of these steps.
./config.sh --platform unix-devel --enable-fps [any other flags here] time make [use -jX with -smp] time make unittest [use -jX with -smp] time testworlds/run.sh unix-devel
- If the target supports video or needs extra packages, see "extra software".
-
If preparing a VM tarball, some steps should be taken to reduce the size of the image.
From the guest OS, clear the apt package cache:
# Debian sudo apt clean
# Alpine sudo apk cache clean
Using guestfish from the host OS, fill all unused space in the image with 0s. This will increase the size of the image to its maximum size. (This method seems to be faster than using the
dd if=/dev/zero
trick some places cite or usingzerofree
from a guest rescue disk.)guestfish --rw -a arch.debian10.qcow2 -i
zero-free-space /
To shrink your working copy of the image, compact it using
qemu-img
(and then test it):mv arch.debian10.qcow2 arch.debian10.old.qcow2 qemu-img convert -O qcow2 arch.debian10.old.qcow2 arch.debian10.qcow2
Finally, generate a compressed tarball containing the image and scripts:
mkdir arch/ cp *.sh arch.debian10.qcow2 arch/ tar -cJf vm-mzx-arch-debian-10.0.tar.xz arch/ # If you have several cores and don't mind using them all, this # makes xz use parallel compression to speed things up. XZ_OPT="-T0" tar -cJf vm-mzx-arch-debian-10.0.tar.xz arch/
Extra software
-
The following packages might be useful depending on the platform and setup:
# Console utilities. sudo apt install dialog screen lm-sensors lynx # Graphical environment and browser. sudo apt install xorg i3 i3lock i3status rofi rxvt-unicode fonts-dejavu # Sway might work better on some setups (encountered on AML-S905X-CC v1). sudo apt install sway xwayland i3status rofi # Extra tools for building libxmp and xmp-cli from source. sudo apt install autoconf automake libtool pkg-config # clang may be useful for its sanitizers and built-in fuzzer, but it is quite large. sudo apt install clang clang-tools llvm # If this machine or VM is going to be shelled into: sudo apt install openssh-server # If memory compression is required: sudo apt install zram-tools
-
You may need to preset various user roles to use a graphical desktop:
# For each user that will be using this: sudo usermod -a -G video [user] sudo usermod -a -G audio [user] sudo usermod -a -G input [user]
-
A launcher for i3 and/or Sway might be useful. By default, these installations use
TDM, a lightweight terminal-based startx wrapper
(which also supports Wayland), but this can be done in several ways.
-
Set up tdm:
sudo apt install dialog git clone https://github.com/dopsi/console-tdm cd console-tdm sudo make install
For each user that will be using tdm:
tdmctl init # You can skip whichever of these window managers isn't present. tdmctl add i3 /usr/bin/i3 tdmctl add sway /usr/bin/sway extra # Place the following in your .profile or .bashrc file: # Optional: Sway hardware cursors may not work in VirtualBox or QEMU. export WLR_NO_HARDWARE_CURSORS=1 # Enable tdm when starting either of the first two VTs. if [ -z "$DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -le 2 ]; then tdm --disable-long-names || true fi # Place the following line in your .xinitrc file: # i3 only: xrdb -merge "$HOME"/.Xresources exec tdm --xstart
-
For a graphical login, xdm is tolerable in a VM and easy to set up:
sudo make install xdm
-
Alternatively, just use "startx" or "sway" manually. In the case of the former, .xinitrc needs to be preset:
xrdb -merge "$HOME"/.Xresources exec i3
-
Set up tdm:
-
X11 only: Debian makes xterm default instead of urxvt, so fix that:
sudo update-alternatives --config x-terminal-emulator
Set up ~/.Xresources from here. This is required to make urxvt not look awful.
cd ~ wget https://www.digitalmzx.com/lachesis/.Xresources
- If applicable, set up the run.sh script and make sure the VM can start up with graphics and run MegaZeux with the software renderer. This may take some trial and error to get right, which is why QEMU options that have worked in the past are provided in the above tables.
PowerPC/PPC64 (Debian Unstable)
Setting up working Debian Unstable builds for PowerPC/PPC64 currently requires a little bit of extra work.
- 1. ^^ An old image supporting Yaboot is currently required because all Debian Unstable PPC/PPC64 installers based on grub-ieee1275 have major installation issues (as of 2021-05-09). Skip setting up an apt repository, then add this to
/etc/apt/sources.list
,sudo apt update
, andsudo apt dist-upgrade
:
deb [trusted=yes] http://ftp.debian.org/debian-ports sid main
Install the following packages afterward to get the installation roughly equivalent to a standard install.
sudo apt install wget curl ftp gnupg debian-keyring debian-archive-keyring
Remove the old kernel and some large dependencies pulled in by mailutils (not required for these VMs):
sudo apt remove linux-image-4.16.0-1-* sudo apt remove mailutils --purge sudo apt autoremove --purge
- 2. ^ The version of Yaboot in older Debian Unstable PPC64 installers does not support ext4 (even though the equivalent PowerPC installer Yaboot does). Use manual partitioning instead of guided partitioning to create an ext2
/boot
partition:
#1 Apple #2 1.0 MB boot #3 256.0 MB ext2 /boot #4 (drive size - 2GB - 258MB) ext4 / #5 2.0 GB swap
PA-RISC (Debian Unstable)
- 1. ^ The Debian Installer in newer installer images crashes prior to partitioning. Like PowerPC, an older image needs to be installed, followed by a dist-update and cleanup. Follow the PowerPC instructions above. Make sure you back up the installed image once you've verified that the installation worked. The upgrade process is slow and will involve trial and error.
- 2. Optional: upgrading systemd may cause the VM to get stuck in an endless boot loop while attempting to run systemd-timesyncd. It may be beneficial to place holds on the relevant systemd packages until after the initial update.
sudo apt-mark hold libpam-systemd sudo apt-mark hold libsystemd0 sudo apt-mark hold systemd sudo apt-mark hold systemd-sysv sudo apt-mark hold systemd-timesyncd
- 3. If the
sudo apt dist-upgrade
fails because of libgcc-s4, do the following, then repeat thesudo apt dist-upgrade
.
sudo apt install -o Dpkg::Options::="--force-overwrite" libgcc-s4
- 4. TODO: due to either Artist emulation bugs in QEMU or a lack of driver support in Linux, running this VM in graphical mode will result in the graphical terminal freezing at a certain point. The boot process will continue as usual and the VM can be used from the serial terminal in this situation. This Xorg config fragment can at least get X to successfully start, but the Artist window will still be frozen.
Section "Device" Identifier "Artist" Driver "fbdev" Option "ShadowFB" "off" EndSection Section "Screen" Identifier "Screen0" Device "Artist" DefaultDepth 8 DefaultFbBpp 8 SubSection "Display" Depth 8 Modes "800x600_60.00" EndSubSection EndSection
ARMel, RISC-V, and SH-4 (Debian Unstable)
^^^ No Debian Installer image is available for this architecture and it must be set up manually. Overview:
- Install debootstrap, qemu-user-static, and debian-ports-archive-keyring. If you aren't using Debian as a host, debian-ports-archive-keyring is available here.
qemu-img create -f qcow2 [arch here].debian10.qcow2 16G
- As root:
modprobe nbd qemu-nbd -c /dev/nbd0 [arch here].debian10.qcow2 parted -s -a optimal -- /dev/nbd0 mklabel msdos mkpart primary ext4 1MiB -2GiB mkpart primary linux-swap -2GiB -0 mkfs -t ext4 -L root /dev/nbd0p1 mkswap -L swap /dev/nbd0p2 mount /dev/nbd0p1 /mnt # For ARMel: debootstrap --arch armel --keyring=/usr/share/keyrings/debian-archive-keyring.gpg unstable /mnt http://ftp.debian.org/debian # For RISC-V: debootstrap --arch riscv64 --keyring=/usr/share/keyrings/debian-ports-archive-keyring.gpg unstable /mnt http://ftp.ports.debian.org/debian-ports # For SH-4: debootstrap --arch sh4 --keyring=/usr/share/keyrings/debian-ports-archive-keyring.gpg unstable /mnt http://ftp.ports.debian.org/debian-ports
- Mount and chroot:
cp /usr/bin/qemu-[arch here]-static /mnt/bin mount -o bind,ro /dev /mnt/dev mount -t proc none /mnt/proc mount -t sysfs none /mnt/sys chroot /mnt uname -a # Verify machine name is armv7l (ARMel), riscv64 (RISC-V), or sh4 (SH-4).
- Edit
/etc/fstab
:LABEL=swap none swap sw 0 0 LABEL=root / ext4 defaults 0 1
Create
/etc/network/interfaces.d/eth0
:# This is the device name used by Debian and is needed for QEMU system emulation. allow-hotplug eth0 iface eth0 inet dhcp
Create
/etc/network/interfaces.d/enp1s0
:# This allows networking to work from a chroot from Fedora. allow-hotplug enp1s0 iface enp1s0 inet dhcp
Create
/etc/network/interfaces.d/lo
:# This configures the loopback interface. # This breaks booting in ARMel and can be omitted for that platform. auto lo iface lo inet loopback
- Install and configure some required packages:
apt install debian-ports-archive-keyring apt install sudo man locales console-setup wget curl ftp gnupg # These images generally use US/Mountain but the specific timezone isn't that important. dpkg-reconfigure tzdata # Only select en_US.UTF-8 here; others can be added later if needed. dpkg-reconfigure locales systemctl enable serial-getty@ttyS0.service
RISC-V only: install a kernel (the ~860MB install size is normal).
apt install linux-image-riscv64 # Also, some extra things to do here (see Debian Wiki RISC-V page): apt install u-boot-menu openntpd ntpdate sed -i 's/^DAEMON_OPTS="/DAEMON_OPTS="-s /' /etc/default/openntpd echo ' UBOOT_PARAMETERS="rw noquiet root=/dev/vda" U_BOOT_FDT_DIR="noexist"' >> /etc/default/u-boot u-boot-update
SH-4 only: install a kernel.
apt install linux-image-sh7751r
- Setup user:
adduser mzx usermod -a -G sudo mzx passwd -l root
- ARMel only: get a Raspberry Pi Linux kernel (4.19.50) and versatile-pb-buster.dtb here.
- RISC-V only: get the latest copy of OpenSBI and U-Boot for QEMU from the Debian packages repository. Extract OpenSBI and the U-Boot riscv64_smode kernel; these are required to boot the virtual machine.
Setup (NetBSD)
^^ Setting up NetBSD is a little more involved than Debian. Note NetBSD also isn't aware of power management for some architectures and will use a full core while its VM is running.
-
Set up initial QEMU disk image.
qemu-img create -f qcow2 arch.netbsd.qcow2 20G
- For whatever reason, the QEMU -kernel option doesn't seem to work with any BSD kernels, so right now any QEMU that requires -kernel should use a Linux instead.
- Run installer. Leave root password blank, create user mzx with password mzx and sudo access (if it doesn't give you the option, set the root password). Install all packages, including the X window system. Enable xdm and nptdate. If network autodetection doesn't work here (SPARC 32-bit), pkgin and pkgsrc will need to be set up manually after reboot. Otherwise, install both.
- Set up run.serial.sh script and run.
-
As root, set up /bin/l:
echo '#!/bin/sh LC_COLLATE="C" \ ls -la "$@"' > /bin/l chmod a+x /bin/l
-
As root, set a hostname, disable IPv6, enable DHCP (if it isn't already), and reboot:
# Set a hostname for this architecture e.g. SPARC, SPARC64, ARMv6. echo "SPARC" > /etc/myname # Disable IPv6 for DHCP. # This prevents issues where all downloads can hang for a long time before # the download starts (due to attempting IPv6 first and it timing out). cp /etc/dhcpcd.conf ~/ echo ' # Disable IPv6 Support. noipv6rs noipv6' >> /etc/dhcpcd.conf # If it wasn't enabled during install, you can enable DHCP like this. cp /etc/rc.conf ~/ echo "dhcpcd=yes" >> /etc/rc.conf # Reboot for these changes to take effect. reboot
-
If network wasn't available during installation, manually install pkgsrc. As root:
ftp http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc.tar.gz tar -xzf pkgsrc.tar.gz -O /usr chown root:wheel -R /usr/pkgsrc
-
If network wasn't available during installation, manually install pkgin. As root:
# Replace ARCH and VERSION for the applicable architecture (e.g. sparc) and version (e.g. 9.2). pkg_add http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/ARCH/VERSION/All/pkgin
-
As root, install packages with pkgin:
pkgin install sudo bash gmake git nano p7zip pkgin install zlib png libogg libvorbis SDL SDL2 pkgin install lynx openssl ca-certificates
If precompiled packages aren't available for this architecture, use pkgsrc to build and install these packages instead. WARNING: this will take a while.
- When configuring MegaZeux, make sure to use /usr/pkg as the prefix and to use gmake to invoke Makefile targets.
-
Preparing the image is a little different from Debian, mainly since the Linux kernel does not have write support for NetBSD's filesystem by default. As root, clear the pkgin cache and zero free space.
pkgin clear cat /dev/zero >delet_this sync rm delet_this
If pkgsrc was used, make sure there are no work directories leftover in the pkgsrc tree (TODO).
The image is now ready to be shrunk with qemu-img.