Thanks!
No, that’s Dispmanx.
Yes, running Ubuntu 18.04. Below are my notes for an optimal setup. Replace any occurrences of {username} and {user_password} with your Linux user name/password.
EDIT: The “guide” below is based on using Ubuntu 18.04. It will get you a Linux based RetroArch system that runs automatically on boot (auto-launched from the terminal using DRM/KMS for video output). When exiting RetroArch, the system will also shut down automatically in a controlled way. Using this guide, you can pretty easily set up a RetroArch console-like system, similar to RetroPie. Combined with RetroArch’s kiosk mode, you also get a system that cannot (easily) be corrupted by kids and other non-tech-savvy people. Great for creating a locked-down emulation box.
Set Ubuntu to start in console mode (you can skip this if using Ubuntu server flavor):
1. Find GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub and change it to GRUB_CMDLINE_LINUX_DEFAULT="text"
2. Update grub with sudo update-grub
3. Tell systemd to not load the desktop:
- sudo systemctl enable multi-user.target --force
- sudo systemctl set-default multi-user.target
Auto-login user:
1. sudo systemctl edit getty@tty1
2. Add these lines and exchange "username" with the real user name:
[Service]
ExecStart=
ExecStart=-/sbin/agetty -a username --noclear %I $TERM
On Ubuntu Server, set network timeout so that it doesn't wait 5 minutes during boot for network to come up if no network is connected:
1. sudo systemctl disable systemd-networkd-wait-online.service
2. sudo systemctl mask systemd-networkd-wait-online.service
On Ubuntu Server, set ifup timeout so that it doesn't wait a long time during system shutdown if no network is connected:
1. sudo systemctl edit [email protected]
2. Add these lines:
[Service]
TimeoutStopSec=5sec
Make input in RetroArch work by setting correct permissions:
1. Add to /etc/udev/rules.d/99-evdev.rules:
KERNEL=="event*", NAME="input/%k", MODE="666"
2. Then reload rules with sudo udevadm control --reload-rules.
Install cpufrequtils for controlling CPU governor:
1. sudo apt install cpufrequtils
To force the CPU to max turbo frequency at all times, we want to disable processor C states. If the motherboard/system supports disabling C-states via BIOS/UEFI, use this option. If not, do the following:
1. sudo nano /etc/default/grub
2. Find the line that says GRUB_CMDLINE_LINUX="". Add the following between the quotes: intel_idle.max_cstate=1
NOTE: If there's already text between the quotation marks, just add the text at the end of the quote, with a space separating it from the existing text.
3. sudo update-grub
4. Reboot and check that the setting has had effect. The following command shall print '1': sudo cat /sys/module/intel_idle/parameters/max_cstate
Add RetroArch Ubuntu PPA and install RetroArch and cores:
1. sudo add-apt-repository ppa:libretro/testing
2. sudo apt-get update
3. sudo apt install retroarch
4. Install desired cores like this (snes9x as example): sudo apt install libretro-snes9x
Autostart RetroArch after auto-login, set CPU governor to performance, limit RetroArch to a maximum resolution (1080p in this example) and make the system shutdown when RetroArch is shutdown (with a 5 sec window to press key to abort and go to command line):
[Note: For maximum CPU performance, also disable C states in UEFI. However, leave SpeedStep enabled, since Turbo Boost otherwise seems to stop working. Note that these UEFI settings should be combined with using the "performance" CPU governor, otherwise the CPU will still try to lower its clocks. Disabling C states did seem to provide a small but measurable increase in performance over just setting the CPU governor to "performance".]
1. Install fbset: sudo apt install fbset
2. Go to the user's home directory.
3. sudo nano .profile
4. Add the lines below to the end of the file. Substitute {username} with the actual username. Substitute {user_password} with the user's login password.
# Set performance CPU governor for all four cores.
echo "{user_password}" | sudo -S cpufreq-set -c 0 -g performance
echo "{user_password}" | sudo -S cpufreq-set -c 1 -g performance
echo "{user_password}" | sudo -S cpufreq-set -c 2 -g performance
echo "{user_password}" | sudo -S cpufreq-set -c 3 -g performance
maxWidth=1920
maxHeight=1080
width=$(echo "{user_password}" | sudo -S fbset | awk 'NR==2{sub(/.*mode "/,"");sub(/x.*/,"");print;}')
height=$(echo "{user_password}" | sudo -S fbset | awk 'NR==2{sub(/.*x/,"");sub(/"/,"");print;}')
if [ $((width * height)) -gt $((maxWidth * maxHeight)) ]
then
echo "Current resolution is ${width}x${height}, which is higher than the specified maximum of ${maxWidth}x${maxHeight}. Starting RetroArch in ${maxWidth}x${maxHeight}."
sed -i "s/video_fullscreen_x = \"[0-9]\+\"/video_fullscreen_x = \"${maxWidth}\"/g" /home/{username}/.config/retroarch/retroarch.cfg
sed -i "s/video_fullscreen_y = \"[0-9]\+\"/video_fullscreen_y = \"${maxHeight}\"/g" /home/{username}/.config/retroarch/retroarch.cfg
else
echo "Starting RetroArch in ${width}x${height}."
sed -i "s/video_fullscreen_x = \"[0-9]\+\"/video_fullscreen_x = \"${width}\"/g" /home/{username}/.config/retroarch/retroarch.cfg
sed -i "s/video_fullscreen_y = \"[0-9]\+\"/video_fullscreen_y = \"${height}\"/g" /home/{username}/.config/retroarch/retroarch.cfg
fi
retroarch
if read -r -s -n 1 -t 5 -p "Press any key to abort system shutdown and return to the command line..."
then
echo " Shutdown aborted."
else
shutdown now
fi