• Setting up OpenELEC on the Raspberry Pi

    by  • June 8, 2012 • Journal • 31 Comments

    It’s been a while but I have got OpenELEC happily working on my Raspberry Pi. I want to use this blog post to work through some of the issues I had and how I solved them.

    What is OpenELEC, well:

    “OpenELEC is a streamlined Linux distribution that includes only the essential software components and drivers needed to run XBMC and a handful of supporting apps/services”

    OpenELEC itself was originally designed for other platforms and is currently in the process of porting its software over to Raspberry Pi, therefore it is in a constant state of change. If you encounter an issue it would be advised to check the bug reports and possibly add your own where appropriate.

    To start off with this is what I had to work with:

    • Wired / Wireless network – using a USB dongle that I knew worked with Ubuntu/Debian
    • Apple Time Capsule & attached HDDs mounted as HFS+ shared via AFP
    • Setup on an Apple Mac.

    My Current Raspberry Pi setup includes the following:

    • Samsung 8GB Class 10 SDHC Extreme Speed Card
    • Apple Wired Keyboard
    • Edimax EW-7711UAN 11n 150mbs Wireless High Gain USB Adapter

    Note: I upgraded from a 4GB Sandisk Class 4 SDHC Card and noticed a definate speed boost, for only around 6 pounds, it may be a worthwhile investment – also newer builds offer a speed boost -r11312 for example.

    OpenElecI started off with a premade image sized to a 4GB SD card using build r11170 but there are now newer ones available (r11312 at time of writing). I will use this as the base as you won’t need to perform any manual partitioning.

    Setting up the SD Card

    To start off with I put the SD card in my Mac, unzipped the downloaded file and fired up terminal and performed the following commands.

    If you want to find the newest version of OpenELEC or various other Raspberry Pi distros, I suggest trying out my OS downloader

    For additional information or how to set it up on other operating systems, check out the great eLinux wiki

    Check what the SD card is called (usually disk1S1)

    df -h

    Unmount the disk so it can be written to directly

    diskutil unmount /dev/disk1s1

    Write the Image to the disk (once unmounted the disk is called rdisk1 from disk1S1, and replace the *.img filename with that which you have downloaded)

    dd bs=1m if=~/Downloads/OpenELEC-RPi.arm-devel-r11170.img of=/dev/rdisk1

    Eject the SD card.

    diskutil eject /dev/rdisk1

    The SD card should be ready to go! Plug it into the Raspberry Pi, connect it to a wired network and turn it on.

    Updating

    Once booted you should see the XBMC home screen, at this point check from your Mac, as you should see OpenELEC as a network share. – In recent builds this has been disabled, although you can re-enable it via the settings menu.

    Click on it and open the Update folder.

    In a seperate web browser, find the last pre-built binaries (available herehere or here) and download them. – Even better, you can download nightly builds via my Raspberry Pi Distro downloader app for Windows

    All you need is the System and Kernel files (and from the latest OpenElec you also need MD5 checksum files), if you downloaded the zipped file, they would be in the \target\ directory.

    If you don’t have the MD5 checksums, you can use the terminal to create the checksums. You will then need to output them to a correspondingly called MD5 file, for example:

    MD5 /Downloads/OpenELEC-RPi.arm-devel-20120607132222-r11263.kernel

    MD5 /Downloads/OpenELEC-RPi.arm-devel-20120607132222-r11263.system

    Copy these 4 files (KERNEL, SYSTEM, KERNEL.md5, SYSTEM.md5) to the Update directory and restart the Raspberry Pi, it should boot up, check the MD5s and then update the installation. Once done we are ready to go!

    If you don’t want to use the network to update, or it has been disabled in the OS. You can insert the SD card that runs your OpenELEC distro into your PC and copy the files directly.

    You will only need the KERNEL and SYSTEM files from the downloaded updates /Target Directory/ folder. You will need to add the extension .img to the KERNEL file so you have the following

    KERNEL.img

    SYSTEM

    Copy these over to the SD card, eject and put it back into the Raspberry Pi.

    If the Raspberry Pi fails to boot, you may need to copy the files again (they may be corrupted) or the boot loader has been updated, if so copy the files from the /3rd Party/ directory in the downloaded update onto the SD card and try again.

    High CPU

    You may notice while using your Raspberry Pi, that XBMC causes a rather high CPU load (usually 80% or more) when viewing it from the System Information.

    The first thing to do is disable the RSS feed from the System Settings, just like Raspbmc, this can make a large difference!

    This is because OpenElec has disabled Dirty Regions by default, so the menus are redrawn in their entirety and not just the dirty regions that have been modified.

    To re-enable it, create a file called advancedsettings.xml and put it in your userdata directory:

    <advancedsettings>
      <network>
        <cachemembuffersize>30242880</cachemembuffersize>
      </network>
      <fanartheight>560</fanartheight>
      <thumbsize>256</thumbsize>
      <gui>
        <algorithmdirtyregions>3</algorithmdirtyregions>
        <nofliptimeout>0</nofliptimeout>
      </gui>
      <bginfoloadermaxthreads>2</bginfoloadermaxthreads>
    </advancedsettings>
    

    This can also be downloaded from here or have a look at the settings in OpenElec’s GitHub Repo.

    Along with dirty regions, adjusting a few other graphical properties such as reducing fan art size can speed up scrolling between content. Please note that OpenElec disabling dirty regions was by design for the Raspberry Pi, and may cause issues.

    Overclocking your Pi

    Please note that this can reduce the lifespan of your Pi, and could permantly damage the electronics.

    The Arm chip itself that the Raspberry Pi uses can happily handle 800mhz, up from 700. Some people have got theirs up to 900mhz with the right power supply. If you over clock too far you’ll most likely see this screen (because the kernel fails to load and the LCD screen test is shown instead)

    To overclock your Pi in OpenElec, create a file called config.txt on the system partition and set the value in it according to the CPU speed you wish to use:

    arm_freq=800

    The RAM speed can also be increased from 400mhz, however the Raspberry Pi is primarily CPU bound. Information on how to edit your config.txt can be found here.

    Resize SD Card Partitions, Increase Swap space.

    While scrolling between content in XBMC, the available memory and swap space usually shoot down, sometimes drastically low and I’ve seen it lock up the Raspberry Pi. If you have downloaded a SD Card image like my instructions above, they usually come preformatted to a certain size eg. 1GB, 2GB or 4GB.

    As I have an 8GB card, this additional space gets wasted, so best put it to some use.

    (Raspbmc only) One of the best first steps is increasing the swap partition size from 191MB to 512MB which is twice the RAM size of the Raspberry Pi and the recommended size for Linux, any more may go unused. After this any spare space can go into extending the system partition, allowing you to store additional artwork or media content directly on the device.

    To do all these steps, check out this comprehensive guide using a Linux Live CD and GParted

    Buffering issues

    If you are having performance issues relating to constant buffering try the following:

    • Change your HDMI cable
    • Use wired rather than wireless (wireless is a big CPU drain)
    • Disable subtitles
    • Lower screen resolution (I changed hdmi_mode to 4 ~720p)
    • Increase swap size partition
    • Get a faster SD Card eg. Class 10
    • Play content from SD Card rather than USB source

    If this doesn’t help (and you don’t want to try over clocking just yet) you can see if changing your HDMI settings help. This again involves opening up the config.txt file.

    hdmi_drive=2
    config_hdmi_boost=4

    Some say this helps, some doesn’t, read the documentation first though before altering these settings. Please note hdmi_drive=2 is if you have sound passthrough in your HDMI cable, I use hdmi_drive=1 myself as I have a HDMI to DVI adaptor and output sound via the 3.5mm jack.

    My current config.txt file:

    hdmi_drive=1
    hdmi_mode=4
    arm_freq=800
    sdram_freq=500

    Do not attempt to over voltage your Raspberry Pi, it will set a permanent bit in the SOC and your warranty will be void.

    The kernel itself has reserved memory, adjusting this can help, you will need to SSH into your Pi to do this, or edit sysctl.conf offline. (12288 kbytes is also an option but will suffer more buffering)

    sudo bash -c "echo vm.min_free_kbytes = 16384 >> /etc/sysctl.conf"
    sudo sysctl -p

    As discussed earlier you can alter your AdvancedSettings.xml to adjust how much memory is allocated to network caching, however this hasn’t proved that successful.

    <cachemembuffersize>30242880</cachemembuffersize>
    

    CEC

    If you know what CEC is then you probably need to get out more, it stands for Consumer Electronics Control (CEC) and is a protocol built into HDMI that allows for one appliance to control another. Most will have commonly noticed this when you can control your DVD / BluRay player via their TV remote.

    Currently CEC for Raspberry Pi is a no show, work is being done frantically in porting libCEC to the broadcom chip the Pi uses. So hopefully soon you won’t even require a Media Centre remote or wireless keyboard when controlling your OpenElec distro, until then other people are doing more hacktastic ways of bring CEC to XBMC and the Pi.

    Update (see the end of the blog post): The current build of libCEC has been ported into the OpenELEC however there is a hardware fault in the grounding of the 5V rail in the HDMI out on the first revision of the Raspberry Pi’s resulting in some CEC issues if left plugged in.

    Wifi

    OpenELEC can use USB wifi dongles, best to check that they work with Ubuntu / Debian out of the box before proceeding.

    Here are a few things that need to be done before proceeding with Wifi on OpenElec:

    • You can’t have a wired connection at the same time as wireless (OpenElec is hardcoded to use LAN where available)
    • Your wireless SSID can’t be hidden
    • Your wireless SSID can’t have spaces

    Once this is done, go to Programs and then OpenElec settings.

    In this app, in the first network interface change it to WLAN, and adaptor to WLAN0

    Scroll down and enter your SSID, password & encryption type where appropriate.

    Exit the menu and restart the Raspberry Pi for the settings to take effect, you should now have a WIFI connection -you may notice some of the built in components being updated.

    Connecting to Apple File Protocol (AFP) shares

    This I found to be a bit tricky, when trying to connect to my Apple TV and connected HDDs, or even just to my Apple Mac’s

    For adding password protected AFP shares, an Apple Time Capsule and connected HDDs in my case, it worked when I used the following format:

    afp://Username:Password@255.255.255.255/Drive/Folder

    • Username – Your username on the Time Capsule
    • Password – Your Password
    • 255.255.255.255 – The IP address of the Time Capsule
    • Drive – The name of the disk
    • Folder – If you wish to share particular folders, add them here (Spaces caused issues!)

    Changing the Splash Screen

    When OpenELEC boots, it shows a splash screen image, you can change this but you will have to check out and build the code yourself. The image is stored in the \splash\ directory. I won’t go into how to checkout and build OpenELEC for the Pi, you can find more info on the OpenElec wiki.

    Corrupt Thumbnails / Fan art

    Now this caused me much annoyance coming from an Apple TV where everything had lovely thumbnails and artwork. What usually happened was as it was scanning my media it would sometimes crash (on the older builds) when this occurred, usually the artwork would be fudged.

    I have also noticed that when browsing media, artwork can be shown corrupted even if you previously viewed it correctly, this in part used to be down to how DDS previews were generated (They used hardware accelerated DX1 graphics which caused issues, these have been disabled in newer builds) – I’m still looking into how to fix this permanently.

    Here is a quick way to sort it in the interim, or to replace missing / ugly fanart & posters.

    While viewing the TV series / movie, press ‘c’ to bring up the menu, select ‘TV show information’ or ‘movie information’ and scroll across to ‘Get thumb’ or ‘Get fan art’, wait to the remote art servers download new thumbnails. Select one and horray, you get artwork for Doctor Who again!

    *Update* After looking more in depth about this issue, this is a known bug, partly to do with the transfer speeds from the SD card.

    +5V0 Leakage from HDMI

    Now that CEC has been added, I have been connecting my Raspberry Pi to my Sony TV, however when I unplugged the Pi (to turn it off) I noticed there was issues with Bravia Sync (Sony’s name for its CEC implementation).

    It has been found there has been issues with the ESD protection diode D14 on revision 1.0 PCBs of the Rasberry Pi causing a +5vo leakage from HDMI which affects CEC commands. To stop this happening you have to physically disconnect the HDMI from the Pi after use, a real bummer. Revision 2.0 which is out soon fixes this issue by connecting the top side of the diode to +5V0_HDMI.

    About

    Software engineer. Tea drinker

    http://MrPfister.com

    31 Responses to Setting up OpenELEC on the Raspberry Pi

    1. Pingback: Raspberry Pi arrived! | Mr Pfisters Random Waffle

    2. Jeff P.
      June 8, 2012 at 10:49 pm

      It’s been a while since I’ve worked in the Linux environment but I remember working remotely via X11. Is it possible to utilize X11 versus mounting an AFP share?

      • June 9, 2012 at 8:22 am

        There are other distro’s available for the Raspberry Pi including a version of Debian which would be better suited to remote access.

    3. john
      June 11, 2012 at 2:23 pm

      Raspbmc is far superior in performance. The developer who created crystalUBUNTU has done it again

      • June 11, 2012 at 2:26 pm

        I originally tried Raspbmc first and I liked it, but I had issues mounting HFS+ filesystems and my wifi adaptor didn’t work. May look again into it though.

    4. Daniel
      June 13, 2012 at 1:49 pm

      Hi Kevin,

      did you trie this?
      http://www.ctrl-alt-del.cc/2012/05/raspberry-pi-meets-edimax-ew-7811un-wireless-ada.html
      Maybe this driver works with yours too?

      I just tried to set it up with the Raspbmc but I’m not really into this… so i don’t know how to put your wlan-app into the Raspbmc? Raspbmc is a looooot faster. :o)

    5. David
      June 17, 2012 at 4:39 am

      I too originally tried RaspBMC, I found it far less responsive and buggier than OpenELEC. There are a couple of issues I’m having with OpenELEC though, and perhaps you might have some idea of the cause.
      1. After setting my display resolution to 1280×720 @ 50 Hz then calibrating the display everything seems to work fine until I reboot, whereupon dispite showing 1280×720 @ 50 Hz on the video setup screen the output is actually 1024×768 @ 60 Hz and I need to reset the resolution and calibration again to get videos to display at the correct resolution/aspect ratio again.
      2. selecting reboot from the power popup menu just locks up my Pi, it doesn’t reboot, and shutdown just goes to a black screen. Is this normal operation?

      • June 17, 2012 at 6:49 am

        1. Are you setting the screen resolution and refresh rate through the config file or the settings menu, I found going through the settings menu didn’t always save the values between reboots. I found using the config.txt value best.
        2. I noticed this in earlier builds (< 11315) but reboot now seems to be working, shutdown still goes to just a blank screen and I manually have to disconnect power.

        • David
          June 19, 2012 at 8:47 am

          1. I’ve been using the settings menu and although appearing to save my settings, in that after rebooting and going back into the settings page, the displayed settings 1280×720 @ 50 Hz are correct but the actual output resolution and refresh rate is always the default 1024×768 @ 60 Hz. So I’ll try the config.txt method to see if it sticks that way.
          2. I was using an earlier build, so I’ll try again with 11315.

          Thanks
          David

    6. Gareth
      July 17, 2012 at 5:45 am

      HDMI CEC is working with a sony bravia

      I am using this build from the openelec.tv nightlys
      OpenELEC-RPi.arm-devel-20120704203304-r11493.tar.bz2

    7. Macxcool
      July 17, 2012 at 12:39 pm

      I’ve been using Openelec on the RPi as a set-top box for a couple of weeks now. I’ve had a few crashes but could usually restart XBMC via SSH. Generally I’m impressed though. My family and I have watched a number of movies streamed from my Arch Linux NAS and had zero glitches. I just updated to an image compiled on the 10th of July and now CEC (Simplink on my LG TV) is working. COOOOOL! I can’t wait for a final, stable release.

    8. Macxcool
      July 17, 2012 at 12:56 pm

      BTW I’ve been getting new images from http://openelec.thestateofme.com/
      Also, if upgrading to a newer version of OpenElec, you need to copy the KERNEL and the SYSTEM file to the Update share but you’ll also need a KERNEL.md5 and SYSTEM.md5 file that look like this:

      9273489234md5sumu9394290 /storage/.update/KERNEL

      You can create the file by using ‘md5sum KERNEL > KERNEL.md5′ but you’ll have to edit it to have the correct path. Maybe ./KERNEL will work instead of /storage/.update/KERNEL, but I haven’t tried it.

    9. Hank
      August 5, 2012 at 9:06 pm

      Da sparky scheinbar gerade Urlaub hat, hier ne Anleitung, wie man die FAT-files selber holt:

      1. unter http://openelec.thestateofme.com/ die neuste Datei OpenELEC-RPi.arm-devel-XXXXXXX-rYYYYY.tar.bz2 runterladen
      2. entpacken
      3. aus dem Archiv die Dateien aus /target kopieren
      4. jetzt KERNEL in kernel.img umbenennen
      5. in 3rdparty/bootloader/ gehen und alles rüberkopieren
      6. Karte in den Raspi und das wars

      Eigentlich nicht schwer…

    10. August 24, 2012 at 1:09 pm

      I’ve been using raspbmc with CEC on my Samsung TV. Only issues really are lag with the XBMC menus. Very slow to navigate but once the movie is playing, no problem. Still going to give Openelec a whirl.

    11. Jeff
      August 25, 2012 at 11:30 pm

      What power adapter are you using with your setup?

      • August 26, 2012 at 8:43 pm

        So far I have tried with success:
        * HTC Charger (1Amp)
        * Apple iPhone Charger plug
        * Apple iPad charger plug

    12. Pingback: I want my raspberry pi to be a media center. Help me please ! | Marc Ferradou Blog

    13. Jeff
      September 2, 2012 at 6:07 am

      Any recommendations for connecting a 1TB HFS+ drive to Openelec?

      • September 2, 2012 at 8:51 pm

        Connecting via LAN / Wifi or USB?

        • Jeff
          September 9, 2012 at 4:16 am

          USB

    14. imarc
      September 2, 2012 at 9:52 pm

      - what to do to check which OE build is running?
      - anyone gots “Analog” menusound with OE on RPi ?

    15. Pingback: Links van 12/09/2012 tot 14/09/2012 | Nunc est Bibendum!

    16. January 12, 2013 at 9:36 am

      Great text. My Pi 512 with OpenElec 2.99.1 works great. Thank You. OpenElec is so much better than xbian and rasbmc.

      Thank You.

    17. Pingback: OpenElec Raspberry PI – tweaks « lokir's linux notes

    18. rob@gsinet.co.uk
      March 17, 2013 at 12:07 am

      Hey Kevin… Thank you very much was struggling to get WiFi up and running until I saw your comment regarding no spaces in the SSID!

    19. Pingback: Raspberry Pi, OpenElec and Edimax

    20. Pingback: Add-ons / plugins fail to install OpenELEC USB INSTALL - Page 2

    21. Pingback: XBMC on Raspberry Pi, Atom box and Mac OS X ← Tongfamily

    22. Pingback: OpenELEC auf dem Raspberry Pi | WP3

    23. Pingback: OpenELEC on Raspberry Pi | VirtuallyHyper

    24. Pingback: OpenELEC auf dem Raspberry Pi | Michaels Blog

    Leave a Reply

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