MegaZeux Development VMs

From MZXWiki
Revision as of 00:21, 10 May 2021 by Lachesis (talk | contribs) (Update PowerPC 64 tarball size.)
Jump to navigation Jump to search

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) 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. The x86_64 and i686 architectures are omitted because there is currently no point in maintaining development VMs for them.

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.

Architecture Related Ports Distribution Options make
unit
testworlds
Fails Other Issues Image Links
ARMel
qemu-system-arm
  • Nintendo DS
  • Nintendo 3DS
  • GP2X
TODO
ARMhf
qemu-system-arm 5.2.0
  • Android
  • Raspberry Pi
  • PlayStation Vita
  • Pandora
Debian 10.9
-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
2m01s (-j4)
58s (-j4)
14s
No working video. Use run.serial.sh. 625MB See ARM64.
ARM64
qemu-system-aarch64 5.2.0
  • Android
  • Nintendo Switch
Debian 10.9
-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
2m33s (-j4)
1m13s (-j4)
17s
687MB Debian Wiki (archived)

Blog post with more detailed info. (archived)
Both of these are outdated; the BIOS image seems to be included out of the box in newer QEMU versions.

MIPSeb
qemu-system-mips 5.2.0
Debian 10.9
-M malta -m 512
-kernel [...] -initrd [...]
-append "root=/dev/sda1 console=tty0"
-drive [...]
-device usb-mouse -device usb-kbd
-vga std
~30 min.
~16 min.
31s
698MB Setup (archived)
MIPSel
qemu-system-mipsel 5.2.0
  • PlayStation Portable
Debian 10.9
-M malta -m 512
-kernel [...] -initrd [...]
-append "root=/dev/sda1 console=tty0"
-device usb-mouse -device usb-kbd
-vga std
~36 min.
~21 min.
35s
672MB Setup (archived)
MIPS64el
qemu-system-mips64el 5.2.0
Debian 10.9
-M malta -m 256 -cpu 5KEc
-kernel [...] -initrd [...]
-append "root=/dev/sda1 console=tty0"
-device usb-mouse -device usb-kbd
-vga std
~25 min.
~14 min.
30s
RAM values above 256M don't work, may be a QEMU 5.2 bug or a kernel bug. 672MB Setup (archived)

More info (archived)

PowerPC
qemu-system-ppc
  • Mac OS X
  • Nintendo Wii
  • Nintendo Wii U
Debian Unstable 10.0[1]
-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
4m49s
2m27s
17s
737MB QEMU Wiki (archived)
PowerPC 64
qemu-system-ppc64
  • Mac OS X
Debian Unstable 10.0[2][3]
-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
3m12s
1m37s
11s
742MB QEMU Wiki (archived)
RISC-V RV64GC
qemu-system-riscv64
Fedora Rawhide

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
Debian 5.0.10
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
4m19s
2m30s
22s
When sdl_set_video_mode is modified to accept RGB555 and force_bpp=16 is used (shouldn't be necessary), video does not draw correctly. 577MB QEMU Wiki (archived)
PA-RISC
qemu-system-hppa
NetBSD 9.0
SPARC
qemu-system-sparc
Debian 4.0 r4a
SPARC64
qemu-system-sparc64
NetBSD 9.0
SuperH SH-4
qemu-system-sh4
  • Sega Dreamcast

Setup

If (for whatever reason) you want to set up your own VM images, this is roughly how all of the VM images above were generated.

  1. Set up initial QEMU disk image.
    qemu-img create -f qcow2 arch.debian10.qcow2 20G
    
  2. Extract installation media vmlinux/initrd from ISO (if needed) and set up initial install.sh script.
  3. Run installer. Leave root password blank, create user mzx with password mzx and sudo access. Do not install a desktop environment.
  4. 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 .
    
  5. Set up run.serial.sh script and run.
  6. Set up ~/.Xresources. This is required to make urxvt not look awful.
    # "lumifoo" by gutterslob.
    
    ! special
    *.foreground:   #888a8c
    *.background:   #1e2021
    *.cursorColor:  #888a8c
    
    ! black
    *.color0:       #515151
    *.color8:       #707172
    
    ! red
    *.color1:       #bf6382
    *.color9:       #eaaec2
    
    ! green
    *.color2:       #65a446
    *.color10:      #aed49b
    
    ! yellow
    *.color3:       #ad8a43
    *.color11:      #d4c3a0
    
    ! blue
    *.color4:       #6b85c2
    *.color12:      #afc4e9
    
    ! magenta
    *.color5:       #9e6bb8
    *.color13:      #d2b1e2
    
    ! cyan
    *.color6:       #5c9d88
    *.color14:      #a4d0c1
    
    ! white
    *.color7:       #919191
    *.color15:      #d0d0d0
    
  7. Set up /bin/l (chmod a+x).
    #!/bin/sh
    
    LC_COLLATE="C" \
    ls -la --color=always --group-directories-first "$@"
    
  8. Install packages (Debian assumed, will be different for other platforms):
    sudo apt install git p7zip-full build-essential gdb zlib1g-dev libpng-dev libogg-dev libvorbis-dev libsdl2-dev xorg i3 i3lock i3status suckless-tools xdm lynx
    
  9. Set up MegaZeux repository:
    sudo mkdir /megazeux
    sudo chown mzx:mzx /megazeux
    cd /megazeux
    git clone https://github.com/AliceLR/megazeux .
    
  10. Build MegaZeux:
    ./config.sh --platform unix-devel --enable-fps [any other flags here. release builds are NOT recommended.]
    time make [use -jX with -smp]
    time make unittest [use -jX with -smp]
    time testworlds/run.sh unix-devel
    
  11. Set up 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 the QEMU options are provided in the above tables.
  12. 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:
    sudo apt 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 using zerofree 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 image for the tarball:

    qemu-img convert -c -O qcow2 arch.debian10.qcow2 arch.debian10.compressed.qcow2
    

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, and sudo 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, then make urxvt the default terminal emulator.

sudo apt install wget curl ftp gnupg debian-keyring debian-archive-keyring rxvt-unicode
sudo update-alternatives --config x-terminal-emulator

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