Building Kodi With Yocto For The Raspberry Pi

This article is a guide on how I got Kodihttps://kodi.tv/ logo working along with some basic notes on what ended up being a super simple Kodi Yocto distribution for the Raspberry Pi 3B+.

TL;DR Repo here

Recently I decided to take my Raspberry Pi 3B+ for a spin and try and build Kodi with Yocto for it. I wanted to support the following simple features:

  • Boot into Kodi.
  • Running Kodi as a normal user i.e. not root.
  • Auto-mount usb drives.

Dependencies

You can download the whole project here or manually:

  1. Kodi and other recipe customisations: meta-hubshuffle@master.
  2. The poky distro: poky@warrior.
  3. The raspberrypi bsp: meta-raspberrypi@warrior.
  4. OpenEmbeddedhttps://www.openembedded.org logo components: meta-openembedded@warrior.
  5. Kodi integration: meta-kodi@84cd030ec8bee8203f5266d02284ef8f236a11e1.
  6. Add your NetworkManager connection profiles undermeta-hubshuffle/recipes-networking/networkmanager/files/your-profile.nmconnectionand add those files to the SRC_URI variable in networkmanager_%.bbappend.
  7. The root password is defined inmeta-hubshuffle/recipes-core/images/hubshuffle-image-kodi.bb
  8. The hubshuffle user password is configured inmeta-hubshuffle/recipes-core/hubshuffle-user/hubshuffle-user.bb
Note: You need to add "warrior" to the compatible layers inmeta-kodi/conf/layer.conf.

Build Instructions

Setup your build environment:

Setup conf/local.conf, for example:

Setup conf/bblayers.conf, for example:

Build the image:

Finally, write the image to an sd-card. Alternatively check here how to network boot:

Details

I was mainly curious about the startup time and performance so I was expecting the actual Kodi integration to be straight forward given the Pi's popularity. The first customisation necessary to obtain 3d acceleration and hardware decoding is to set the WINDOWSYSTEM variable to "raspberrypi" as kodi has a configuration option dedicated to the RPi. I also had to back-port a patch to fix the ninja build configuration and to disable THUMB instructions by setting ARM_INSTRUCTION_SET to "arm". Additionally I got QA errors and had to disable that step for the kodi package. The final recipe ended up looking as:

The remaining recipes in the meta-hubshuffle layer and included in thehubshuffle-image-kodi recipe are distro configurations and tweaks including user configuration and permissions, udev rules, psplash (which needs a bit of work) and so on.

ToDo

  • Permissions need to be configured to allow reboot/shutdown as these options are missing from the Kodi exit menu.
  • Partitioning hasn't been configured.
  • I haven't actually tested kodi besides video playback so there might be features missing.

Here is a graph of the final rootfs:

And here is a graph of the boot sequence:

Graph of boot sequence