Home made kernel build failed

Hello everyone,

I hope you’re doing fine ; - )

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 ?

Thanks, nice days ; - )

Try this:

$ ./debian/rules printenv | tail -6
all_dkms_modules          = zfs ipu6 iwlwifi v4l2loopback usbio
 do_zfs                   = true
 do_ipu6                  = true
 do_iwlwifi               = true
 do_v4l2loopback          = true
 do_usbio                 = true
$
$ echo "do_zfs = false" >> debian.master/rules.d/amd64.mk
$
$ ./debian/rules printenv | tail -6
all_dkms_modules          = zfs ipu6 iwlwifi v4l2loopback usbio
 do_zfs                   = false
 do_ipu6                  = true
 do_iwlwifi               = true
 do_v4l2loopback          = true
 do_usbio                 = true

Or if you want to disable all DKMS modules:

$ echo > debian.master/dkms-versions
$
$ ./debian/rules printenv | tail -6
 do_tools_usbip           = true
 do_tools_x86             = true
do_cloud_tools            = true
 do_tools_hyperv          = true

all_dkms_modules          = 

Hello Juergh,

Wow, thanks for your quick answer ; - )

But here it does not seems to work as you expect | - (

Maybe I misunderstood something…

Have a nice day.

PS:

uname -r
6.11.0-29-generic

lsb_release --all
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.2 LTS
Release:        24.04
Codename:       noble

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/*

./debian/rules printenv | tail -9

all_dkms_modules          = zfs ipu6 ipu7 iwlwifi v4l2loopback usbio vision
 do_zfs                   = true
 do_ipu6                  = true
 do_ipu7                  = true
 do_iwlwifi               = true
 do_v4l2loopback          = true
 do_usbio                 = true
 do_vision                = true

cat debian.master/rules.d/amd64.mk
human_arch      = 64 bit x86
build_arch      = x86
defconfig       = defconfig
flavours        = generic
build_image     = bzImage
kernel_file     = arch/$(build_arch)/boot/bzImage
install_file    = vmlinuz
vdso            = vdso_install
no_dumpfile     = true
uefi_signed     = true
do_tools_usbip  = true
do_tools_cpupower = true
do_tools_perf   = true
do_tools_perf_jvmti = true
do_tools_perf_python = true
do_tools_bpftool = true
do_tools_x86    = true
do_tools_hyperv = true
do_tools_rtla = true
do_extras_package = true
do_tools_acpidbg = true
do_lib_rust     = true

for dkms_module in $(./debian/rules printenv | grep all_dkms_modules | cut -d "=" -f2) ; do echo "do_$dkms_module = false" >> debian.master/rules.d/amd64.mk ; done

cat debian.master/rules.d/amd64.mk
human_arch      = 64 bit x86
build_arch      = x86
defconfig       = defconfig
flavours        = generic
build_image     = bzImage
kernel_file     = arch/$(build_arch)/boot/bzImage
install_file    = vmlinuz
vdso            = vdso_install
no_dumpfile     = true
uefi_signed     = true
do_tools_usbip  = true
do_tools_cpupower = true
do_tools_perf   = true
do_tools_perf_jvmti = true
do_tools_perf_python = true
do_tools_bpftool = true
do_tools_x86    = true
do_tools_hyperv = true
do_tools_rtla = true
do_extras_package = true
do_tools_acpidbg = true
do_lib_rust     = true
do_zfs = false
do_ipu6 = false
do_ipu7 = false
do_iwlwifi = false
do_v4l2loopback = false
do_usbio = false
do_vision = false

cat debian.master/dkms-versions
zfs-linux 2.2.6-1ubuntu1.1 modulename=zfs debpath=pool/universe/z/%package%/zfs-dkms_%version%_all.deb arch=amd64 arch=arm64 arch=ppc64el arch=s390x rprovides=spl-modules rprovides=spl-dkms rprovides=zfs-modules rprovides=zfs-dkms
ipu6-drivers 0~git202407190257.9369b88e-0ubuntu1.1 modulename=ipu6 debpath=pool/universe/i/%package%/intel-ipu6-dkms_%version%_amd64.deb arch=amd64 rprovides=ipu6-modules rprovides=intel-ipu6-dkms type=standalone
ipu7-drivers 0~git202407090310.f40d5a70-0ubuntu2 modulename=ipu7 debpath=pool/universe/i/%package%/intel-ipu7-dkms_%version%_amd64.deb arch=amd64 rprovides=ipu7-modules rprovides=intel-ipu7-dkms type=standalone
backport-iwlwifi-dkms 1:0~89.12325-git36c5be1a-0ubuntu3 modulename=iwlwifi debpath=pool/universe/b/%package%/backport-iwlwifi-dkms_%version%_all.deb arch=amd64 rprovides=iwlwifi-modules rprovides=backport-iwlwifi-dkms type=standalone
v4l2loopback 0.13.2-1ubuntu1 modulename=v4l2loopback debpath=pool/universe/v/%package%/v4l2loopback-dkms_%version%_all.deb arch=amd64 rprovides=v4l2loopback-modules rprovides=v4l2loopback-dkms
usbio-drivers 0~git202408092230.70c524c5-0ubuntu1.1 modulename=usbio debpath=pool/universe/u/%package%/intel-usbio-dkms_%version%_amd64.deb arch=amd64 rprovides=usbio-modules rprovides=intel-usbio-dkms type=standalone
vision-drivers 0~git202408091833.02081ea4-0ubuntu2 modulename=vision debpath=pool/universe/v/%package%/intel-vision-dkms_%version%_amd64.deb arch=amd64 rprovides=vision-modules rprovides=intel-vision-dkms type=standalone
mofed-modules-24.10 24.10.0.7.0.0+ds1-0ubuntu1~24.10.1 modulename=mofed-modules-24.10 debpath=pool/universe/m/%package%/mofed-modules-24.10-dkms_%version%_all.deb arch=amd64 rprovides=mofed-modules-24.10-modules type=standalone

echo -n > debian.master/dkms-versions
cat debian.master/dkms-versions

./debian/rules printenv | tail -9

all_dkms_modules          = zfs ipu6 ipu7 iwlwifi v4l2loopback usbio vision
 do_zfs                   = true
 do_ipu6                  = true
 do_ipu7                  = true
 do_iwlwifi               = true
 do_v4l2loopback          = true
 do_usbio                 = true
 do_vision                = true

Oh, you’re running the HWE kernel. So it’s not debian.master but $(cat debian/debian.env), i.e. debian.hwe-6.11.

Wow so fast !

cat debian/debian.env
DEBIAN=debian.hwe-6.14

Hum, yes, HWE, correct !
Sorry for the riddle…

Thanks ! Work like a charm now ; - )

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 ?

PS :

./debian/rules printenv | tail -2

all_dkms_modules          = 

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.

Hello Juergh,

Thanks for your answers.

There seems to be nothing really wrong using DKMS.

It is just that I “wanted” not that I “needed” to enable CONFIG_TRIM_UNUSED_KSYMS=y.

As I have not enough knowledge to argue further I guess I am on my own.
At the end, I guess will use DKMS.

Have a nice day ; - )