I am currently researching if it's possible to run a Minecraft server on a Luckfox Pico Mini A, an embedded Linux board with a Rockchip RV1103 and 64 MB of RAM. It runs Buildroot, a framework for generating embedded Linux system images. Luckfox provides pre-built images to get the board up and running, but that image reserves almost half of the RAM for the camera module I won't be using. So, what I'll do is set up an Ubuntu 22.04 VM, try to disable the camera and adb interfaces to save RAM, and see if I can bake Cuberite into the system image. I'll be updating this post as I work on this crazy new project. The board has pads for Ethernet wires, but I will be targeting Ethernet over USB for software prototyping.
Building the stock image
The Ubuntu VM was a no-go. It was very slow on my M4 Mac due to x86-64 emulation in UTM. So, I used my Dell Latitude 7420. I got Ubuntu installed, cloned the Luckfox Pico SDK, and ran ./build.sh lunch to select the Luckfox Pico Mini with SD boot (My model does not have flash storage onboard). Then, I ran ./build.sh to create the Buildroot images, which took about 30 minutes. After that, I had my sd_update.img which I dd'ed to the MicroSD card. Put the card in the mini, connected over ADB, and it worked just like the prebuilt image I had tried previously.
There is 15.7MB of memory available at boot on my built stock image. free -h shows 31.8MB total memory, even though this is a 64MB board. I need to figure out where all that extra memory went, and see if there are services I can disable to get more free space. Cuberite needs about 20MB for the core, plus 20MB for each Minecraft world. Hopefully I can squeeze out some RAM and enable swap in the Buildroot configuration.
Reducing CMA RAM Allocation
I'm not using the camera, and it turns out 24MB of RAM is allocated to the camera ISP by default. So, I edited a config file in the SDK for my board, rebuilt the image, and flashed it to the SD card. free -h now shows 54.8MB of total memory and 37.8 free. That might be just enough for Cuberite if I get a swap file or partition running.
Swap and running Cuberite
Adding swap space was easy. I created a 256MB swap file and enabled it. The hard part was cross-compiling Cuberite for ARM, so I “cheated” using my good friend Steve (ChatGPT). I cloned Cuberite, set the environment variable to use the g++ included with the Luckfox Pico SDK, and got to compiling. glibc detection broke while cross-compiling for ARM/uClibc, so I patched Cuberite to get around that and it built!
I used adb push to move the compiled files over to the Pico, and ran Cuberite without changing any settings. Then, I used adb forward to expose the Minecraft port to my PC. I logged into the server from my Minecraft 1.12.2, and it kicked me because it couldn't authenticate me due to the Pico not having an internet connection. I disabled authentication in settings.ini, then relaunched Cuberite. To my utter surprise I was in, playing Minecraft on this board with 64MB of RAM. It was lagging badly and I got kicked for breaking too many blocks in one time unit because the poor thing was using the swap file like crazy, but it worked! Next steps are some optimizations like reducing render distance and disabling the nether and end. Crazy limitations, I know, but I want this thing to be relatively playable.