You are not logged in.

#1 2021-11-18 01:00:58

burny02
Member
Registered: 2021-07-01
Posts: 129

[SOLVED] Compile Module without Kernel?

Is it possible to compile a module without the entire kernel?

Here's what m trying to achieve.

Download kernel source matching my current from kernel
Modify btrtl.c for fix a bluetooth issue I'm having
Recompile that module.
Put it back in my existing kernel

Here's what I've tried so far, but I just get 'exec' error when moving it back to the existing drivers.
I have had success by rebuilding the entire kernel and booting into it. At that point, rebuilding just the modules appeared to work

make -j16 mrproper
zcat /proc/config.gz > .config
make -j16 oldconfig
make -j16 modules_prepare
make -j16 modules M=drivers/bluetooth
sudo make -j16 modules_install M=drivers/bluetooth
sudo cp /lib/modules/5.15.2/extra/btrtl.ko.zst /lib/modules/5.15.2-arch1-1/kernel/drivers/bluetooth/

Last edited by burny02 (2021-11-19 17:02:42)

Offline

#2 2021-11-18 01:06:31

loqs
Member
Registered: 2014-03-06
Posts: 18,992

Re: [SOLVED] Compile Module without Kernel?

The exec error is from modprobe or from cp?  Did you run depmod after you installed the module?

Offline

#3 2021-11-18 01:20:32

burny02
Member
Registered: 2021-07-01
Posts: 129

Re: [SOLVED] Compile Module without Kernel?

The exec error is from modprobe. I didn't run depmod.

None of the sites I've been using mentioned it?

Offline

#4 2021-11-18 01:46:18

loqs
Member
Registered: 2014-03-06
Posts: 18,992

Re: [SOLVED] Compile Module without Kernel?

Any related output from dmesg?  Was the module already loaded when you tried to modprobe it?
make modules_install should have called depmod,  this assumes the build system is the same as the target system.
Did the build generate a new private key?  Which the packaged kernel reject.

Last edited by loqs (2021-11-18 01:54:08)

Offline

#5 2021-11-18 03:09:01

burny02
Member
Registered: 2021-07-01
Posts: 129

Re: [SOLVED] Compile Module without Kernel?

I finally got to the bottom of it

The .config line CONFIG_LOCALVERSION=""  needs to be set to match the kernel that you want to use the module other it will not work

Many thanks for all your help

Offline

Board footer

Powered by FluxBB