As this thread Ask us anything about Ubuntu Kernels! and some others are becoming difficult to search in and sort out the correct information if even they are included somewhere in them, I am starting a new thread about specifics issues we encounter.
Here we are experimenting with the new “annotation way” of configuring then building the Ubuntu kernels.
We always restart from scratch and as an example, we use :
lsb_release --all
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04.2 LTS
Release: 24.04
Codename: noble
uname -r
6.11.0-24-generic
cd $HOME
mkdir -p linux_kernel_build
cd linux_kernel_build
apt-get source linux-image-unsigned-$(uname -r)
cd $(find . -maxdepth 1 -type d | grep linux)
chmod a+x debian debian/rules debian/scripts/* debian/scripts/misc/*
# From https://discourse.ubuntu.com/t/kernel-configuration-in-ubuntu/35857
# When requested, here we do annotation modifications commands, example to come.
fakeroot debian/rules clean binary arch=amd64
cd $HOME
rm -fR linux_kernel_build
Which is super easy and build us all the .deb files ! - )
So, huge thanks here to everyone concerned for their great works ; - )
But then using the annotation way to do modifications like this :
./debian/scripts/misc/annotations -c CONFIG_TRIM_UNUSED_KSYMS --arch amd64 --flavour generic --write y
we got some issues.
On the example provided above which is that if we enable CONFIG_TRIM_UNUSED_KSYMS, then we got this error during an “Out of tree? Or external? Or what is the correct naming?” module build like zfs :
configure: error:
*** This kernel has unused symbols trimming enabled, please disable.
*** Rebuild the kernel with CONFIG_TRIM_UNUSED_KSYMS=n set.
So how do we select or unselect “Out of tree? Or external? Or what is the correct naming?” modules build ?
Another question, if I may :
In the case I would like CONFIG_TRIM_UNUSED_KSYMS=y with some “Out of tree? Or external? Or what is the correct naming?” modules, like ZFS as an example ! - ), what would be the way to have it build, not as an external module or even into the kernel ?
Not sure I understand. ZFS is a DKMS, it’s not part of the kernel source. You have to disable it because you’re turning on a kernel option that is apparently incompatible with that DKMS.
I mean is there a easy way, doable by a non specialist, like me, like a day of work, to take a DKMS module that reside outside the kernel source tree, and put it into it, to avoid the need to use DKMS to build it ; as in this specific case I have the source tree ; - )
That really depends on the DKMS. Some might be simple to integrate, some not. A DKMS typically supports multiple kernel versions and as such comes with shims and ifdefs and what not to account for kernel API changes between versions. Those likely have configuration steps to figure out what needs to be enabled and disabled based on the target kernel version. The build process is typically very different from an in-tree module.
What’s wrong with using the DKMS? Also, in the case of ZFS there is user-space tools that need to match the kernel module so you need to make sure you don’t diverge there or things will not work as expected.