This repository contains a Dockerfile and build script for compiling the m8c client for the DirtyWave M8 Headless firmware and necessary kernel modules for Anbernic's Linux-based handheld console devices based on the Allwinner h700 chip. Broadly, these are the RG35XX* & RG40XX* devices
Note on IRL Anbernic device tests: I have only tested this on an Anbernic RG35XXSP & RG40XXV myself, but others in the Discord community have basically run this on other RG35XX* & RG40XX* devices.
Note on custom firmware on Anbernic device: This uses tooling from the Knulli CFW project. It might work on other custom firmwares, but I haven't tested them (yet).
The idea behind this is to provide a platform that makes it relatively easy for most people to compile a runnable executable of the M8 Tracker software for handheld gaming consoles. With a bit more tinkering, this could be made more flexible so that it's easy to build m8c for other devices and/or other firmware.
- Git
- Docker
This version builds using:
- Linux kernel
v4.9.170 - Knulli RG35XX Plus/H/SP/2024 toolchain
rg35xx-plush-sdk-20240421/aarch64-buildroot-linux-gnu_sdk-buildroot - m8c
v1.7.10
-
Clone this repository:
git clone https://github.com/jamesMcMeex/m8c-rg35xx-knulli.git
-
Go into the directory:
cd m8c-rg35xx-knulli -
Run the build script:
./build.sh
-
Clone this repository:
git clone https://github.com/jamesMcMeex/m8c-rg35xx-knulli.git
-
Go into the directory:
cd m8c-rg35xx-knulli
-
Run Docker commands directly:
docker buildx create --name m8c-builder --driver docker-container --bootstrap docker buildx use m8c-builder docker buildx build --platform linux/amd64 --load -f Dockerfile.x86_64 -t m8c-knulli . mkdir -p output docker run -v ${pwd}/output:/build/compiled m8c-knulli
The script automatically detects system architecture on Linux/macOS and uses the appropriate build configuration. After the build process completes, you'll find the compiled files in a new output/ directory located inside the source directory.
build.sh: Main build script that detects architecture and manages the build processDockerfile.arm64andDockerfile.x86_64: Sets up the build environment for different architecturesbuild_script.arm64.shandbuild_script.x86_64.sh: Architecture-specific build scripts
The build process includes the following steps:
- Downloads and extracts the Linux kernel source (version 4.9.170)
- Downloads and extracts the Knulli ARM64 toolchain
- Downloads the Knulli Linux config file for RG35XX* devices
- Downloads and extracts the m8c project
- Configures and builds the necessary kernel modules
- Builds m8c
- Collects all built files and creates a startup script
After a successful build, you'll find the following in the output directory:
- A folder named
m8cwith them8cexecutable and the compiled kernel modules (cdc-acm.ko,snd-hwdep.ko,snd-usbmidi-lib.ko,snd-usb-audio.ko) inside m8c.shstartup script
- Locate the
roms/portsfolder in the partition used to store ROMs (this will either be theSHAREvolume when using a single SD card setup, or on the second SD card, if you've set up Knulli on your device this way) - Drop the
m8cfolder and them8c.shscript into this location - (Optional) Add the m8c application to the
gamelist.xmlfile to make it a bit more pretty in the Knulli UI
If you encounter issues running m8c on your device, here are some common problems and solutions:
When you see "Permission denied" or the app won't launch:
-
Make sure both files are executable by running these commands in the ports/m8c directory:
chmod +x m8c.sh chmod +x m8c/m8c
-
For kernel module loading issues, you may need to set correct permissions:
chmod 644 m8c/*.ko
If you get audio-related errors:
- First make sure your M8 is properly connected via USB
- Try unplugging and reconnecting your M8
- If the error persists, you may need to restart your device
If you're still having issues:
- Check existing Issues to see if others have solved your problem
- When creating a new issue, please include:
- Your device model (RG35XX+, RG35XXSP, etc.)
- The exact error message you're seeing
- Steps you've already tried
You can modify the build process by adjusting any of these files:
- Architecture-specific Dockerfiles (
Dockerfile.arm64,Dockerfile.x86_64) to change the build environment - Build scripts (
build_script.arm64.sh,build_script.x86_64.sh) to modify the build process - Main build script (
build.sh) to change how architecture detection and Docker builds are handled
Common customizations include:
- Changing the kernel version
- Using a different toolchain
- Updating the M8C repository URL or version
- Modifying kernel module configurations
Feel free to fork the repository, make your changes, and submit a pull request.
- DirtyWave for creating the M8 tracker
- laamaa for developing m8c
- mnml for writing the script that gave me the inspiration to hack
- knulli-cfw for the RG35XX Plus custom firmware work
- All the other people who contributed to the mountain of software that makes things run on a dinky little computer