How to Update your Raspberry Pi Kernel and Install Kernel Headers

How to Update your Raspberry Pi Kernel and Install Kernel Headers

This blog post is a backup from the now-unavailable Pineboards documentation page for how to update your Raspberry Pi Kernel and install Kernel Headers. We have created this post to ensure this information remains available for our customers following the unfortunate closure of Pineboards.


Updating your Raspberry Pi to the latest kernel and installing the appropriate kernel headers gives you access to pre-release features.

This tutorial will guide you through using rpi-update to update the kernel and rpi-source to install kernel headers.

Prerequisites

Step 1: Update Your System

Before proceeding with the kernel update, make sure your system is up to date. Open the terminal and execute the following commands:

sudo apt update
sudo apt full-upgrade

Step 2: Install rpi-update

rpi-update is a tool that fetches the latest experimental kernel available for the Raspberry Pi. This kernel is not thoroughly tested, so use it at your own risk, especially in production environments.

To install rpi-update, run:

sudo apt install rpi-update

Step 3: Update the Kernel

Now that rpi-update is installed, you can update the kernel. This will download and install the latest firmware and kernel. Execute the following command:

sudo rpi-update

Note: After updating the kernel, it's a good idea to reboot your Raspberry Pi to ensure that it uses the new kernel.

sudo reboot

Step 4: Install rpi-source to Fetch Kernel Headers

Kernel headers are needed if you plan to build modules or drivers. rpi-source is a tool that helps in fetching the source corresponding to the installed kernel.

Install rpi-source using the following commands:

sudo apt install git bc bison flex libssl-dev make libncurses5-dev
sudo wget https://raw.githubusercontent.com/jgartrel/rpi-source/master/rpi-source -O /usr/bin/rpi-source
sudo chmod +x /usr/bin/rpi-source
rpi-source --tag-update

Step 5: Fetch the Kernel Headers

After installing rpi-source, run it to download and prepare the kernel headers:

rpi-source --default-config

This command fetches the kernel source and ensures that the kernel headers are correctly aligned with your currently running kernel.

Summary

You now have the latest kernel and the corresponding headers installed on your Raspberry Pi. This setup is ideal for developing hardware drivers, experimenting with new kernel features, or simply staying up-to-date with Raspberry Pi developments.

Leave a comment

All comments are moderated before being published.

This site is protected by hCaptcha and the hCaptcha Privacy Policy and Terms of Service apply.