Odroid xu4 ��������� linux

Odroid xu4 ��������� linux

How to install Kodi and transform your ODroid XU4 into a TV box and media center

VERSION 2.0 — 2 January 2021

This guide will explain how to make a TV box with your ODroid XU4. The first section is the only one you need to read in order to have a fully functional TV box using Kodi. The next sections give extra configuration to set up an external USB drive, a MAME video game console and other topics.

One important feature is this new guide is that we don’t use X11 or Wayland but Kodi runs directly on the Linux framebuffer using OpenGL acceleration thanks to the Mali 3d driver. Therefore the final product will be a very fast and light system. It is even possible to use it as a small home server for other purposes, even while playing videos. So all the family will be happy at the same time.

Table of contents

Install Linux and Kodi on your Odroid XU4

All along this guide, I will assume you have access to a Linux box and all the command lines below are for Linux, either your other Linux machine or the Odroid XU-4 we’re going to install now. To install all of this, follow the steps:

The first step is ideally done on another Linux box. If you don’t have one yet (wait,what?), better to migrate to Linux as soon as you can

Download the Ubuntu image and its MD5 sum file:

Check your image is valid with md5sum and compare the result with the content of the previously downloaded md5sum above

and compare the result with the content of the file ubuntu-20.04.1-5.4-minimal-odroid-xu4-20200812.img.xz.md5sum

Uncompress the file first you’ve downloaded:

Put an SD card with enough capacity in your Linux machine

Search for the device with lsblk

WARNING

Let’s assume your SD card is on /dev/sdX . Be very careful to choose the correct device or you will risk to erase the content of another disk.

WARNING

Write the image to the SD card

Umount your SD card either from your desktop environment or on the command line with. This step is not required but can be necessary:

Insert your SD card in your odroid XU4 and boot your machine

Check the release notes pages to find the credentials: https://wiki.odroid.com/odroid-xu4/os_images/linux/ubuntu_5.4/minimal/20200812 Usually, the login is root and the password is odroid . Obviously, you want to change them immediately after logging in.

At this stage you have a fully functional ODroid XU4 machine. The next steps can either be done from your XU4 by connecting a keyboard to it or you can SSH from another machine to the XU4. I recommend using the Ethernet port at first. It is much simpler to configure than a wifi. But both wifi and Ethernet will work.

Optional: if you want to SSH to your XU4, you must first find the IP address of your XU4:

The IP address is after the inet keyboard. The result of the command above gives a list of at least two entries. Usually the first one is called lo and is the loopback network interface. It’s a fake network interface which creates a network with one machine only. It is used if you want to test a networked program for which the client and the server applications are on the same machine. Usually, the second entry is eth0 and denotes the Ethernet port of your XU4. It’s the one you want and the IP address you need is after the inet keyword. Use this address from your other machine to connect to your XU4

Connect as root as explained above, either directly or through a SSH connection to your XU4. Alternatively you can connect with the default odroid user and open a terminal. Then in the terminal do sudo bash to login as root .

To connect from another machine with ssh :

where xxx and zzz are replaced by the numbers you found doing ip addr .

Update the packages

During the update, you might encounter the following situations (or not):

the first time you boot your machine, you may get an error regarding a lock file with dpkg ( /var/lib/dpkg/lock ), it means that one of the automated update procedure is still running which is very likely with a new install. Just let it run until the end and try the commands again.

Читайте также:  Install windows operating system on linux

if you get a message about boot.ini being replaced, just say ‘OK’

if you get a question about /etc/apt-fast.conf , answer Y (for Yes)

The last command ( autoremove ) is to leave the system in a clean state and use a bit less disk by removing unecessary packages.

The Mali graphical driver is installed by default and works well. However, the driver provided by ARM only implement OpenGL ES and not OpenGL. We will use gl4es as a wrapper between OpenGL and OpenGL ES and therefore have a hardware-accelerated OpenGL on the Mali GPU in XU4:

Then we compile gl4es :

It will compile and display its progress with a lot of messages. Toward the end, if the compilation has been successfull, you should see the following:

Now we backup the previous GL library and install the new one:

Install Kodi now and disable the main GUI environment:

For security reason, kodi and its associated programs will be run by a user with limited privileges, with no password and automatic login. We will call the user kodi :

The output will be:

Assign some privileges to this user:

Add the Kodi service to systemd (better to copy and paste the following rather than typing it):

Enable Kodi at boot time:

Remove the blinking cursor on the Kodi screen. There is an annoying blinking cursor at the top-left corner. This will remove it:

Disable the unattended upgrades service to avoid packages being installed in the background. It caused a few problems in the past and we want a stable Kodi system for all the family:

Add support for audio and the PulseAudio service

The Kodi service requires the PulseAudio service (cf. the Wants line above). PulseAudio comes by default in Ubuntu, so we just need to link to it. When Kodi starts, it will start the PulseAudio service just before and give Kodi a sound service on-demand.

Clean up and remove unused services to free up memory and CPU cycles:

ModemManager is a daemon which controls mobile broadband (2G/3G/4G) devices and connections. The Odroid XU4 is connected to an ethernet (or a wifi if you have one) and does not need a modem connection.

Set the clock to your own time zone

You can synchronize the clock to a time server on the net and always have your Odroid set to the most accurate time. Moreover, you want to set the clock to your timezone.

  1. First we install an NTP (Network Time Protocol) client which will connect to time server to get an accurate time
  1. Then we search for the time zone. It will be something like Europe/Zurich or Pacific/Auckland . To find yours do:

Search and note your own time zone. Let’s say you live near the North Pole in Longyearbyen, you will find the time zone in the list given above as Arctic/Longyearbyen . Then tune your Odroid XU4 by doing:

You now have a fully functional Kodi system. If you want to reboot, your Odroid XU4 will directly start on Kodi. I you want to add more features, like MAME (Mame on Wikipedia), an external USB drive, a joystick, a firewall, just keep reading.

In the next sections, I’ll show you how to:

  • install an external USB drive and have it automounted (for Kodi or Mame for example),
  • install and configure Mame and use it from Kodi
  • install and configure a joystick for Mame
  • remove software and services which are not necessary and use memory and CPU cycle for nothing

Everything can be done either by connecting to your ODroid XU4 with ssh or on the screen directly (you’ll need a keyboard). For the second option, after booting on the Kodi screen, you need to exit Kodi first to get back onto the terminal. After doing what needs to be done (below), just reboot your machine to check everything is fine.

Install an USB external drive on your Odroid XU4

Switch to a terminal or login with ssh .

Install usbmount to automount USB drives:

Читайте также:  Onedrive windows 10 найти

There is a bug in the version 0.0.22 of usbmount as provided by the stock Ubuntu Linux when connecting 2 USB drives at the same time. The bug has been fixed with usbmount 0.0.24 which is not yet on the Ubuntu repository. You can upgrade it manually, if you like:

If your second drive (or even the first) doesn’t mount properly when you plug it in, you can try to upgrade usbmount as follows:

By default, usbmount will mount the external USB drive with the sync option. sync means that all write access to the disk will be immediately flushed to the disk. And it can dramatically slow down all the disk operations.

I assume it is safe to use the async option here because you’re not supposed to unplug this disk at any time. When I’ve done that, the write speed of my external hard drive has been multiplied by 10!

Install MAME to play arcade games from Kodi

This section is long and will require external resources if you want to have all the bells and whistles of a full-featured MAME installation. From time to time, we will refer to external guides too.

Create a new config file with the correct paths, using OpenGL ES 2, the ALSA audio driver, tuning the speed and using all the cores:

Then we need to remove the gl4es startup message to make MAME happy. Long story short: a Kodi plugin will extract the games’ database MAME.xml to the standard output by running mame . When mame starts, gl4es is initialized and displays a nice message, like the one above. But the Kodi plugins capture the standard output which is supposed to be an XML file, except that we have this welcome message on top of it from gl4es . So when Kodi tries to read the XML file (in fact a Python library tries too), it fails:

When configuring the AML add-on in Kodi, we will use this new mame command we’ve just created

Install and configure Advanced Mame Launcher plugin from Kodi

We’re going to follow the official guide of a Kodi plugin called Advanced Mame Launcher (AML) and adapt a few steps to follow our setup. Here, I assume that we have an external USB drive connected to the Odroid XU4. It will be helpful to store data for MAME.

  1. Assuming you’re on a text terminal (see above on how to switch to a text terminal from Kodi), the first step is to create directories to store MAME data. The external USB drive is mounted to /media/usb0 and by default to /media/usb too. We will assume it’s the case from now on.
  1. Then we need to fill in the directories with the latest data for Mame as described in https://forum.kodi.tv/showthread.php?tid=304186. We use the following script to download and install everything automatically:

Modify mame.ini to reflect the new directory structure:

Go back to Kodi: type ‘Ctrl+D’ on your terminal, then ‘Atl+F7’ to go back to Kodi.

In https://forum.kodi.tv/showthread.php?tid=304186, you can follow the paragraph called Setting up MAME assets and Software List assets to add more resources and assets. This is the way to get extra pictures, logos, etc. You can read the page here: http://forum.pleasuredome.org.uk/index.php?showtopic=30715 about the MAME Extra packages to understand all the type of resources you can find on the Net for Mame.

On the above mentioned page, you can find links to Mame resources on the Internet. They come in huge packages you simply have to move to /media/usb/mame as we created before. Let me give you some examples about those packages, which can be useful in the process:

  • if you find a package called MAME 0.xxx EXTRAs where xxx is a Mame version number, go into the directory you have downloaded. In this directory, you will find more directories. Move their content to the corresponding directory in /media/usb/mame/AML-assets/
  • Another similar package might be called something like MAME 0.xxx Multimedia . You should process it the same way
  • but you will find .zip files too. You can simply unzip them and move them to the final directory as above. Some directories don’t have the same name, so keep the names we created above. In this case, transfer the content of the directory instead of the directory itself.
  • if you find packages with bios-devices in their name you don’t need them if you already downloaded the very big packages with ROMs in their name. They are just subset for different situation. You can read more about all those packages on this page. These packages are made when you want a minimal version of the ROMs for example if you’re running short on disk.
  • There are packages called Rollbacks Roms too (information here). You only need them if you have a ROM manager for Mame which can deal with multiple version. You won’t need them in this tutorial.
  • There are the Software List ROMs and CHDs. Obviously, their content will go into the /media/usb/mame/AML-SL-ROMS and /media/usb/mame/AML-SL-CHDs directories we’ve created before. SL stands for Software List of course.
Читайте также:  Как разгрузить физическую память windows 10

Finally, you might have messed up a bit with users’ permission when downloading and moving files. So you want to make things well by assignign the kodi user to the mame directory:

Install and configure the AML plugin. You will find it in Program Adds-on. It’s called Advanced Mame Launcher.

in Kodi, go to Settings, Addon settings, Install from repository. In Program add-ons, look for Advanced Mame Launcher and install it. Follow the picture in the order:

After it’s installed, right-click on the add-ons logo and go to Settings:

Change the paths to the executable and the data directories as shown on the picture:

Go back to Kodi’s initial screen and look for the AML plugin, in general Add-ons, Program Add-ons, Advanced Mame Launcher.

Select any row, open the context menu with a right-click and select Setup plugin.

And run a full setup and configuration of the plugin by choosing the All in one step options in the context menu of the plugin: This step can take several minutes to an hour. You will see a lots of progress bars. If you did everything well before, it should work without error messages. The plugin is now configured and ready.

And Mame is ready!

Install a joystick to play with MAME

Ideally, playing with MAME requires a nice joystick. Here are two examples of joystick I’ve built myself. It’s a good exercise of woodwork, painting, designing and electronics and a fun game for the family. I’ve made them with planks I collected from a construction site nearby. Good for the environment to recycle things too.

Install the software to support and calibrate the joystick. Arcade joysticks are easy to build or can be bought on Internet. They work very well and ideal for playing with MAME’s arcade games.

Calibrate the joystick As most of Mame games will require a simple joystick with buttons, calibration will be very simple. You can use jstest-gtk but as we already install Kodi, we will do the calibration from the command line only. With click joystick, the only calibration is to associate buttons (inside the joystick for the directions and fire/select buttons), with their respective direction or function. The calibration will be available system-wide and therefore will be used by mame

  • if you can plug your joystick to your Linux machine, I recommend to use, in first instance, a small programm called jstest-gtk . It’s a simple GUI and you can check what’s the proper direction of your joystick. In my case, I use a DragonRise compatible joystick (the one on the picture), with 4 connectors for up, down, left and right. But there are a few problems which we will fix with the calibration. First of all, the left-right and up-down are inversed and then the up-down axis is upside down. So to make it short: up is right, down is left, right is down and left if up. I can see that on the jstest-gtk interface.
  • another option (since Kodi 17) is to setup your joystick directly from Kodi. Read the tutorial here.

As there are many models of joystick, I won’t cover all the possible configurations but please contribute and I’ll add your solution to this guide.

Источник

Оцените статью