I intend to get a bit detailed with this tutorial so I’m going to have to chop it up into a few parts.
If you’re not already aware, the Raspberry Pi is an awesome little hobbyist board with some pretty good features, most notably, its ability to output full 1080p video over HDMI. In this series, I’m going to walk you through the process of creating an XBMC “set-top-box” using the Raspberry Pi and OpenElec (a bootable version of XBMC).
Let’s get started…
Actually… before we get started, let me just say this…
While there are some people out there that think the Raspberry Pi is perfect to use as their main living room XBMC set-top-box, I am less convinced. Don’t get me wrong, the Raspberry Pi is a perfectly capable machine. However, even with all the speed tweaks, you’ll find difficulty in running some of the heavier skins and a plethora of other add-ons that are available for XBMC. I would say the Raspberry Pi is great for a spare bedroom, maybe your bedroom TV, but probably not the living room. The Raspberry Pi is however, perfect for your car (what? you don’t watch TV while on the highway?) or any other place where you’ll want to watch TV, but might not be concerned with all the other amenities of XBMC.
Okay, for reals now… ON WITH THE SHOW!
I will be guiding you through installing OpenElec on your Raspberry Pi and then optimizing it for speed. For the most part, we will be utilizing this wiki entry to set up our Raspberry Pi. There is another good wiki resource for Raspberry Pi on the XBMC wiki.
Below is a list of hardware you will need to set up your Raspberry Pi properly. Amazon has some bundles that might be cheaper than buying the pieces separate. With the exception of the Pi itself and the power supply, you will be able to use anything that is comparable to what I have listed. If you happen to already have a Raspberry Pi, but are not sure if it is the model B with 512mb, click this link to see how to tell from looking at the board (scroll down on the page to where it says, “On another matter entirely”).
- Raspberry Pi (duh), specifically a 512mb model B (Click here to buy from Amazon)
- Case to put the Raspberry Pi in (Optional, Click here to buy the one I did from Amazon)
- Proper power supply for the Raspberry Pi that works well for overclocking (Click here to buy from Amazon)
- Class 10 SDHC Card to install the core OpenElec OS on (Click here to buy from Amazon)
- Thumb Drive to install the storage partition of OpenElec on (Click here to buy from Amazon)
- USB dongle for 802.11n WiFi for the Raspberry Pi (Optional, Click here to buy the one I did from Amazon)
- Windows PC with an SD card reader and a USB port
Below is the list of software you will need to set up your Raspberry Pi. You may find other software to your liking, as there are many tools out there to accomplish what we are trying to do, but I will be using the ones below.
- The latest version of OpenElec for Raspberry Pi (currently 3.2.4 as of the time of writing)
- MiniTool Partition Wizard to create the “System” and “Storage” partitions on the SD card and USB drive respectively (Windows only)
- A Unix based text editor (On Windows I use TextPad, on Mac I use TextWrangler)
- A command line tool (On Windows I use Putty, on Mac I use Terminal)
- A FTP Client of your choice (On Windows I use FileZilla, on Mac I use CyberDuck)
Now that we know what you will need to get OpenElec installed on the Raspberry Pi and setup for speed, let us go over the plan.
- The first thing we are going to do is set up the SD card and the USB drive that we will be using to run OpenElec from (we will go over why we need both later).
- After we get the SD card and USB drive setup to run OpenElec, we are going to edit the Raspberry Pi’s configuration file to overclock it safely.
- From here, we will take you through the first boot up with OpenElec and configuring the wireless adapter (If you are going to use one).
- Finally, we will move on to tweaking the settings within OpenElec and making a few changes to speed things up.
Here we go…
Setup SD Card and USB Drive
Why and SD Card and USB Drive? I’m glad you asked…
OpenElec has two partitions; a “System” partition that contains all the core operating system files for OpenElec and a “Storage” partition that contains all the related media files for OpenElec. We could, quite easily, install both of these partitions to a single SD card and carry on using OpenElec on the Raspberry Pi.
However, when you split out the partitions to have the “System” partition on the SD card (the media the Raspberry Pi will boot from) and the “Storage” partition on the USB drive, you get a decent jump in speed. Another advantage of splitting it out is the ability to overclock the Raspberry Pi to “Turbo” settings without stability issues. Many users have reported stability issues when attempting to overclock while everything is on a single SD card, the SD card gets corrupted and things get all kinds of jacked up, don’t do that.
Since we want our Raspberry Pi to operate as fast and stable as possible, we will be setting ours up in the split configuration. If you’re one of those people who has to know exactly why there is a speed jump from splitting it out, have fun Googling. If you’re content to take my word on this, carry on.
Formatting the SD Card and USB Drive
As stated earlier in the tutorial, we will be following this wiki for the most part.
You can format the SD card and the USB drive separately or at the same time if you can plug the SD card and USB drive into the Windows computer at the same time.
- Step 1: Create a 150MB, FAT32, PRIMARY, ACTIVE, partition on your SD card. (label: SYSTEM) – NOTE: You could use the entire SD size.
- Step 2: Create a partition (I used the full size), EXT4, PRIMARY, ACTIVE, partition on your USB drive. (label: STORAGE).
You will perform the steps above using the MiniTool Partition Wizard software referred to in the software section above.
***NOTE*** This step is very important! If you do not format the SD card and USB drive properly with the proper status, your Raspberry Pi will not boot properly. Please make sure that at the end of these steps you have an SD card formatted as FAT32, set to PRIMARY, with a status of ACTIVE. You should also have a USB drive formatted as EXT4, set to PRIMARY, with a status of ACTIVE. Be sure to apply the settings in MiniTool. It should take a little bit of time to format the media. If it happens in 30 seconds, you probably did not perform the steps properly. If your Raspberry Pi doesn’t boot properly after you follow this whole tutorial and just looks like it’s stuck in a reboot loop with a bunch of text on the screen, you should come back and try this step again.
Rather than throw a ton of screenshots in this tutorial, I’ll just point you to the video below which does an excellent job of showing you what the interface looks like and walks you through it step-by-step. You only need to watch to the 4:38 mark. Once it gets to the part about copying the files to the SD card, come back to this tutorial, we’re going to do something a little different on that part.
Go ahead and have a look, I will wait here…
At this point, you should have an SDHC class 10 card that you formatted as FAT32, Primary, and active. You should also have a USB 3.0 drive that you have formatted as EXT4, Primary, and active. Do not worry if your computer cannot see the USB drive, we are not going to move files to the USB drive.
Copying the Files to the SD Card
**Note** If you don’t want to perform the next three steps (“Copying the Files to the SD Card”, “Overclocking the Raspberry Pi”, and “Creating the ‘cmdline.txt’ File”), then you can download all the files you will need to put on the SD card for OpenElec v3.2.4 below. Be warned, the config file is set to “Turbo” settings and I am not responsible if something happens to your Raspberry Pi.
Next you will want to go to this website and download the latest version of OpenElec for Raspberry Pi (3.2.4 at the time of writing). Unzip the file, and copy the following files and directories to the SD card.
From the root directory of the folder you downloaded, copy these files to the SD card root directory:
From the “target” folder of the folder you downloaded, copy these files to the SD card root directory:
From the “3rdparty/bootloader” folder of the folder you downloaded, copy all the files to the SD card root directory:
One last quick change, rename the “KERNEL” file on the SD card to “kernel.img”.
At this point, you should have the following files on your SD card root directory (minus the .DS_Store file, ignore that):
Overclocking the Raspberry Pi
Before we load the SD card into the Raspberry Pi, we are going to edit the “config.txt” file on the SD card to overclock the Raspberry Pi. As stated earlier, we can set the overclock to “Turbo” settings because we are using a split configuration. You will want to open the config.txt file in your text editor (Textpad or TextWrangler) and follow the instructions in the video below.
Your “config.txt” file should look something like this when you finish editing the file. Save this file to your SD card and that is all there is to overclocking the Raspberry Pi.
***UPDATE: 03/11/2014*** I just found an add-on that you can install on XBMC that will allow you to adjust your “config.txt” settings from within the XBMC GUI. If you already know how to install an add-on in XBMC, feel free to head to this site to get the add-on. Even though there are more options available through the GUI than we cover in this tutorial, I wouldn’t edit anything unless you know what you’re doing.
Creating the “cmdline.txt” File
Next, we are going to create a file called “cmdline.txt” and add it to our SD card. This file tells the Raspberry Pi to boot the OS from the SD card, but to mount the STORAGE partition from the USB drive.
In your text editor (TextPad / TextWrangler), copy the text below and paste it into your text editor and save the file to the SD card as “cmdline.txt”.
boot=/dev/mmcblk0p1 disk=/dev/sda1 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 ssh
Be sure not to copy any extra spaces as this can cause errors with the code. If copying this into the text editor does not work or you have problems, try creating this file by manually typing the above code into the text editor. You should have a “cmdline.txt” file that looks like the image below.
**Note** we are going to edit this file later so that we can plug in other USB devices without any issues. Save the file with this code for now though.
The root directory of your SD card should now look like the following (minus the .DS_Store file, ignore that):
First OpenElec Boot-Up on the Raspberry Pi
We are now ready to put everything together and start up the Raspberry Pi. Connect everything in the following order.
- Put the Raspberry Pi into the case you purchased for it
- Insert the SD card we created into the Raspberry Pi
- Plug the USB drive we created into the top USB port of the Raspberry Pi
- Plug one end of the HDMI cable into the Raspberry Pi and the other into your TV or receiver
- Connect the Ethernet cable that will provide Internet access to your Raspberry Pi
- Finally, with the TV/Receiver turned on and the correct input selected, plug the power cable into the Raspberry Pi
You will know that you did everything properly if you see the following image on the TV.
That’s all for part one of this tutorial. Stay tuned for the next installment where I’ll discuss initial configuration of OpenElec (what to turn off to make it faster) and using SFTP to edit GUI and AdvancedSettings files.