Tutorial 9: Monku R3 - ODROID-XU4 / XU4Q Ultimate Gaming Console Build Part 2
-
Author: Brian A. Ree
Part 1 of this tutorial which details the hardware and initial software configurations can be found here.
Sections
0: Tools and Parts
- This tutorial doesn't require any new parts or tools we'll just be configuring the console
you've already built, adjusting things to really make it shine.
1: Introduction and Tutorial Goals
Hello and welcome to the last tutorial in this series. Hats off to you for making it this far.
We hope you've learned a lot if any of this was new to you. This review will show you in detail how to polish off your
Monku Retro 3 (ODROID-XU4) video game console. We'll be optimizing MATE,
the Linux desktop environment, setting up retroarch in kiosk mode, and boot.ini configuration scripts. Ok let's dive in!
2: Finalizing MATE ... Almost
The first thing we're going to do in this part is get rid of that pesky authentication prompt that pops up when you
try and open a browser for the first time after logging in. ALERT: This is not a high security setup, we are purposely
lowering the security level here to make it easier to use as a game console and web browsing set top box. Go to the following
menu location Applications -> Accessories -> Passwords and Keys and you should see a window popup similar to the one depicted below.
ALERT: If at any time you are prompted for a login when working with the terminal use the password, odroid.
Locate the Login entry in the list on the left hand side of the window. If the authentication popup I mentioned references a different
Password keychain then find that entry in the list on the left hand side of the window. Follow the steps below to unlock the target keychain.
1. Right click on the target entry and select Change Password.
2. You will be prompted to enter the old password, type in odroid and click Continue.
3. You'll now be prompted to enter a new password, leave both fields blank and click Continue.
4. Another dialog will popup and ask you if it's ok to allow the keychain to be unlocked, click Continue.
5. Close out of all the dialogs and close the Password and Keys window, we're all set.
Next thing we'll do with the MATE environment is configure the panels and widgets a bit. You can do whatever you like
here, I'll just show you how I configure things and why. First off we're expecting to interface with this system,
at least some of the time, with a gamepad. It works great but it's not a mouse, also we're not really going to be
doing any rigorous Linux computing so there are a few things we don't need. The second benefit to this configuration
step is that is does lower the memory overhead a little.
Follow these instructions to remove the bottom panel. We will be adding controls to the top panel to offset some of the
functionality loss but we won't be adding in the desktop selection widget. It's just a bit of overkill for our needs.
Again if you want it, it won't harm anything to keep it. Follow these instructions to clean up the panels and widgets just a bit.
1. Go to the bottom panel and right click on it, select Delete This Panel, then click Delete again when prompted.
2. Go to the top right hand side of the screen and right click the power button, select Remove From Panel.
What we're going to do is add some of the widgets back to the top panel making the top panel a more centralized point of control.
This makes using the gamepad to control things much much easier. Your desktop should look like the screen shot below.
Since we got rid of our open window selection buttons when we deleted the bottom panel let's add a new widget to the top panel
that does the same thing but is better suited for a gamepad since it requires less cursor movement to utilize. Right click on the top panel
and select Add to Panel. Scroll down the list of options until you see the entry depicted below and then click Add.
We have a few more steps to get through here regarding the tray apps and the date and time configuration
but we're almost done. Your desktop should now look something like this.
Next let's click on the Date and Time string in the top right corner. A calendar drop down should appear.
Expand the Locations section and click the Edit button. Configure the General tab as depicted
below or as you see fit.
Let's add some location information so the time will be correct when we have an internet connection and sync with ntp,
network time protocol. Click on the Locations tab then click the Add button.
Start typing the nearest major city into the Location Name text box. If it doesn't work try another major city
or try the city representative of your time zone, for instance mine is New York. Select a location from the list that
pops up. Mine would be Central Park, NY. Click Ok once you've found something suitable.
Now you will see a location entry in the locations list as depicted below.
Just a few more things left to do here. If you right click the battery icon in the top right try. Select
the Preferences option. Click on the General tab and toggle Never display an icon. If you
have a EN or UK string in the system tray right click on it and select Preferences. On the General
tab uncheck Show icon on system try. We won't really be worring about switching the keyboard language. If you need this you can
turn both system try icon back on by using the System -> Control Center menu option and clicking on Power Management
and iBus Preferences respectively. The screen shots below show the forms we just discussed.
Just two little things left in this part and we'll be moving onto the custom control button and scripts!
Move the mouse to the top panel and right click on it. Select Add to Panel then scroll down until you see
the Show Desktop option as shown below. Do the same thing for the Trash option also shown below.
Use the center mouse button, or the mouse wheel button if you have that instead, to move the widget icons
on the top panel. Let's drag these two new widgets a little closer to the System menu. Also separate them
a little bit. Nice! Now we're ready to start adding custom scripts. These scripts will automatically start retroarch
on boot, and start antimicro when retroarch closes returning mouse control to the gamepad. We'll also be setting up
some boot.ini control scripts. Your desktop should look like the one depicted below.
3: Scripts and Custom Control
In this part we're going to setup some custom scripts to control the software we installed and configured.
This will bring the experience up from a Linux desktop experience to more of a game console experience.
Download the script bundle below and then copy and paste it into the install_zips
folder you created in the previous tutorial. It is located in the odroid user's home directory.
- Monku R3 Scripts
Once you have downloaded and copied the zip file into the install_zips folder, right click on it and select
Extract Here. Seven files should appear in a sub directory, open it and select them all and copy them into the odroid user's home
directory. The odroid user's home directory is the default location of the file browser, you can also access it from a link
on the desktop or from the left hand side of the file browser where the folder shortcuts are listed.
Let's make sure these scripts have the correct permissions and can be executed. Open up a terminal,
Applications -> System Tools -> MATE Terminal, and run the following commands.
sudo chmod 755 restart_now shutdown_now start_am start_antimicro start_auto start_ra stop_auto
sudo chmod +x restart_now shutdown_now start_am start_antimicro start_auto start_ra stop_auto
Now close the terminal and go to System -> Control Center in the menus. Find and select the Startup Applications
option. You should see something similar to what's depicted below.
Click the Add button and fill out the form as depicted below, I'll put the exact text here also.
Name: Start RetroArch
Path: /home/odroid/start_ra
Description: Launches RetroArch on startup.
Now, we also want to start a special AntiMicro script. So let's do the same thing for that script, also shown below.
Again I'll list the values used here.
Name: Start AntiMicro
Path: /home/odroid/start_am
Description: Launches AntiMicro on startup.
Shutdown the device, System -> Shut Down. Then use the hardware reset button to turn it back on.
You should see retroarch launch automatically as shown below. Now if you close retroarch and wait about 5 seconds
you should see antimicro popup into the system tray and restore gamepad control of the device, also shown below.
Things are shaping up nicely now. Our beautiful ODROID is looking more and more like a great retro gaming console.
4: Finalizing MATE ... Really This Time
I hope you're really enjoying everything so far. We have a little bit more work to do with MATE but it'll go by quick ...
promise. So right click the top panel and select Add to Panel, scroll down through the list of options until you find
the Shut Down entry. Click Add and then use the middle mouse button or mouse wheel button to grab the new widget and
position it so that it is about an inch or so away from the open programs widget. By keeping all the controls in a tight group
we greatly enhance the user experience when controlling things with the gamepad.
Next up we're going to add two custom buttons to the top panel. Right click the panel and select Add to Panel,
choose the very first option Custom Application Launcher, depicted above. We'll add the stop button first and then the play button.
The form field values are listed below. Use the screen shots to navigate to the proper icon. You can see the path in the screen capture
near the top of the window.
Stop Button Values:
Type: Application
Name: Stop RetroArch
Command: /home/odroid/stop_auto
Comment: Stops RetroArch if running windowed. (Really just stops RetroArch and resets AntiMicro)
Start Button Values:
Type: Application
Name: Start RetroArch
Command: /home/odroid/start_auto
Comment: Starts RetroArch and AntiMicro scripts.
The screen shots below depict this step. Use them to help with finding the right icon if need be.
Now let's test the new controls. Close retroarch and any other open window. Click on the play button and you should see
retroarch popup. Click the stop button and retroarch will close, wait about 5 seconds, and you should see antimicro in the system
tray giving us back full gamepad control.
Wow wow. This is really cool. We've basically completely customized our ODROID go hardware and software to create a
retro gaming console with retroarch kiosk mode and also full Linux environment if needed. So cool! Next thing we'll do is
make retroarch run in fullscreen mode and adjust a few video settings. I won't go into advanced configuration here. This tutorial
is about as long as I like to make them so I'll push advacned retroarch and emulator errata to a small follow up tutorial.
Start retroarch, you can use the little widget you just made! Scroll right to the Drivers section find the Video
entry.
Apply the following settings listed below in the order they have been listed. The application may close and re-open
for some of the settings you change, that is normal.
Windowed Fullscreen Mode: Off
Show Window Decorations: Off
Threaded Video: On
Bilinear Filtering: Off
Start in Fullscreen Mode: On
Tip: Use the ESC to close retroarch when it is in fullscreen mode or use the keyboard/mouse to navigate to the Main Menu
section and select Quit RetroArch.
Reboot the system, there is an option from the shutdown popup dialog.
When it comes back up you should see a full retroarch screen as depicted below. Scroll over to your ROMs
with the gamepad and fire one up. Game on!
5: boot.ini
This part is optional for the XU4 and XU4Q line of devices they have enough power to handle 1080p and still provide
great system emulation. But if you are interested in having a little more control over the video output feel free to follow along.
For this part the first thing we'll do is make a backup of the boot.ini file.
Open the boot icon on the desktop and copy boot.ini to boot.ini.orig.
We're also going to make two more copies one you'll name boot.ini.1024x768p32bppVga and one
you'll name boot.ini.1280x720p32bppHdmi. We'll get to editting them in just a bit.
You should have something similar to what's depicted below.
From my experience these video settings work really well. The VGA resolution of 1024x768 is supported on most
if not all recent computer screens and the resolution of 720p is supported on most if not all recent TVs.
Of course you can make your own choices here as you see fit.
The idea is if we're pluggin our device into a TV we can run a custom script to either set the video output to HDMI 720p, or set the video
output back to the original auto-detection mode.
If we bring the device with us to work and we want to play some awesome games at lunch we run a custom script to
set the video output to 1024x768 VGA.
Let's boot up our ODROID device and close retroarch by hitting escape on the keyboard or navigating to the exit option
using the controller. Open up a terminal, Applications -> System Tools -> MATE Terminal, and type the following command.
nano set_1024x768_vga
Enter the following lines into the file.
#!/bin/bash
sudo cp /media/boot/boot.ini.1024x768p32bppVga /media/boot/boot.ini
sudo shutdown now
Save and exit the file. Next run the following command.
nano set_1280x720_hdmi
Enter the following lines into the file.
#!/bin/bash
sudo cp /media/boot/boot.ini.1280x720p32bppHdmi /media/boot/boot.ini
sudo shutdown now
Save and exit the file. Next run the following command.
nano set_auto_hdmi
Enter the following lines into the file.
#!/bin/bash
sudo cp /media/boot/boot.ini.orig /media/boot/boot.ini
sudo shutdown now
Save and exit the file. These scripts will be setup to change the boot.ini to the desired
video output then shutdown the device so that when you plug it into the target device, TV, computer screen, etc.
It boots up with the desired video output.
ALERT: Be sure to set execution permissions on your scripts using the sudo chmod +x terminal command followed by the script name.
You should also make sure the scripts have the correct permissions by running the following command, sudo chmod 755, followed by the script name.
You have to be in the same directory as the files you ar adjusting or have the full path to the file. If you have the boot folder
open in the file browser you can right click and select Open in terminal to open a terminal that is already at the proper file system location.
Once this step is done we'll be adjusting the copied boot.ini file you made to reflect the proper output and resolution.
There is a slight typo in this image, the lines that read sbin/shutdown -r now should read sudo shutdown -r now.
Essentially we're copying over the boot.ini file with a pre-configured version that is set to a certain screen resulution,
then we reboot the device. I'll cover the changes we need to make to each file for the XU4, but I'll also provide a
download for them to make things a bit easier. Let's take a look.
Open a terminal and type in the following commands. We'll do the 1024x768 VGA mode first.
cd /media/boot/
nano boot.ini.1024x768p32bppVga
We want to set the video output to be 1024x768 VGA. Comment the line listed below.
# setenv vout "hdmi"
Uncomment the following lines.
setenv videoconfig "drm_kms_helper.edid_firmware=edid/1024x768.bin"
setenv vout "dvi"
If you make a mistake just restore the boot.ini.orig copy you made earlier.
Any Windows or Mac computer will see the boot partition of your ODROID's SD card because it is a Fat32 partition. You can use
that to fix your boot.ini if the device isn't booting up properly.
Next we'll do the 720p HDMI mode. Open up a terminal and type the following commands.
cd /media/boot/
nano boot.ini.1280x720p32bppHdmi
We want to set the video output to be 720p HDMI. Uncomment the ine listed below.
setenv videoconfig "drm_kms_helper.edid_firmware=edid/1280x720.bin"
ALERT: Many computer screens don't support 720p if that is the case you'll likely end up booting into a blank screen.
Make sure you have a TV ready to use at this resolution. You can restore the boot.ini using a Windows box or a Mac by mounting
the micro SD card's boot partition. This will mount automatically on both Windows and Mac because it is a fat32 partition.
Restore the boot.ini file from the boot.ini.orig copy you made earlier.
An archive with the necessary boot.ini files already prepared is listed below. You can follow the steps above and set things up
by hand or you can use the link below to speed things up a bit. It's up to you!
- Monku R3 / XU4 boot.ini
Ok well that wraps up this tutorial. You should have a pretty decent retro gaming console setup at this point.
You'll need to do a little bit more work setting up some of the emulators that require more advanced configuration
but I'll cover that in a follow up tutorial. Enjoy!!
Part 1 of this tutorial which details the hardware and initial software configurations can be found here.