Monku R3: Building The Ultimate ODROID-XU4 / XU4Q Gaming Console - Part 2

Hello and welcome to the last tutorial in this series. I hope that you’ve found this series helpful. Part 1 of this tutorial which details the hardware and initial software configurations can be found at http://middlemind.com/tutorials/odroid_go/mr3_build.html. This article will show you in detail how to polish off your Monku Retro 3 (ODROID-XU4) video game console. We will be optimizing Ubuntu MATE, the Linux desktop environment, setting up retroarch in kiosk mode, and boot.ini configuration scripts. Ok let’s dive in!

This tutorial does not require any new parts or tools. We will just be configuring the console you have already built (Part 1 article), adjusting things to really make it shine.

Finalizing MATE... Almost

The first thing we are 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.

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.

If at any time you are prompted for a login when working with the terminal use the password, k

Figure - 01
Figure - 01

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 will 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 is ok to7 allow the keychain to be unlocked, click Continue.
  5. Close out of all the dialogs and close the Password and Keys window, we are all set.

Next thing we will do with the Ubuntu MATE environment is configure the panels and widgets a bit. You can do whatever you like here, I will just show you how I configure things. First off we are expecting to interface with this system and, at least some of the time, with a gamepad. It works great but it is not a mouse, also we are not really going to be doing any rigorous Linux computing so there are a few things we do not need. The second benefit to this configuration step is that is does slightly lower the memory overhead.

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 will not be adding in the desktop selection widget. It is just a bit of overkill for our needs. Again if you want it, it will not 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, then 6select 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 are 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 easier. Your desktop should look like the screenshot below.

Figure - 02
Figure - 02

Since we got rid of our open window selection buttons when we deleted the bottom panel, let us 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.

Figure - 03
Figure - 03

We have a few more steps to get through here regarding the tray apps and the date and time configuration but we are almost done. Your desktop should now look something like this.

Figure - 04
Figure - 04

Next let us 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.

Figure - 05
Figure - 05

Let us 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.

Figure - 06
Figure - 06

Start typing the nearest major city into the Location Name text box. If it does not 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 have found something suitable.

Figure - 07
Figure - 07

Now you will see a location entry in the locations list as depicted below.

Figure - 08
Figure - 08

Just a few more things left to do here. right click the battery icon in the top right and select the Preferences option. Click on the General tab and toggle Never display an icon. If you have an EN or UK string in the system tray right click on it and select Preferences. On the General tab uncheck Show icon. We will not really be worrying about switching the keyboard language. If you need this you can turn both in the system tray icon back on by using the System -> Control Center menu option and clicking on Power Management and iBus Preferences respectively. The screenshots below show the forms we just discussed.

Figure - 09
Figure - 09

Figure - 10
Figure - 10

Just two little things left in this part and we will 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.

Figure - 11
Figure - 11

Figure - 12
Figure - 12

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 us drag these two new widgets a little closer to the System menu. Also separate them a little bit. Nice! Now we are 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 will also be setting up some boot.ini control scripts. Your desktop should look like the one depicted below.

Figure - 13
Figure - 13

Scripts and Custom Control

In this part we are going to set up 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.

Figure - 14
Figure - 14

Figure - 15
Figure - 15

Let us 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 is depicted below.

Figure - 16
Figure - 16

Figure - 17
Figure - 17

Click the Add button and fill out the form as depicted below, I will 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 us do the same thing for that script, also shown below. Again I will list the values used here.
Name: Start AntiMicro
Path: /home/odroid/start_am
Description: Launches AntiMicro on startup.
Figure - 18
Figure - 18

Figure - 19
Figure - 19

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.

Figure - 20
Figure - 20

Figure - 21
Figure - 21

Things are shaping up nicely now. Our beautiful ODROID is looking more and more like a great retro gaming console.

Finalizing MATE ... Really This Time

We have a little bit more work to do with MATE. 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.

Figure - 23
Figure - 22

Figure - 24
Figure - 23

Next up we are 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 will 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 screenshots below depict this step. Use them to help with finding the right icon if need be.

Figure - 25
Figure - 24

 Figure - 26
Figure - 25

Figure - 27
Figure - 26

Now let us 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.

Figure - 28
Figure - 27

Figure - 29
Figure - 28

We have basically customized our ODROID hardware and software to create a retro gaming console with retroarch kiosk mode and also full Linux environment if needed. This is so cool! Next thing we will do is make retroarch run in fullscreen mode and adjust a few video settings. I will not go into advanced configuration here. This tutorial is about as long as I like to make them so I will push advanced 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.

Figure - 30
Figure - 29

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 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.

 Figure - 31
Figure - 30

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!

Figure - 32
Figure - 31

Figure - 33
Figure - 32

boot.ini

This part is optional for the ODROID-XU4 and ODROID-XU4Q line of devices since they have enough power to handle 1080p and still provide great system emulation. However, 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 will 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 are also going to make two more copies one you will name boot.ini.1024x768p32bppVga and one you will name boot.ini.1280x720p32bppHdmi. We will get to editing them in just a bit. You should have something similar to what is depicted below.

Figure - 34
Figure - 33

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 are plugging 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, a TV or computer monitor, it boots up with the desired video output.

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 are 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 will be adjusting the copied boot.ini file you made to reflect the proper output and resolution.

Figure - 35
Figure - 34

There is a slight typo in this image, the lines that read sbin/shutdown -r now should read sudo shutdown -r.

Essentially we are copying over the boot.ini file with a pre-configured version that is set to a certain screen resolution, then we reboot the device. I will cover the changes we need to make to each file for the ODROID-XU4, but I will also provide a download for them to make things a bit easier. let us take a look.

Open a terminal and type in the following commands. We will 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 should be able to see the boot partition of your ODROID SD card because it is a FAT32 partition. You can use that to fix your boot.ini if the device is not booting up properly.

Next we will 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 line listed below.
setenv videoconfig "drm_kms_helper.edid_firmware=edid/1280x720.bin"
Many computer screens do not support 720p. If that is the case, you will 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 or Mac PC 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 that have been already prepared is listed below. You can follow the steps above and set things up by hand or you can use the link at Monku R3 / XU4 boot.ini to speed things up a bit.

Ok well that wraps up this tutorial. You should have a pretty decent retro gaming console setup at this point. You will need to do a little bit more work setting up some of the emulators that require more advanced configuration but I will cover that in a follow up tutorial.

Be the first to comment

Leave a Reply