A guide for how I made RetroPie, RetroArch, and EmulationStation Work on the Rock64
#1
Thumbs Up 
So first off, while I'm a "professional computer guy", my expertise is Microsoft stuff, so before getting my raspberry pi 3 I had very little linux experience. The RPI3 has a lot of downloadable images that basically "just work" out of the box, but ROCK64 doesn't have that benefit yet. And with the more powerful hardware on this platform, I have been excited to figure this out... but to get it up and running I've had to learn quickly and do a lot of research. 

After banging my head against things, neglecting the family, angering the demon that is my wife, and having to start over again multiple times... I finally got RetroPie, RetroArch, and EmulationStation working. I figured I'd contrubute to the community with what steps I took, but I offer no support or guarantees. All I know is that now I'm "rock64ing" RP, RA, and ES Smile

I wanted to use the newest linux builds available from ayufan but ran into problems booting (no video), so I ended up going back a few versions. I'm eventually planning to try to find a way to upgrade to the newest build without having to redo everything (if you know how, feel free to let me know, I'm still learning all this).

I started with jessie using the 0.5.10 build from ayufan (jessie-minimal-rock64-0.5.10-118-arm64.img.xz). I was using a computer monitor and an HDMI-DVI converter to configure everything on jessie, but once it got it all working I tried it on my TV and got no display :Sad So I started over using stretch (stretch-minimal-rock64-0.5.10-118-arm64.img.xz). I'll post the details of both in case it helps anyone. And there's always a chance some of the steps I took were not necessary, but it worked out for me.

First off, as a relatively linux noob, here's my notes on some helpful linux commands that I had to learn and use in my trials: 
----------------------
To show version of installed package: apt-show-versions <package>

After a fresh OS install, run these to get everything updated:
  apt-get update
  apt-get upgrade
  apt-get dist-upgrade

To install newer/unstable versions of packages (such as gcc):
  echo "deb http://ftp.us.debian.org/debian unstable main contrib non-free" >> /etc/apt/sources.list.d/unstable.list
  apt-get update
  apt-get install -t unstable gcc-5

To downgrade/install a specific version of packages: sudo apt-get install <package-name>=<package-version-number>

To open compressed log files: zcat logfile.gz

To show all versions available for a package: apt-cache madison <package>

To show what packages depend on a specific package: apt-cache rdepends packagename

To list all installed packages: apt list --installed

To manually mount a USB drive: 
  mkdir /media/usb1 (if it doesn't already exist)
  mount /dev/sda1 /media/usb1

To Unmount a USB Drive: umount /media/usb1

To get CPU detail: lscpu

To get status of services: service --status-all

To restart a service: service <service name> restart

To force-overwrite packages after apt-get error: sudo dpkg -i  --force-overwrite  /var/cache/apt/archives/<package file name>.deb

To download a package files only without installing: aptitude download <package_name> (note: had to install aptitude)

Force network adapter to get DHCP address: dhclient eth0 -v 

To NEVER ALLOW DROP TO COMMAND and auto-start emulation station, add this to the bottom of ~/.profile:
   [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec emulationstation
 (preferred method is to use retropie setup to tell ES to autorun in config)

To set the timezone: dpkg-reconfigure tzdata

To enable autologin: edit the file /lib/systemd/system/getty@.service and change the line
    ExecStart=-/sbin/agetty --noclear %I $TERM
  to
    ExecStart=-/sbin/agetty --noclear -a rock64 %I $TERM

Ways to build a debian package from source:
  checkinstall (had to add this package manually, but makes ANY INSTALLATION into a debian package and replaces the make command!)
  The next two are picky and require a true debian source package, needs to run from within the debian folder with a special file in it:
   dpkg-buildpackage -us -uc -b (this one seems to work the best)
   dpkg-deb --build <package name> 

 To add a root share after installing samba, add the below to the config /etc/samba/smb.conf (NOTE: retropie setup lets you do it without the console):
    [root]
    comment = root
    path = "/"
    writeable = yes
    guest ok = yes
    create mask = 0644
    directory mask = 0755
    force user = rock64
-------------


Now to the guts of the RP, RA, and ES installs:

For both jessie and stretch you'll need the most recent retropie source from github. Then use this pull request to make the necessary changes to the code to support a rock64 install:
https://github.com/RetroPie/RetroPie-Set...2205/files


ON JESSIE:
-----------------
First run the retropie-setup script after you've applied the pull request to source. This alone should allow you to run the retropie setup.

The release of jessie that I used has an older version of GCC and causes build errors when installing retroarch and emulationstation (unknown value 'native' for -march).
To build retroarch you'll need to upgrade GCC, so I added the unstable apt source (per my instructions above) and chose to install version 7.2.
To build emulationstation you'll need to upgrade G++, so I added the unstable apt source (per my instructions above) and chose to install version 7.2.

I attempt to install retroarch and emulationstation and after reviewing the logs find that they fail due to an attempt at overwriting existing libraries (because some are already included in the libmali-rk* packages). After the first failed installations I drop to console and apt-get remove the following:
 libsdl2-dev
 libmali-rk-utgard-2th-r7p0
 libmali-rk-dev
(don't reboot)

I then return to retropie-setup and attempt retroarch and emulationstation installations again. If I run into any failures again, I note the log file it refers to and I drop back to console and review the log and manually force the failing package to overwrite the existing one using the below command and try the install again:
  sudo dpkg -i  --force-overwrite  <full path to DEB file>

Eventually both RA and ES install successfully. But... ES doesn't start due to a segmentation fault. So, REINSTALL both libmali-rk* packages with force-overwrite. For example:
    sudo dpkg -i  --force-overwrite  /var/cache/apt/archives/libmali-rk-utgard-2th-r7p0_1.5-4ayufan12_arm64.deb
----------------------


ON STRETCH:
-----------------------
(for all below steps, whenever something doesn't install due to an overwrite, I use dpkg to force overwrite it, just like previously explained)
Ran all updates, upgrades, and dist-upgrades after the fresh image booted.
The first few times I tried this I ended up with the "unable to initialize SDL" errors and my attempts to fix it made things worse. This time I decided to be proactive and build a few packages first to try and get dependencies in place. I have no idea if this was absolutely necessary. But again, it worked.
   apt-get install xorg-dev
   apt-get build-dep xscreensaver vlc totem
I ignored any package warnings it throws at this point since I was just looking for some dependencies to get installed.
Now run the retropie-setup script after you apply the pull request from github.
Try and install Retroarch and Emulationstation. Any failures, review the listed log file and force overwrite the failing library manually using dpkg like I previously explained.
Eventually both will install, but emulationstation still returns unable to init SDL.
Did some testing and found that the libsdl2-dev package was actually on hold. I figured I'd remove and reinstall the libmali-rk-utgard package...
but it wouldn't let me due to a dependency issue. I installed aptitude to see what it recommended as a solution.
So first I let it install libmali-rk-midgard-4th-r13p0. Then I was able to successfully remove libmali-rk-utgard. 
Then I reinstalled the libmali-rk-utgard package using dpkg with overwrite.
Then I uninstalled and reinstalled libmali-dev.
------------

At this point, whether you're on jessie or stretch, you should be able to start ES and start installing your various emulators. Some will install just fine, and others will fail and you'll have to review logs and tend to the overwrites manually using the same methods we used during the install. I didn't test all the emulators but was able to get a good handful running without issues. Again, I can't make any promises or do much support on this, but I hope it helps some of you get up and rolling. If anyone has additions or runs into other required fixes, please post for the community benefit.

Good luck everyone, and happy rock64ing!
  Reply
#2
If I understand you correctly you want to be able to update the pre-releases provided by ayufan, correct?
If so, you need to edit /etc/apt/sources.list.d/ayufan.list (double check the dir and filename - don't have my rock64 onsite)
and uncomment the line about the prereleases. Then do apt-get update and apt-get dist-upgrade.
But be warned - those are prereleases and the latest (v0.60 ??), for example, didn't work for me and 
left me with an unbootable device. Luckily I have emmc and sd, so no problem to reimage latest working image.

Cheers
Claudia
  Reply
#3
Thanks Claudia - I was able to successfully do a dist-upgrade on the install and nothing broke Smile Still working out some kinks in making the board work for all TV's, and on the ones where it does work I've found emulationstation randomly switching between HDMI and DVI modes (in DVI there's no sound). Just posted a question to ayufan about why the boot/config.txt doesn't appear to exist and when I manually set it up, it doesn't appear to do anything.
  Reply
#4
FYI - the newest prerelease fixed the hdmi switching to dvi issue. Next challenge is to try and make the build able to cross compile for armhf (32-bit) and then hack the retropie setup script to force the cross compile to see if it improves performance on some of the more demanding emulators (PSX, N64, GC). Anyone with experience in either of those feel free to speak up!
  Reply
#5
(12-21-2017, 08:47 PM)Mrfixit2001 Wrote: FYI - the newest prerelease fixed the hdmi switching to dvi issue. Next challenge is to try and make the build able to cross compile for armhf (32-bit) and then hack the retropie setup script to force the cross compile to see if it improves performance on some of the more demanding emulators (PSX, N64, GC). Anyone with experience in either of those feel free to speak up!

Hey Mrfixit2001, I was happy to see your guide and some of your troubleshooting.

I'm trying to follow it on the latest image of DietPi, which runs on debian 9 arm64.
It's not working, is there any developtment in this approach since 2017?

One of the main hiccups I've been seeing is that there's no package or source for "libmali-rk-dev". I got past the SDL error

By the way, there's a binary for retroach in this distribution (and apt install it works), why doesn't retropie setup script just uses it? Is it really necessary to build retroach and emulationstation from source?

Here's a log of the events:

Code:
Log started at: Mon 17 Dec 07:47:50 -02 2018

RetroPie-Setup version: 4.4.4 (e719833)
System: Linux DietPi 4.4.132-1075-rockchip-ayufan-ga83beded8524 #1 SMP Thu Jul 26 08:22:22 UTC 2018 aarch64 GNU/Linux

= = = = = = = = = = = = = = = = = = = = =
Installing dependencies for 'retroarch' : RetroArch - frontend to the libretro emulator cores - required by all lr-* emulators
= = = = = = = = = = = = = = = = = = = = =

/home/rock64/RetroPie-Setup/tmp/build/retroarch /home/rock64/RetroPie-Setup

= = = = = = = = = = = = = = = = = = = = =
Getting sources for 'retroarch' : RetroArch - frontend to the libretro emulator cores - required by all lr-* emulators
= = = = = = = = = = = = = = = = = = = = =

git clone --recursive --depth 1 --branch v1.7.5 "https://github.com/libretro/RetroArch.git" "/home/rock64/RetroPie-Setup/tmp/build/retroarch"
Cloning into '/home/rock64/RetroPie-Setup/tmp/build/retroarch'...
Note: checking out 'c9c6c5a5a63cf49821f785eda58ad46864864cd5'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

 git checkout -b <new-branch-name>

Checking out files:  38% (2643/6816)  
Checking out files:  39% (2659/6816)  
Checking out files:  40% (2727/6816)  
Checking out files:  41% (2795/6816)  
Checking out files:  42% (2863/6816)  
Checking out files:  43% (2931/6816)  
Checking out files:  44% (3000/6816)  
Checking out files:  45% (3068/6816)  
Checking out files:  46% (3136/6816)  
Checking out files:  47% (3204/6816)  
Checking out files:  48% (3272/6816)  
Checking out files:  49% (3340/6816)  
Checking out files:  50% (3408/6816)  
Checking out files:  51% (3477/6816)  
Checking out files:  52% (3545/6816)  
Checking out files:  53% (3613/6816)  
Checking out files:  54% (3681/6816)  
Checking out files:  55% (3749/6816)  
Checking out files:  56% (3817/6816)  
Checking out files:  57% (3886/6816)  
Checking out files:  58% (3954/6816)  
Checking out files:  59% (4022/6816)  
Checking out files:  60% (4090/6816)  
Checking out files:  61% (4158/6816)  
Checking out files:  61% (4212/6816)  
Checking out files:  62% (4226/6816)  
Checking out files:  63% (4295/6816)  
Checking out files:  64% (4363/6816)  
Checking out files:  65% (4431/6816)  
Checking out files:  66% (4499/6816)  
Checking out files:  67% (4567/6816)  
Checking out files:  68% (4635/6816)  
Checking out files:  69% (4704/6816)  
Checking out files:  70% (4772/6816)  
Checking out files:  70% (4803/6816)  
Checking out files:  71% (4840/6816)  
Checking out files:  72% (4908/6816)  
Checking out files:  73% (4976/6816)  
Checking out files:  74% (5044/6816)  
Checking out files:  75% (5112/6816)  
Checking out files:  76% (5181/6816)  
Checking out files:  77% (5249/6816)  
Checking out files:  78% (5317/6816)  
Checking out files:  79% (5385/6816)  
Checking out files:  80% (5453/6816)  
Checking out files:  81% (5521/6816)  
Checking out files:  82% (5590/6816)  
Checking out files:  83% (5658/6816)  
Checking out files:  83% (5670/6816)  
Checking out files:  84% (5726/6816)  
Checking out files:  85% (5794/6816)  
Checking out files:  86% (5862/6816)  
Checking out files:  87% (5930/6816)  
Checking out files:  88% (5999/6816)  
Checking out files:  89% (6067/6816)  
Checking out files:  90% (6135/6816)  
Checking out files:  91% (6203/6816)  
Checking out files:  92% (6271/6816)  
Checking out files:  93% (6339/6816)  
Checking out files:  94% (6408/6816)  
Checking out files:  95% (6476/6816)  
Checking out files:  96% (6544/6816)  
Checking out files:  97% (6612/6816)  
Checking out files:  98% (6680/6816)  
Checking out files:  98% (6693/6816)  
Checking out files:  99% (6748/6816)  
Checking out files: 100% (6816/6816)  
Checking out files: 100% (6816/6816), done.
patching file input/input_driver.c
Successfully applied patch: /home/rock64/RetroPie-Setup/scriptmodules/emulators/retroarch/01_hotkey_hack.diff
patching file menu/widgets/menu_entry.c
Successfully applied patch: /home/rock64/RetroPie-Setup/scriptmodules/emulators/retroarch/02_disable_search.diff
patching file input/drivers_joypad/udev_joypad.c
Successfully applied patch: /home/rock64/RetroPie-Setup/scriptmodules/emulators/retroarch/03_disable_udev_sort.diff
/home/rock64/RetroPie-Setup
/home/rock64/RetroPie-Setup/tmp/build/retroarch /home/rock64/RetroPie-Setup

= = = = = = = = = = = = = = = = = = = = =
Building 'retroarch' : RetroArch - frontend to the libretro emulator cores - required by all lr-* emulators
= = = = = = = = = = = = = = = = = = = = =

Checking operating system ... Linux
Checking for suitable working C compiler ... /usr/bin/gcc works
Checking for suitable working C++ compiler ... /usr/bin/g++ works
Checking for pkg-config ... /usr/bin/pkg-config
Checking for availability of switch -std=gnu99 in /usr/bin/gcc ... yes
Checking for availability of switch -Wno-unused-result in /usr/bin/gcc ... yes
Checking for availability of switch -Wno-unused-variable in /usr/bin/gcc ... yes
Checking function sd_get_machine_names in -lsystemd ... no
Checking presence of package bcm_host ... no
Checking function bcm_host_init in -lbcm_host ... no
Checking presence of package egl ... no
Checking existence of -lEGL ... no
Checking function ass_library_init in -lass ... no
Checking function pthread_create in -lpthread ... yes
Checking function pthread_key_create in -lpthread ... yes
Checking function dlopen in -ldl ... yes
Checking function socket in -lc ... yes
Checking function getaddrinfo in -lc ... yes
Checking existence of -lminiupnpc ... no
Checking function fcntl in -lc ... yes
Checking function getopt_long in -lc ... yes
Checking presence of package alsa ... 1.1.3
Checking presence of package rsound >= 1.1 ... no
Checking presence of package libroar ... no
Checking presence of package sdl2 >= 2.0.0 ... 2.0.8
Checking presence of package flac ... no
Checking existence of -lFLAC ... no
Checking presence of package libusb-1.0 >= 1.0.13 ... 1.0.21
Checking presence of package zlib ... 1.2.8
Checking presence of package libmpv ... no
Checking presence of package libavcodec >= 54 ... 57.64.101
Checking presence of package libavformat >= 54 ... 57.56.101
Checking presence of package libavdevice ... 57.1.100
Checking presence of package libswresample ... 2.3.100
Checking presence of package libavresample ... 3.1.0
Checking presence of package libavutil >= 51 ... 55.34.101
Checking presence of package libswscale >= 2.1 ... 4.2.100
Checking presence of header file libavutil/channel_layout.h ... yes
Checking function dlopen in -ldl ... yes
Checking presence of package gbm >= 9.0 ... 13.0.6
Checking presence of package libdrm ... 2.4.74
Error: Cannot find libgbm, libdrm and EGL libraries required for KMS. Compile without --enable-kms.
Makefile:10: config.mk: No such file or directory
rm -rf obj-unix
rm -f retroarch
rm -f *.d
Makefile:10: config.mk: No such file or directory
config.mk is outdated or non-existing. Run ./configure again.
Makefile:182: recipe for target 'config.mk' failed
make: *** [config.mk] Error 1
/home/rock64/RetroPie-Setup
Could not successfully build retroarch - RetroArch - frontend to the libretro emulator cores - required by all lr-* emulators (/home/rock64/RetroPie-Setup/tmp/build/retroarch/retroarch not found).

Log ended at: Mon 17 Dec 07:48:28 -02 2018
Total running time: 0 hours, 0 mins, 38 secs
~


Edit:
Was able to install emulationstation and retroarch, but now the emulationstation command in terminal shows this error:

Code:
rock64@DietPi:~$ emulationstation
lvl0:   Error - File type unknown!
emulationstation: /home/rock64/RetroPie-Setup-4.3/tmp/build/emulationstation/es-core/src/resources/Font.cpp:17: Font::FontFace::FontFace(ResourceData&&, int): Assertion `!err' failed.

Edit2:
tried the install with the pull edits on the latest minimal ubuntu armhf image. It installs everything, but emulationstation won't run.
It's funny, because depending on the libmali (rk-dev, utgard, etc.) deb package I installed, I got a different error. Some of then just hanged in a black screen, some had issues regarding sdl2 and so on.
There's probably a better approach to troubleshoot this, but I have no idea which it is ahaha
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Beginners Guide: Migrating to SSD rontant 18 44,043 01-19-2022, 09:30 AM
Last Post: Ellesar Dragon
Information Beginners Guide: Adding USB Storage, Linux Formatting and Permissions Ptheven 4 13,347 03-06-2021, 01:49 PM
Last Post: helpmerock
  Rock64 - Simple Bare-Metal Example krjdev 1 5,289 01-24-2021, 11:59 PM
Last Post: krjdev
  Step by step guide PXE diskless configuration. burglar_ot 13 38,671 11-01-2020, 11:26 PM
Last Post: michael.gruner
Information Manual: Howto cross-compile Upstream U-Boot for rock64 rock7 3 9,231 04-15-2020, 05:09 PM
Last Post: rock7
  Using the Movidius NCS with rock64 markjay 0 4,646 07-02-2018, 09:51 AM
Last Post: markjay
  Guide - XRDP - Debian Stretch / Ubuntu Xenial / OMV S3phi40T 3 14,776 05-05-2018, 06:08 AM
Last Post: S3phi40T
Information Guide - Raid Array (Raid 0) Ptheven 0 5,153 10-07-2017, 09:22 AM
Last Post: Ptheven
Information Guide - Setting up a NFS Share Ptheven 0 5,877 09-26-2017, 04:44 AM
Last Post: Ptheven
  Guide - Setting up a SMB(Windows) file server Ptheven 0 13,199 08-21-2017, 08:54 AM
Last Post: Ptheven

Forum Jump:


Users browsing this thread: 1 Guest(s)