You want to turn your Raspberry Pi into a media center, but you also need it for other tasks? Perhaps you’re using your Pi for programming, or playing Minecraft. It might have a role as a general project machine, meaning you need regular access to Raspbian.

One solution to this might be to keep several microSD cards at hand, each with different operating systems installed. You might have one with Raspbian ready to run, another with a retro gaming distro, and a third with OSMC, openELEC, or LibreELEC. These are the three Kodi-based Raspberry Pi distributions, and the most common solutions. It’s easy to write one of these to microSD card to set up your Raspberry Pi-based Kodi box.

But if you only have a single microSD card, wouldn’t it be far simpler to just install Kodi on Raspbian? Here’s how!

Make Sure You’re Using Raspbian Stretch

Before proceeding, you’ll need to make sure your Raspberry Pi is running the latest version of Raspbian, Stretch. This was released in mid-2017, so if you’ve been regularly using your Pi since then, you really should have upgraded.

You can check if you’re using Raspbian Stretch by opening a terminal window and entering:

cat /etc/*-release

The resulting text (see the screenshot) will show you which Linux operating system and version you’re using.

Configuring Your Raspberry Pi for Kodi

Before you install Kodi, you’ll need to ensure your Pi is set up correctly. Three things need to be changed:

Expanding file system (this should happen automatically when booting Stretch for the first time)

Altering memory split

Enabling video codecs

Additionally, you’ll need to ensure Broadcom desktop drivers are set.

All three of these things can be done using raspi-config. You can access this on the desktop via Preferences > Raspberry Pi Configuration, or in the command line:

sudo raspi-config

Expanding the Filesystem

If you haven’t already expanded the filesystem, and it didn’t happen automatically when you booted (which gives your Pi more space to run software), you should do so now.

This will improve overall performance of your Kodi box, as there will be more space on the microSD card for installing add-ons and caching data. (By default, Raspbian installs into a partition that is smaller than the microSD card.)

To take full advantage of your microSD card’s capacity, open raspi-config and select the first option, Expand Filesystem. Select OK to confirm your choice, and follow the instructions to restart your Raspberry Pi.

Altering Memory Split

Next, you’ll need to change the memory split. Kodi on the Raspberry Pi 2 or Raspberry Pi 3 requires 256MB dedicated to the GPU to run correctly.

Again, run raspi-config, then go to Advanced Options > Memory Split and set the split to 256MB.

Enabling Video Codecs

Finally, you need to enable certain video codecs that don’t run as standard. These include VP6, VP8, MJPEG, and Theora, among others. To do this, you need to enable the camera. While no camera needs to be connected, enabling this feature will ensure the codecs can be used.

Do this via Interfacing Options > Camera > Yes. Confirm with OK. Note that you can also effect this change via the config.txt file. Found in the /boot/ directory on your Raspberry Pi’s microSD card, this is the only directory that can be read in Windows.

To do it this way, open config.txt on your desktop computer and add:

start_x=1

Save the file, exit, and safely eject your microSD card before replacing in the Raspberry Pi and rebooting.

Setting the Right Desktop Driver

The last pre-install change you need to make is to the desktop driver. Kodi will not function if you’re not using the Broadcom drivers for your Raspberry Pi’s display. As such, you’ll need to ensure the default driver is set.

In raspi-config, select Advanced Options > GL Driver and set Original non-GL desktop driver. Select OK to confirm, and reboot again if prompted.

Installing Kodi on Raspbian Stretch

To get Kodi running on Raspbian, you’ll need to begin with the basics. First, update packages, then check for updates:

sudo apt update
sudo apt upgrade

Once these updates are complete, you’re ready to install Kodi:

sudo apt install kodi

However, there’s a bit more to it than that. Installing Kodi is only part of the challenge, as you’ll also need to configure it slightly. This is likely to work best on Raspbian, although this is by no means the only OS you can use.

Once Kodi has downloaded and installed, you’ll probably want to make some tweaks. This ensures you get the best performance out of the media center.

Tweaking the Kodi Install

Kodi should already work, but perhaps not to your liking. Further tweaks can be made, such as choosing some additional components, or configuring Kodi to auto-start when your Pi boots.

To find out what binary add-on packages are available, run:

apt-cache search kodi

Scroll through the list to see what is available. For instance, if you want to add joystick support and the DVBLink PVR, use

sudo apt install kodi-peripheral-joystick kodi-pvr-dvblink

You should now be able to control your Raspberry Pi Kodi box with a joystick, and record live TV streams to an attached storage device.

Meanwhile, to instruct Kodi to launch when you switch on your Raspberry Pi, you’ll need to edit the autostart file via SSH (how to do that) or the command line on your Pi:

sudo nano ~/.config/lxsession/LXDE-pi/autostart

Here, add a line to the end:

@kodi

Then, save the file and exit with Ctrl + X. When you next reboot your Raspberry Pi, it should boot straight into Kodi. Exiting Kodi, meanwhile, will let you back into the Raspbian desktop!

Your email address will not be published. Required fields are marked *

Comment

Name *

Email *

Mukund Wavhal

March 10, 2019 at 8:38 am

How to return to the raspberrian desktop from Kodi?
As after following all instructions and installing Kodi my TV screen displays blank. Pi is able to boot to desktop, but after Kodi getting auto started display goes blank and I'm unable to do anything.

sudo nano ~/.config/lxsession/LXDE-pi/autostart gives an error; lxsession/LXDE-pi/autostart doesn't exist. When I made the dir/file manually kodi indeed starts automatically. But when I shut down kodi the desktop won't load, the screen stays black. For all the rest thumbs up, I like to stay in control.

the idiot is obviously the one that entered the comment (aka YOU). You should be able to follow instructions before jerking off online. There is no colon between sudo and raspi, you entered it incorrectly. Command works.