how to build kernel module by manual?

xux1217

Member
Sep 26, 2019
9
0
21
32
Hi,

I have a ASUS motherboard and run the PVE, and I want to use lm-sensors to monitor hard driver status.

But the ASUS chip driver nct6775 has a bug in pve7, so I must compile it by myself. Refer here: https://bugzilla.kernel.org/show_bug.cgi?id=204807

To compile the nct6775, I need use a patch file to the standard kernel source code.

And now, I don't know how to compile kernel module in pve, I can't get a standard kernel source to use the patch file.

Please help me, maybe someone can describe the relevant method?

pve version: 7.0-10
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian

kernel version:
5.11.22-2-pve #1 SMP PVE 5.11.22-3 (Sun, 11 Jul 2021 13:45:15 +0200) x86_64 GNU/Linux
 
That is a kernel patch, you can apply it directly to the kernel tree. Check out the pve-kernel repository and put the patch file in patches/kernel, then run git submodule update --init --recursive && apt-get build-dep . && make deb, that should give you a patched kernel .deb file to install. Note that this will not auto-update, so you need to build your own kernel for every update we release manually.
 
That is a kernel patch, you can apply it directly to the kernel tree. Check out the pve-kernel repository and put the patch file in patches/kernel, then run git submodule update --init --recursive && apt-get build-dep . && make deb, that should give you a patched kernel .deb file to install. Note that this will not auto-update, so you need to build your own kernel for every update we release manually.
Can I only build a module to load? not all the kernel.

I know use the standard linux kernel source to build.
`make modules` and copy the generated "*.ko" to /lib/modules/{version}/kernel/drivers/
 
You can try, of course, though if the corresponding driver is compiled as "built-in" it will not work (not sure how we configure it, probably as module though). Take a look at the Makefile in the repository I linked to see how we build our pve-kernel packages. The source is in the submodules directory.
 
You can try, of course, though if the corresponding driver is compiled as "built-in" it will not work (not sure how we configure it, probably as module though). Take a look at the Makefile in the repository I linked to see how we build our pve-kernel packages. The source is in the submodules directory.
OK, I would try, thanks very much.