Skip to content

Commit 4c70d81

Browse files
committed
Update the manual.
1 parent 96b7ee5 commit 4c70d81

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

docs/Manual.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,68 @@ model_set_texture(model, "game/texture/sometex.png"); // located at `res/game/..
9292
9393
When you import a GLTF/GLB file textures will be automatically imported (copied) to the `res` directory and the connection between imported meshes and their assigned textures will be saved in the imported files.
9494
95+
# Building your game for retro handhelds (ARM64 Linux devices)
96+
97+
## Setup
98+
99+
This section describes the build process for such devices as Anbernic RG35XX H or similar.
100+
101+
- Based on https://github.com/Cebion/Portmaster_builds
102+
103+
The section will describe commands for WSL2 Ubuntu 24.04.1 LTS (for Windows users, Linux users you know what to do):
104+
```
105+
sudo apt update && sudo apt upgrade -y
106+
sudo reboot now
107+
```
108+
Wait for console to close, then in Windows console:
109+
```
110+
wsl --shutdown
111+
```
112+
Then back in Ubuntu:
113+
```
114+
sudo apt install -y build-essential binfmt-support daemonize libarchive-tools qemu-system qemu-user qemu-user-static gcc-aarch64-linux-gnu
115+
wget "https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-arm64-root.tar.xz"
116+
mkdir arm64ubuntu
117+
sudo bsdtar -xpf ubuntu-24.04-server-cloudimg-arm64-root.tar.xz -C arm64ubuntu
118+
119+
sudo cp /usr/bin/qemu-aarch64-static arm64ubuntu/usr/bin
120+
sudo daemonize /usr/bin/unshare -fp --mount-proc /lib/systemd/systemd --system-unit=basic.target
121+
sudo mount -o bind /dev arm64ubuntu/dev
122+
sudo chroot arm64ubuntu qemu-aarch64-static /bin/bash
123+
rm /etc/resolv.conf
124+
echo 'nameserver 8.8.8.8' > /etc/resolv.conf
125+
exit
126+
mkdir -p arm64ubuntu/tmp/.X11-unix
127+
128+
echo '#!/bin/bash' > chroot.sh
129+
echo 'sudo daemonize /usr/bin/unshare -fp --mount-proc /lib/systemd/systemd --system-unit=basic.target' >> chroot.sh
130+
echo 'sudo mount -o bind /proc/ arm64ubuntu/proc/' >> chroot.sh
131+
echo 'sudo mount --rbind /dev/ arm64ubuntu/dev/' >> chroot.sh
132+
echo 'sudo mount -o bind /tmp/.X11-unix arm64ubuntu/tmp/.X11-unix' >> chroot.sh
133+
echo 'sudo chroot arm64ubuntu qemu-aarch64-static /bin/bash' >> chroot.sh
134+
chmod +x chroot.sh
135+
sudo ./chroot.sh
136+
```
137+
Try `sudo apt update && sudo apt upgrade -y` if you get an error `sudo: unable to resolve host ...` write the hostname that you got in that message in the file `/etc/hostname` (replace the old one) and in the file `/etc/hosts` under the localhost string (use the same 127.0.0.1 address).
138+
```
139+
sudo apt update && sudo apt upgrade -y
140+
sudo apt install --no-install-recommends build-essential git wget libdrm-dev libopenal-dev premake4 autoconf libevdev-dev pkg-config zlib1g-dev cmake cmake-data libarchive13 libcurl4 libfreetype6-dev librhash0 libuv1 libgbm-dev clang libvorbis-dev libflac-dev
141+
```
142+
143+
Then install SDL dependencies: https://github.com/libsdl-org/SDL/blob/main/docs/README-linux.md#build-dependencies
144+
145+
## Steps for each release of your game
146+
147+
Copy your game using the Windows explorer into a new directory at ~/arm64ubuntu/tmp/game (directory inside of the chroot). Then back into the WSL:
148+
```
149+
sudo ./chroot.sh
150+
cd tmp/game
151+
mkdir build
152+
cd build
153+
cmake -DCMAKE_C_COMPILER=clang -DCMAKE_BUILD_TYPE=Release ..
154+
cmake --build . --target <game_target_name> --config=Release --parallel
155+
```
156+
Then copy the resulting binary (from `build/OUTPUT/game`) to your ARM64 Linux device. We don't worry about installing SDL and other libraries because we link SDL and other libraries statically. Inside of your ARM64 Linux device launch the game using some file explorer or a console.
157+
158+
Note that running games made with this engine on `libmali` drivers (which your handheld's OS might use) may cause issues and crashes (for example loading a texture may cause black screen and/or out of memory error) instead prefer to use `panfrost` drivers if your OS provides them. Most of the testing is done on Rocknix which provides an option to change used driver in the settings.
159+

0 commit comments

Comments
 (0)