Goodbye USB HUB, hello NFS!

One of the weaknesses of OUYA is having only one USB port, which makes it a pain if anyone wants to use a USB control and at the same time use a large collection of ROMs. If you don’t use a self-powered HUB, you may experience problems. In addition, the transfer speed drops a lot.

After being very angry with a USB HUB I decided to try using some file sharing via the network with OUYA and found another old script that works perfectly, using NFS.

ATTENTION: I will not address the NFS server part. If you use Linux, see the instructions for your distribution. If you use Windows, look for how to set up an NFS server, but my recommendation is to use Linux, very easy.

As in the case of the tutorial for using a wiimote in OUYA:

FIRST:

Root the OUYA as explained here: https://www.s-config.com/root-the-ouya-google-play/ 1

ATTENTION: Don’t install the google play or the mod collection and don’t use the busybox from there, instead use the busybox from the links below:

adb install busybox-1.31.1-46.apk
(https://github.com/meefik/busybox/releases/download/1.31.1/busybox-1.31.1-46.apk)

adb install Universal-initd.apk
(https://github.com/Androguide/Universal-init.d/blob/master/Universal-initd.apk)

The script that originated this post can be found here:
https://www.progressivethink.in/on/ouya/and/ouya-nfs-mount-script/

But I felt the need to make some changes to it, so my version is available here:
NFS_SHARE_OUYA_SCRIPT

The two changes I implemented were:

  • The entire configuration is done just by changing the “Global Variables” at the beginning of the script; and
  • If the person shares using a pendrive and needs to change it, the script dismounts the sharing on OUYA if it is mounted.

Start Universal Init.d, give root permission to it. But you will see that we still don’t have any scripts to run. To install the script, proceed as follows:

SO:

adb shell

su

mount -o rw, remount -t ext4 /dev/block/platform/sdhci-tegra.3/by-name/APP

cd /system/etc

mkdir init.d

chmod -R 755 init.d

cd init.d/

vi nfs_share

Press “i” in your keyboard and copy and paste the script code.

I will consider that my version is being used:

You need to make the following changes:

At the beginning of the script we have:

#Global variables:
LOGGER="/mnt/sdcard/nfsmount.log"
LOOPCOUNT=0
SERVERIP="192.168.15.1"
SERVERSHARE="/mnt/sda1"
MOUNT="/mnt/sdcard/roms"
echo "" > $LOGGER

Just change SERVERIP, SERVERSHARE and MOUNT to your settings.

Remember to keep the quotes and pay attention to the correct path of the share locations and where it will be mounted in OUYA.

And a little later we have:

##If you are using a Linux / Windos machine for sharing, uncomment the first line; or
##If you are using a server with OpenWRT and want a read only share, uncomment the second line; or
##If you are using a server with OpenWRT and want a read/write share, uncomment the third line.

    #/system/xbin/busybox mount -o nolock,ro,hard,intr,vers=3 -t nfs ${SERVERIP}:"$SERVERSHARE" "$MOUNT" >> $LOGGER
    #/system/xbin/busybox mount -o nolock,ro,hard -t nfs ${SERVERIP}:"$SERVERSHARE" "$MOUNT" >> $LOGGER
    #/system/xbin/busybox mount -o nolock,rw,hard -t nfs ${SERVERIP}:"$SERVERSHARE" "$MOUNT" >> $LOGGER

It is self explanatory: Just uncomment the line you want to use.

I kept three because the first is the original script and it worked normally on my laptop with Linux, but not with OpenWRT.

Press ESC and type :wq and press ENTER to save the file and exit of vi.

chmod 755 nfs_share

cd /

mount -o ro, remount -t ext4 /dev/block/platform/sdhci-tegra.3/by-name/APP

AFTER:

exit
exit

FINALLY:

Start Universal Init.d and if you chose to mount the share at boot, set it to run at startup (the ON / OFF option in Universal Init.d). If not, just choose the script from the menu and some options will appear at the top of the Universal Init.d, among them the option to execute the script. Just run and when it is finished you can exit the Universal Init.d.

If you marked the script to be used at boot and you want to unmount and mount the share after the boot, just go to Universal Init.d and run the script again.

Attention: The script takes a while because there are some pauses inside it (where sleep 5 appears), so wait for the Super Init.d to return to the same state as when you started it after finishing the execution.

If everything is correct, just access the share folder with FilePW and you will see your ROMs there.

I tested it with RetroArch here and it worked normally: Small games like SNES and Genesis load as if we had the flashdrive plugged into OUYA. Larger games (NeoGeo, CPS1, CPS2 and CPS3) take about 10 seconds at most, but run perfectly … I haven’t tested performance when using games on CD

All merits for the script’s creator, Eldon McGuinness:

https://www.progressivethink.in/authors/eldonmcguinness/

3 Likes

Great post! Definitely an upgrade for someone who normally uses usb drives!

2 Likes

Really nice write up! Thanks.

1 Like

Initially I said that if the script is scheduled to start with the boot it would be necessary to comment on this part of it:

#Check if the share is mounted, if it is, unmount it:
TEST=$(cat /proc/mounts | grep -c $SERVERIP)
if [ $TEST -ge 1 ]; then
        echo "Share found. Umounting the share." >> $LOGGER
        /system/xbin/busybox umount "$MOUNT"
        echo "Run it again if you want to mount the share again. Bye Bye!" >> $LOGGER
        sleep 5        
        exit

but it is unnecessary since it will not locate the share and simply skip the dismounting of it.