How to download Real-time Ubuntu kernel source code¶
The source code for Ubuntu’s real-time kernel is available for download. The following guide will show you how to download it for your system’s release of Ubuntu. The process depends on the release of Ubuntu you are using.
Enable access to the real-time Ubuntu kernel¶
Note
LTS releases of Ubuntu require Ubuntu Pro to download their respective real-time kernel source code. See the Ubuntu Pro documentation for more information.
If you’ve already enabled the real-time kernel, you don’t need to do anything in this step.
You can verify the realtime-kernel
service is activated with sudo pro status
.
Otherwise, enable access to the real-time kernel source packages with the following command:
sudo pro enable realtime-kernel --access-only
The real-time kernel source is freely available in the universe repository for interim releases. No actions are required for this step!
Enable downloading source packages with apt¶
APT is used to download the real-time kernel source. We need to enable the source repositories (deb-src
) to allow apt
to download real-time kernel source packages from its archives.
Open the /etc/apt/sources.list
file in a text editor (requires elevated permissions) and #
) the line which includes deb-src http://archive.ubuntu.com/ubuntu/ jammy main
.
1# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
2# newer versions of the distribution.
3deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
4deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
5
6deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
7# deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
Caution
Be sure to main
after the release code-name.
Use the following command to add deb-src
to the ubuntu-realtime-kernel.sources
file:
sudo sed -i '2s/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu-realtime-kernel.sources
Use the following command to add deb-src
to the ubuntu.sources
file:
sudo sed -i '1s/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources
Get the real-time kernel source code¶
First, refresh APT to index newly-added repositories:
sudo apt update
Next, install dpkg-dev
, which is required to unpack Debian source packages:
sudo apt install dpkg-dev
Lastly, download the real-time kernel source code:
sudo apt-get source --only-source linux-realtime
Tip
Ensure you have enough disk space; the downloaded and extracted packages take almost 2GB of storage.
At this point, the unpacked source files are in your current directory.