Hi Juerg,
Thanks for the fast response. I should have looked up the kernel naming
conventions [1] before posting. Sorry for the noise.
In case anyone finds this issue via websearch in 5 years, here's some
more information on this, which I dug up:
1. I was confused why building a kernel from 6.5.13 sources would report
to the command uname as being 6.5.0:
- /usr/bin/uname get's its information via the syscall "uname" which reports
the values that were baked into the kernel at compile time [2]
- I'm not entirely sure on this but grep-ing through files of
linux-source-6.5.0 I concluded the following: When building a debian kernel,
the debian build framework is used [3], which wraps the kernel Makefile and
overwrites KERNELVERSION to the base kernel version, which it parses from the
changelog (debian/rules.d/0-common-vars.mk).
2. I only wanted to recompile a kernel module for my kernel, but using
the classic Linux makefile targets I was familiar with resulted in
kernel objects with wrong vermagic (because 1.). There exists a guide on
how to do this [4], but that is pretty out of date [5]. Here's what I
did to recompile the "btusb" kernel module for my running kernel (my
"uname -r" was "6.5.0-28-generic", so "base_version=6.5.0"):
sudo su
base_version=$(uname -r | cut -f1 -d-)
apt-get install linux-source-${base_version}
cd /usr/src
tar xjf /usr/src/linux-source-${base_version}.tar.bz2 # may take some time
cd linux-source-${base_version}
make mrproper
cp /lib/modules/$(uname -r)/build/.config ./
cp /lib/modules/$(uname -r)/build/Module.symvers ./
cp /lib/modules/$(uname -r)/build/Makefile ./
head Makefile
uname -r
# Version in Makefile does not match the version of the running kernel's
"uname -r", edit Makefile to fix, mine is now:
# VERSION = 6
# PATCHLEVEL = 5
# SUBLEVEL = 0
# EXTRAVERSION = -28-generic
make -j $(nproc) prepare
make -j $(nproc) modules_prepare
make -j $(nproc) modules M=drivers/bluetooth CONFIG_DEBUG_INFO=n
modinfo drivers/bluetooth/btusb.ko | grep vermagic
modinfo btusb | grep vermagic
# vermagics should match
cp --backup drivers/bluetooth/btusb.ko /lib/modules/$(uname
-r)/kernel/drivers/bluetooth/btusb.ko
3. I also wanted to patch the kernel module. But for the patch to
persist, in the end I looked into DKMS [6]. I copied and patched the
module and added a dkms.conf.
Best,
Gero
[1] (the linked mainline kernel mapping unfortunately doesn't include hwe
kernels for jammy)
https://wiki.ubuntu.com/Kernel/FAQ#Kernel.2FFAQ.2FGeneralVersionToMainline.Given_an_Ubuntu_kernel_package_version_how_do_we_find_the_exact_mainline_release_it_is_based_on.3F
[2]
https://unix.stackexchange.com/questions/136959/where-does-uname-get-its-information-from
[3] https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel
[4] https://wiki.ubuntu.com/Kernel/Dev/KernelModuleRebuild
[5] you need to "make modules_prepare", and "SUBDIRS=" is now called "M="
[6] man dkms or https://github.com/dell/dkms
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2063376
Title:
linux-source-6.5.0 will install kernel 6.5.13
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux-hwe-6.5/+bug/2063376/+subscriptions
--
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs