Monday, February 20, 2023

RetroPie on Odroid C2 with Armbian

 

My Odroid C2 used to run some of my PostgreSQL BuildFarm animals. But it has been sitting in my drawer for the past year or so after burning through so many micro SD cards (compiling programs on flash memory takes a heavy toll).

Thinking of repurposing it for RetroPie. The last official Ubuntu was based on 20.04. Wasted couple of hours tried to resolve version issues with mali fb package. Tried to go with Armbian and it was surprisingly straightforward.

Basic installation

  • Download and install Armbian 22.11 for Odroid C2. I used the Jammy CLI version
  •  Boot up let it resize the partition. Follow the instructions to setup account and wifi etc
  • Login as root via ssh (or serial console). Run "apt update && apt upgrade" to bring it up to date. Also install git "apt install git"
  • Create a new account called "pi" (or any other name) that will be used to run RetroPie. Setup sudo and allow login without password

useradd -mb /home -s /bin/bash -G input,video pi
echo 'pi ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/pi
passwd -d pi

  • Login as pi
  • Clone and run the RetroPie setup scrit

git clone --depth=1 https://github.com/RetroPie/RetroPie-Setup.git
cd RetroPie-Setup
sudo ./retropie_setup.sh

  • Select and start the Basic Installation
  • (Go have lunch and come back a few hour later)
  • And that is it. Once it is done, should be able to start RetroPie by running "emulationstation"

X-box 360 controller setup

The X-box 360 controller is plug-and-play in RetroPie. However, it doesn't work in games. Turns out RetroPie configured it with an incorrect name.

  • Run "cat /proc/bus/input/devices" and check the device name of the controller. Mine is called "Microsoft X-Box 360 pad"
  • Edit the file "/opt/retropie/configs/all/retroarch-joypads/Xbox 360 Controller.cfg" (or whatever config file created by RetroPie)
  • Change the value of "input_device" field to be the actual device name found

HDMI audio setup

Also, there is HDMI audio within RetroPie but not within games. To set it up:

  • Starting retropie
  •  Go to Retropie Configurations > Configuration Editor > Advanced Configuration > Configure Libreto options > all/retroarch.cfg
  • Go to “audio_driver” and select “sdl2” as the driver

Auto start

Quick-and-dirty way to auto start RetroPie:

  • As root, create the directory and file "/etc/systemd/system/getty@tty1.service.d/override.conf"
  • Add these to the file to enable auto login for user "pi":

[Service]
ExecStart=
ExecStart=-/sbin/agetty --noissue --autologin pi %I $TERM
Type=idle

  •  Add "emulationstation" to the .bash_profile file of the user "pi" to run Emulation Station once logged in

TBC

  • The HDMI video output is flicking on my ultrawide screen. Could be timing or resolution issues. May need to tune the kernel boot-up parameters
  • The Odroid C2 has pinout for SPDIF. Seems to be directly linked to HDMI audio. If so, will see if possible to get it hook up to a DAC

EDIT 20230223

  • Couldn't find an easy way to edit the HDMI resolution / mode for Armbian. Ended up using a Debian image instead
  • Edit /boot/config.ini and uncomment the line
videoconfig="video=HDMI-A-1:1920x1080@60"
  • To setup the sound, in addition to selecting "sdl2" in retroarch, needed to:
    • Enable and setup output format by running
amixer sset 'AIU HDMI CTRL SRC' I2S 90% unmute
    • Create a file ~/asoundrc to output to the device:

pcm.!default {
  type plug
  slave {
    pcm "hw:0,0"
  }
}

ctl.!default {
    type hw
    card 0
}

 


No comments: