Recalbox Network (Samba) Roms Folder

Here is my technique for having the Recalbox roms folder mounted on the network.
This allows for all yours roms to be on the network and every Recalbox can access them.

 There were a few obstacles

1) Emulation station is booted before the network is up to reduce boot times
2) If we change any of the existing init.d files - our changes will be overwritten on updates
3) fstab won't work either

Our solution is to create a custom.sh script that Emulationstation will run on boot.

Please note: This method requires at least Recalbox 4.0.0-beta4

Let's get started.

First boot the Raspberry Pi into Recalbox.

Now we need to SSH into Recalbox.
We do this using a program called Putty on a Windows computer that is on the same network as the Pi.

Download putty.exe from here

Save it somewhere you can easily find it.
It's portable - which means it doesn't need to be installed.
Open the downloaded putty.exe to start Putty.

Enter the Pi's IP address in the host name field and make sure the port is 22.
(Often you can find the IP by looking at the DHCP client list in your router settings page.)
Then click Open.


You should see "login as:" appear.
Type root and hit enter. Now type in the password recalboxroot and hit enter.

You should now be logged into the Pi remotely.
Now, you can copy the below commands into the terminal window.

First, we need to change the filesystem from RO (read only) to RW (read / write).
mount -o remount,rw /
Now we need to mount our network folder and copy over all the files.
mkdir /tmp/share
mount -t cifs -o user={USER},password={PASS},rw //{IP}/{SHARE} /tmp/share
If your share is public and doesn't require username / password, then use the below
mount -t cifs -o user=guest,rw //{IP}/{SHARE} /tmp/share
Replace {IP} with the IP address of your share & replace {SHARE} with the name of the share.
If required, replace {USER} and {PASS} to what is required for your share.
Note: It appears Recalbox requires write (rw) permission to the network share.

We now need to copy over all the files from the existing roms folder to our new roms folder
cp -r /recalbox/share/roms/. /tmp/share/
Now unmount this share
umount -l /tmp/share
Now let's create our custom.sh script
nano /recalbox/share/system/custom.sh
Copy the below text into the editor
#!/bin/sh

case "$1" in
start)
  while ! ping -c 1 -W 1 {IP}; do
     sleep 1
  done

  mount -t cifs -o user={USER},password={PASS},rw \
         //{IP}/{SHARE} /recalbox/share/roms

  /etc/init.d/S*emulationstation restart
  ;;
stop)
  umount -l /recalbox/share/roms
  ;;
esac

exit $?
Remember to change {IP}, {SHARE}, {USER} and {PASS} to match your setup  :)

Save the file (CTRL-X, Y, ENTER)

Now make sure the script is executable
chmod +x /recalbox/share/system/custom.sh
Now reboot.
reboot
Recalbox will boot and initially show the 'internal' roms.
This is because Emulation Station starts before the network and our script :(

Once the network is started our script will then run, mount the network roms folder and restart Emulation Station to display the network roms.

I also advise making a backup of your working custom.sh file.
Just in case the file is deleted during updates (shouldn't happen though).

Discussion

Support