Score:0

How do I install custom (real-time) Linux kernel headers?

am flag

Some background

I've successfully patched a Linux kernel with the PREEMPT_RT patch, configured it, built it, and booted from it. The steps I took:

Patched kernel 5.4.230 with PREEMPT_RT

# Get kernel source
wget https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.4.230.tar.xz

# Get PREEMPT_RT patch
wget https://www.kernel.org/pub/linux/kernel/projects/rt/5.4/patch-5.4.230-rt80.patch.xz

# Patch the kernel
xz -cd linux-5.4.230.tar.xz | tar xvf -
cd linux-5.4.230
xzcat ../patch-5.4.230-rt80.patch.xz | patch -p1

Built kernel

# Install prerequisite packages
sudo apt install build-essential flex bison pkg-config openssl libssl-dev libncurses-dev dwarves -y

# Copy existing configuration installed with Ubuntu 20.04 as a
# starting point
cp /boot/config-$(uname -r) .config

# Turn on fully preemptable kernel here
make oldconfig

# Build
make -j$(nproc)

Installed kernel

sudo make modules_install
sudo make install
sudo update-grub
sudo reboot

I also opted to use secure boot so I signed the kernel but that's not relevant here.

Where I need help

Next, I need to install a software package that requires that Linux headers are installed. I see there's a make target called headers_install in the kernel source directory but I'm a little confused on how kernel headers are organized. It looks like I should be putting the kernel headers from the make headers_install command in /usr/src/ which is all fine and good but I feel like there should be some extra steps after that. Like is there something I have to do after this to make these the new default or anything?

I saw one other similar question but it was mostly related to VMWare and seemed to be solved by installing kernel headers through apt. This is a custom(-ish) kernel so I don't think that will work for me unless I can happen to use the same kernel headers for the base kernel that I patched without problems.

Any help is appreciated. Thanks!

Bodo avatar
pt flag
Please [edit] your question and add details how exactly you obtained, built and installed the kernel. According to the following sources, building the kernel in the Debian way should result in a few `.deb` packages you can install as usual: https://askubuntu.com/q/724900/1186757 or https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel
branchwithlink avatar
am flag
@Bodo Thanks. I did attempt to use `make deb-pkg` but I ran into an error. I took the path of least resistance and ran `make` without creating the deb package which just worked. I'll try to work through the Debian package error and see if it lends any results.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.