ODROIDI use a 6 core 4G ODROID, with 128G EMMC and 128G SD storage, because its pretty zippy.
Getting the Right UbuntuYou don't need nor want a lot of Operating System or Windowing overhead if you just want gaming emulation. It makes sense that you want to squeeze every cycle out of your CPU, and not waste them on over-processing. So, because the stock Ubuntu 22 runs on the 4.9 Kernel on ODROID, we have a problem: the Mali GPU driver isn't supported for OpenGL. We need 5.* or later and the Bifrost video drivers. And we want a minimal Window manager - in fact we want a server build (no X11) to start with and only install the minimum amount of XWindows to save on space (and time). And, you really want to use the GPU - not just the framebuffer and software rendering (that is ... slow).
Fortunately, to_better has these linux builds for ODROID. http://docs.linuxfactory.or.kr/ has lots of great advice and images for a server tuned Ubuntu on ODROID. You can grab ubuntu-22.04-server-odroidn2l, and use Etcher on Windows or Linux to write the image to SD CARD or EMMC.
odroid@server:~$ uname -a Linux server 5.15.0-odroid-arm64 #1 SMP PREEMPT Ubuntu 5.15.110-202305030140~jammy (2023-05-02) aarch64 aarch64 aarch64 GNU/LinuxI wanted a fast disk, so I got the EMMC card from ODROID, but I needed to blast the new image with this cool little adapter:
Updating the Linux Kernel to Support RotateI face a challenge in that the PacMan display is portrait (so height > width). Once I attached the video card, and booted, the world was sideways. Also, the video logic board is in Chinese, so there wasn't a "hardware" configuration change I could see. The folks at HardKernel fixed the kernel to support console rotation ( see the ODROID forum ) - you'd need to install this kernel if you want to rotate the frame buffer.
A Light Weight Window ManagerOnce you have your Linux, you can install a light weight Window manager to make life easier should you choose - like I do - to be more than a kiosk. xfce4 should install what you need for bare bones X11.
sudo apt install xserver-xorg-core xfce4If you just want a kiosk, then some suggest
The next step is telling X11 you want to be rotated too. After starting xfce4, open your display settings, and select
leftunder rotation. This should stay rotated, but I think there is a glitch somewhere that when screen savers or power savers kick in, the screen will rotate back. It is an issue with xfce4 / window manager as I don't have this issue when I run as a kiosk (described later.)
Building the Emulator Front End and EmulatorsGetting into the details of building tools is not here - there are many pages that instruct folks how to build the tools you use. Remember to move your compiled code to a place like
/usr/gamesafter executables are compiled. Also, the config files for both MAME and Attract will be in your $HOME directory (as whatever user you work under). Don't run X11 or the these applications as root (but you likely should build them as root.)
You should make sure you turn on swap before compiling and linking MAME, as 4G may not be enough to compile fully with optimization, so I recommend creating an 8G swap.
sudo fallocate -l 8G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile sudo echo "/swapfile none swap sw 0 0" >> /etc/fstab
AttractI used attract-2.6.2 aka Attract Mode as my front end because it is simple and easy to configure.
MAMEI used MAME 2.5.4 as my machine emulator. The documentation isn't great for Linux but you can get what you need to compile MAME. Note that MAME on X11 uses Simple DirectMedia Layer (SDL) for input, output, and the MESA OpenGL shim. My
makefileturns on the following compile options:
NOWERROR = 1 OSD = sdl SDLMAME_X11 = 1 OPTIMIZE = 2 TARGETOS = linuxthat you can then use with a
make -j6to use all 6 cores (takes a few hours to compile full MAME.)
If you, like me, like to play and optimize code, MAME doesn't do a good job cleaning up after itself, so you will need to do this from the MAME source directory:
make clean rm -rf `find . -name *.gch -print` rm -rf `find . -name *.a -print`to prevent "symbol not found" type errors if you fiddle with optimizations and headers.
Autostart to Kiosk, XFCE4 or ShellThere are several ways you can get linux to start an application instead of gettty terminal. I wanted to still log in, but after log in, auto run attract to be a kiosk. So, a .bash_profile is the trick to prompt what to do or timeout and just run attract!
odroid@server:~$ cat .bash_profile read -t 10 -p "1) shell 2) xfce4 or do nothing and launch as kiosk: " v if [[ $? -gt 128 ]] ; then startx ./headless.sh else case "$v" in ) ;; # dont exit as it will quit the shell ) startxfce4;; *) echo "Huh?? I think you mean exit.";; esac fiThis script does on of three things when the user logs in.
- exit to console shell
- start xfce4 as a Window Manager
- just launch attract without a Window Manager under X11 if the user doesn't enter 1 or 2
The script I use to start as a kiosk:
odroid@server:~$ cat headless.sh xrdb -merge $HOME/.Xresourcesii & xrandr --output HDMI-1 --panning 0x0+0+0 --fb 0x0 --rotate left & xset s off && xset -dpms & xfconf-query -c xsettings -l & attractTranslating into english,
- attach fonts and whatnot I might set from the Window Manager
- rotate the display left, resetting the pan and framebuffer, and output to HDMI-1
- turn off screen saver and power management (I use Attract's screen saver)
- dump out my settings and run attract