Subscribe For Free Updates!

We'll not spam mate! We promise.

Tuesday, 23 July 2013

Transitional period

As you can probably see I'm in a transitional period at the moment as I move my blog between hosts. Hopefully my blog text is all present, I just need to re-upload all the images and make the site look a whole lot better in general.

Monday, 14 January 2013

Another Raspberry Pi cross compiling guide

GitHub has a very interesting article for cross compiling for the Raspberry Pi using a another PC as the compiler over a network.

Monday, 15 October 2012

Model B now ships with 512MB RAM

"One of the most common suggestions we’ve heard since launch is that we should produce a more expensive “Model C” version of Raspberry Pi with extra RAM. This would be useful for people who want to use the Pi as a general-purpose computer, with multiple large applications running concurrently, and would enable some interesting embedded use cases (particularly using Java) which are slightly too heavyweight to fit comfortably in 256MB.

The downside of this suggestion for us is that we’re very attached to $35 as our highest price point. With this in mind, we’re pleased to announce that from today all Model B Raspberry Pis will ship with 512MB of RAM as standard. If you have an outstanding order with either distributor, you will receive the upgraded device in place of the 256MB version you ordered. Units should start arriving in customers’ hands today, and we will be making a firmware upgrade available in the next couple of days to enable access to the additional memory.

I’d like to thank our partners, RS Components and element14/Premier Farnell, and the suppliers, particularly Samsung, Sony and Broadcom, for all their help in delivering a smooth transition to the 512MB. I’m looking forward to seeing what you all get up to with your shiny new Pis."

Wednesday, 19 September 2012

New Raspberry Pi image released

Wow! This is wonderful news! The Edimax Wifi adapter should now be supported natively in the latest official image. Hats off to MrEngman for his amazing work.

Tuesday, 18 September 2012

Guide: Compiling kernels and drivers for the Raspberry Pi - bootc I2C Kernel & Edimax EW-7811Un USB Wifi


In the past I have found compiling kernels for the Raspberry Pi to be a very frustrating experience, so I thought it would be a good idea to write this guide for my own future reference. If it helps anyone else have a better experience than me, then all the better!



If you have read any of my previous articles you may have seen that I have been playing with I2C IO Expansion chips via the GPIO port on the Raspberry Pi. As I have come to understand but not yet tested (if it ain't broke, don't fix), the latest 'Wheezy' kernel distribution now supports I2C drivers, however when I started this project with the 'Squeeze' 19-4-12 image the only way to use I2C was to use Chris Boot's own compiled images instead. Chris has been working on his own I2C drivers and building them into his own pre-built kernels for quite sometime now, simply loading his built image onto a SD card worked perfectly and I could program with I2C to my heart's content. Now, there was one small snag to this, my Edimax EW-7811Un USB Wifi Adapter.

The 7811Un drivers need to be compiled for the kernel it is to be used with. For the Raspbian images this was quite simple as the headers were available via a simple apt-get or I could get them pre-built using MrEngman's wonderful script but this isn't possible to do with the Bootc images as Chris explains. Therefore the only thing left to do is compile my own version of his kernel.

There are two ways of compiling a kernel:

  1.  Compile on the target hardware.

  2.  Cross compile for the target hardware.

The Raspberry Pi doesn't have a lot of memory or processing power available for an intensive task such as compiling a kernel, MrEngman has stated that it takes him about 7 hours to compile any latest official kernel releases and the wifi driver. I personally don't fancy waiting that long and he only does it so that he can simply hand out the driver to others, knowing it will work with the official release. As I'm making mine for my own personal use, the comparatively quick cross compile option is more sensible. A cross compiler is a compiler that runs on one type of computer architecture but creates a binary for another, in my case x64 to ARM.


Gathering resources

I'll be using Ubuntu Server 12.04 LTS hosted on a VirtualBox virtual machine to do my compiling, using VirtualBox's shared folders to transfer data between the host and guest operating systems.

See Part 1, Part 2 and Part 3 of the guide for more information.

You'll now need the following files. Transfer them to your Ubuntu server or put them in the Vbox shared folder.

Realtek driver Unix (Linux) RTL8188CUS (Current: 3.4.4_4749)

Laest pre-compiled binary (.deb) from (Current: 3.2.23)


Install cross compiler and Git source code management system

Run the following:

sudo apt-get install -y git-core gcc-4.6-arm-linux-gnueabi libncurses5-dev unzip

sudo ln -s /usr/bin/arm-linux-gnueabi-gcc-4.6 /usr/bin/arm-linux-gnueabi-gcc


Download the latest firmware and kernel source code

Take a note of the version of bootc you downloaded, I'll be using 3.2.23 as that is the latest at the time of writing this guide. Just substitute it with what ever version you are using.


mkdir rpi-3.2.23

cd rpi-3.2.23

git clone

git clone -b rpi-3.2.23

Downloading the source code may time some time depending on your connection. It may look like it has hung on "Cloning into 'xxxxxxx'..." but it's most likely still working, just be patient.


Compiler settings

When building a kernel there are many options to choose depending on what you want the kernel to do for you. Luckily Chris Boot has already compiled his kernel and provided it as a .deb package. Inside this package we can find the configuration that he used and then we can tweak it to suit our needs as well.


First we need to extract the contents of the .deb file downloaded earlier. Mine is kept in my shared folder ~/shared.

dpkg-deb -x ~/shared/linux-image-3.2.23-rpi1+_1_armel.deb /tmp/extract


Now copy the config file to the downloaded kernel source code.

cd ~/rpi-3.2.23/linux

cp /tmp/extract/boot/config-3.2.23-rpi1+ .config


The name that will be given to the kernel needs to be altered so that it does not clash with any other kernel. This command will perform a find and replace on the file called 'Makefile'.

sed -i 's/EXTRAVERSION =/EXTRAVERSION =-spi-i2c-rpi1/' Makefile


Next, we apply the config settings we got from Chris to the build we are about to do.

make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- oldconfig


Now we need to make our own modifications to the compiler config.

make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- menuconfig


You'll now be presented with a console menu system to help you configure your build. Use the arrow keys to navigate Up & Down through the menu, press Enter to go into a sub-menu and Space to make a selection.

Device Drivers. Press Enter to open.

Network device support. Press Enter to open.

Wireless LAN. Press Enter to open.

Realtek RTL8192CU/RTL8188CU USB Wireless Network Adapter. Press Space to unselect.

Press Tab then press Enter multiple times to go back up the sub-menus.

When asked 'Do you wish to save your new configuration?', select 'Yes' and press Enter.


Building the kernel

It's now time to compile the kernel! Note - the end of this command determines the number of processors on your system so that we can enable multithreaded compiling to improve compilation speed.

make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- -k -j$(grep -c ^processor /proc/cpuinfo)


Now that the kernel has compiled successfully we can gather the kernel and module items to put onto our SD card. We'll place these in a folder called install in the rp1-3.2.23 directory.

mkdir -p ~/rpi-3.2.23/install/boot

make ARCH=arm INSTALL_MOD_PATH=~/rpi-3.2.23/install CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- modules_install

make INSTALL_PATH=~/rpi-3.2.23/install/boot ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- INSTALLKERNEL=none install


Building the Edimax EW-7811Un Realtek 8192cu driver

We need to unpack the driver from the .zip file you obtained at the start. My zip file is stored in my shared folder.

cd ~/shared


cd RTL8188C_8192C_USB_linux_v3.4.4_4749.20120806/driver

tar -xvzf rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730.tar.gz


Now it's unpacked we can compile it.

cd rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730

make KSRC=~/rpi-3.2.23/linux ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- -k -j$(grep -c ^processor /proc/cpuinfo)


We can now add the driver to the rest of the items destined for the SD card.

cp 8192cu.ko ~/rpi-3.2.23/install/lib/modules/3.2.23-spi-i2c-rpi1+/kernel/drivers/net/wireless 


Installing the new kernel

Copy all files in ~/rpi-3.2.23/firmware/boot to the boot partition of the SD card.

Copy all files in ~/rpi-3.2.23/install/boot to the boot partition of the SD card.

Recursive copy all files and folders in ~/rpi-3.2.23/install/lib/modules/ to the system partition of the SD card and it's /lib/modules/ directory.

Overwrite the SD card's boot partition kernel.img with the one you built by copying the file 'vmlinux-3.2.23-spi-i2c-rpi1+' in the boot partition to 'kernel.img'.

Put the SD card in the Raspberry Pi and boot it up.

Log in as normal

depmod -a

sudo reboot


You should now be able to configure your network settings and plug in your Edimax USB Wifi adapter.


Notes for the future

  1. According to Chris Boot, the crosstool-ng cross compiler is easier to use and I believe I've read that it is provides more up-to-date support for ARM processors. I'll look into using this instead of the one used in this guide.

  2. Try to merge the Wifi driver into the kernel rather than have it as a separate module.

  3. Use make-kpkg instead of running the compilers separately which also gives the benefit of creating a .deb file for easier installation of the new kernel.



Wednesday, 12 September 2012

Guide: VirtualBox and Ubuntu Server 12.04 Part 3 - Install GuestAdditions and setup shared folders


VirtualBox provides an excellent feature called Shared Folders. This feature allows you to share multiple folders between your host and virtual operating systems therefore making it much easier to transfer data between the two.

In Part 1 and Part 2 of this guide I showed you how to create your own virtual machine in VirtualBox and how to install Ubuntu Server 12.04.

In Part 3 I'll take you through the steps required to install the VirtualBox Guest Additions and how to create a shared folder between your main OS and Ubuntu Server.

Installing Guest Additions

If you've not done so already let's start your VM and log in. See Part 2 for more info if you are stuck.

Before we install the Guest Additions software, we need to install some prerequisite software that Guest Additions needs during installation.

  • At the command prompt type the following text followed by the Enter key and enter your password when prompted:

sudo apt-get install -y dkms build-essential linux-headers-generic linux-headers-$(uname -r)

Next we need to load the Guest Additions software as a virtual CDROM and mount it in the OS.

  • From the Devices menu of the VirtualBox window, select 'Install Guest Additions...'

  • You'll notice that the CD icon at the bottom of this window will now become active and has a tooltip showing that VBoxGuestAdditions.iso is loaded.

  • At the command prompt type the following and enter your password if prompted:

sudo mount /dev/cdrom /media/cdrom

  •  This has now mounted the contents of the CD into the folder /media/cdrom which you can view if you wish with the following command:

ls /media/cdrom

We can now install the Guest Additions software.

  •  At the command prompt type the following and enter your password if prompted:

sudo /media/cdrom/

  •  If you see a message saying "Installing the Window System drivers!(Could not find the X.Org or XFree86 Window System.)", don't worry about it. You're installing onto Ubuntu Server so you don't have any Windows systems, it's all console based.

Lastly we now need to add your current user to the user group 'vboxsf' so that you can view and edit shared folders.

  •  At the command prompt type the following where <your user name> is the user you are currently logged in as. Enter your password if prompted.

sudo usermod -a -G vboxsf <your user name>

Creating a shared folder

Firstly create or choose a folder on your host OS (Windows / OS X) that you wish to share with Ubuntu.

Next, from the Devices menu of the VirtualBox window, select 'Shared Folders...'
Press the small blue folder button with the green + on it to add a folder to share.
You will then be presented with the Add Share dialog.

From the Folder Path drop down menu, choose 'Other...', then browse for and select the folder you wish to share on your host OS.
Give the shared folder a name in the Folder Name text box, personally I stick with the default.

Tick Auto-mount and Make Permanent.

Press OK.
Press OK.

Now reboot your VM by typing the following:
sudo reboot

Once rebooted, log back into your server and your shared folder should now be found in /media. To view it, type the following:

ls /media

Note that the folder is called the name you gave your share earlier and starts with a 'sf_'.

If you want to have easier access to the shared folder you can create a symbolic link to it in your home folder, a little like a shortcut to the real folder while.

ln -s /media/sf_Ubuntu_Share ~/Shared

Any files and folders you put into the share should now be visible to both Host and Guest operating systems.

Tuesday, 11 September 2012

Guide: VirtualBox and Ubuntu Server 12.04 Part 2 - Installing UbuntuServer 12.04


In Part 1 I described how to set up a new blank virtual machine for Ubuntu Server 12.04 in VirtualBox. In Part 2 I shall walk you through how to install the operating system, boot it up, install updates and log in via SSH.

Installing the operating system

As you can see, I have a few virtual machines in my VirtualBox and in Part 1 of this guide I created a 3rd.

Select the VM you made in the list on the left and press the green Start button in the toolbar at the top.
You will see the black window open, containing your VM display and a dialog box with the First run wizard.

Press Continue.
The wizard will now ask for the Operating system installation media that you would have downloaded in Part 1 which is available from

Press the yellow and green folder button to browse to the .iso file of the OS and press Continue.
A summary will then be displayed, if there are any mistakes press Go Back to correct them, otherwise press Start.
The Ubuntu installation process will now start.

Have the VirtualBox VM in focus, rather than say your web browser, then select your language with the arrow keys on the keyboard, in my case English, and press the Enter key.
'Install Ubuntu Server' is selected by default (if not then change the selection with the arrow keys) and press the Enter key.
Again, select your language using the arrow keys then press the Enter key to make your selection.
Next select your physical location and press Enter.
The next screen asks how you wish to detect the type of keyboard you have. Personally I choose 'No' here and make my selection on the next screen.

If you are unsure, simply use the arrow keys to select 'Yes' and follow the on screen instructions that ask you to press various keys on your keyboard and if there are certain symbols present on any of the keys.
Select your keyboard layout manually and press the Enter key to make your selection - Note: You will not see this screen if you chose to press the keys to help determine your keyboard on the screen above.
The installation will continue automatically until the next prompt below.
Choose and type a name to give to your new virtual machine. I stick with the default.

Press the Enter key to continue.
Next, type in your full name and press the Enter key to continue.
The installation will now ask you for a user name to log in to the system by. By default it will choose your first name based on the details you entered on the previous screen but feel free to change it.

What ever you choose here... DON'T FORGET IT!
Next, enter a password for this new user and press the Enter key. Again.... DON'T FORGET IT!
Enter the same password again to make sure you actually typed it correctly and press the Enter key to continue.
The next screen will ask if you want to encrypt your new user's home directory. I prefer not to as it makes things a bit easier in the future.

Select 'No' and press the Enter key to continue.
The installation will now try to determine your current time zone and then display this screen. If it is correct then select 'Yes' and press the Enter key to continue, otherwise select 'No' and choose your timezone manually.
Select 'Guided - use entire disk and set up LVM' and press the Enter key.
We only created the one virtual hard disk for this VM in Part 1 so you only get one option here.

Press the Enter key to continue.
Move the selection to 'Yes' with the arrow keys and press the Enter key to commit the changes.
If you want to partition your disk then this is the place to do it. I have no need, so just accept the default and press the Enter key to continue.
Confirm the settings, select 'Yes' and press the Enter key to continue.
The installation will now continue automatically. Let it run until the next screen.
If your network requires you to use an HTTP proxy to access the internet then enter the address of the proxy server here. Otherwise leave it blank and press the Enter key to continue.

If all is well and you are connected to the internet, the installation will download extra data and continue automatically.
Next the installation will ask how you want to handle security updates. NB: this isn't all updates just security patches.

I'm a safety kinda guy so I choose to install them automatically.

Make your selection and press the Enter key to continue.
On the next screen, I choose to install the OpenSSH server. With this installed I can log in to the system via Putty on Windows or Terminal on OS X. I prefer to interact with the system this way as it provides me with more functionality than the VirtualBox interface you are seeing now, such as copy & paste.

To install any of these software packages, use the arrow keys to highlight the item in red, press Space to make your selection(s) (denoted with a *) then press the Enter key to accept your choices.
Installation will now continue automatically.
Select 'Yes' and press the Enter key to continue.
Excellent! The OS is now installed and VirtualBox has removed the installation media for you automatically. Simply select 'Continue' and press the Enter key.

The system will now reboot automatically.

Boot up and log in 

Once rebooted, you should now be presented with a logon screen.

Type in the user name you chose during installation and press the Enter key.

Then type in the password you chose for that user and press the Enter key. NB: You will not see any characters appear as you type your password.
Congratulations! You've now installed Ubuntu and have successfully logged in. You now have a brand new OS to play with.

You'll notice that when you log in you are presented with this welcoming message of the day and at the bottom of this message it tells you that there are updates available to install. We should do that.

Also, take a note of the IP address your VM has been assigned by your DHCP server, in my case it's ''. We will need that later for logging in via SSH.

Installing updates

Enter in the commands as you see them in the screenshot, press Enter then type in your password followed by Enter when prompted:

sudo apt-get update && sudo apt-get upgrade -y

This runs two commands which are chained together by '&&'.

The first command 'sudo apt-get update' will update the OS's list of where it gets it's updates from.

'sudo' means it will run the command with special system administrator priviliges of a user called root. See for more info.

The second command 'sudo apt-get upgrade -y' then performs a system upgrade using the latest updates. The '-y' tells the command to perform the upgrade without asking for confirmation. You may wish to leave the '-y' out so you can confirm each upgrade by pressing 'y' when prompted, but for a first time upgrade I'm usually pretty confident that all will be ok.
Once complete, your screen will look similar to this.

Let's reboot to activate the latest upgrades, type the following and press Enter, typing in your password if prompted:

sudo reboot

You can now log in as before and continue working or alternatively log in via SSH.

Logging in using SSH

On Windows, Putty can be used for SSH logins, however on OS X SSH is already built into terminal.

On OS X, load terminal and type the following:

ssh <user name>@<ip address>

where <user name> is the user you log in with and <ip address> is the IP address you noted down earlier. If you forgot this step, log in again via the VirtualBox window and take a note of the IP address in the welcome message.

You will then type the word 'yes' followed by Enter to accept the RSA key NB: This is a one time only entry, so you shouldn't have to do it again unless the IP changes.

e.g for my VM I would access it with

ssh david@

On Windows it is very similar. Simply launch Putty and create a new connection to the address of <user name>@<ip address> and enter your password when prompted.