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.
I 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)
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)
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.
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 here, here 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:
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
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.
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>
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:
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
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.
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.
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.
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:
- 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.