Thursday, 28 February 2013

Updating Your Raspberry Pi's Kernel and Firmware

In the post "Updating Your System" we covered how to keep all your applications and your Linux distribution up to date, but this will not give you the latest Linux kernel or firmware. To find out the version of the Linux kernel on your system type "uname -a" at the command line prompt and press Enter:

pi@raspberrypi ~ $ uname -a_

To find out the version of the firmware installed on your system "sudo vcgencmd version" at the command line prompt and press Enter:

pi@raspberrypi ~ $ sudo vcgencmd version_

You should get results similar to what is shown in the following screenshot:


You can use a package called "rpi-update" to update the Linux kernel and the firmware on your Raspberry Pi, but this package is not available through the repository so you will have to download and install it manually. First of all though, you need to carry out a couple of preparatory tasks.

The first task is to ensure that your Raspberry Pi has the correct date and time by querying a Network Time Protocol (NTP) server. To install the necessary software type "sudo apt-get install ntpdate" at the command line prompt and press Enter:

pi@raspberrypi ~ $ sudo apt-get install ntpdate_

To use "ntpdate" to retrieve the correct time and date from a NTP server (in this case the NTP server at the National Physical Laboratory) type "sudo ntpdate -u ntp1.npl.co.uk" at the command line prompt and press Enter:

pi@raspberrypi ~ $ sudo ntpdate -u ntp1.npl.co.uk_

To ensure that your system has the latest security certificates type "sudo apt-get install ca-certificates" at the command line prompt and press Enter:


pi@raspberrypi ~ $ sudo apt-get install ca-certificates_

Next, you need to download and install the "git" package from the repository. To do this type "sudo apt-get install git" at the command line prompt and press Enter:

pi@raspberrypi ~ $ sudo apt-get install git_

Now you are ready to download and install the "rpi-update package. Type "sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update" at the command line prompt and press Enter:


pi@raspberrypi ~ $ sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update_

Finally to set up the necessary file permissions type "sudo chmod +x /usr/bin/rpi-update" at the command line prompt and press Enter:

pi@raspberrypi ~ $ sudo chmod +x /usr/bin/rpi-update_

You are now ready to run "rpi-update". Type "sudo rpi-update" at the command line prompt and press Enter:

pi@raspberrypi ~ $ sudo rpi-update_

This will produce a lot of text scrolling up your screen followed by a lengthy download (nearly 40 MB) and install process (I suggest you go and make yourself a cup of coffee while it is going on).

When finished and you are back to the command line prompt shut down your Raspberry Pi and restart it for the updates to become effective. Once you are back at the command line prompt (or an LXTerminal window) you can check what versions of kernel and firmware you have by using the "uname -a" and "sudo vcgencmd version" commands again. When I did this today I obtained the results shown in the following screenshot.


You can see that the Linux kernel on my Raspberry Pi is now version 3.6.11+ (previously 3.2.27+) and the firmware is now version 367974 (previously 346337).

Although it is not strictly necessary to update your Raspberry Pi's Linux kernel and firmware in this way it may be useful to know how to do it if you encounter any problems with (for example) unsupported hardware, as the problem may have been resolved by a later version of the Linux kernel or firmware. All software, and especially open source software like Linux evolves over time as new functionality is added and bugs are found and fixed, so it is always useful to have the latest versions of system software.

7 comments:

  1. In the chmod command you have an underscore where it appears you should have a hyphen.

    You wrote:

    rpi_update

    but it is hyphenated as rpi-update
    in the other two commands...

    Thanks for the instructions,
    Tony

    ReplyDelete
    Replies
    1. Thanks Tony,
      Error has now been corrected.
      Tom

      Delete
  2. When im trying to run command sudo rpi-update im getting error message:
    You appear to be trying to update firmware on an incompatible distribution. To force update, run the following:
    sudo -E RPI_UPDATE_UNSUPPORTED=0 ./rpi-update

    what am i doing wrong?

    ReplyDelete
  3. Sorry, I don't know what's causing that problem. I suspect your SD card may have become corrupted - this happened to me and I had to start again with a fresh install. Hope you find a less drastic solution!

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Thanks for review, it was excellent and very informative.
    thank you :)

    ReplyDelete
  6. Worked perfectly.
    Thank you for the easiest and convienient method.

    ReplyDelete