LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 02-15-2022, 06:04 AM   #1
Dilbert of Carlsbad
LQ Newbie
 
Registered: Feb 2022
Posts: 2

Rep: Reputation: 0
how to use correct .config with kernel-headers


I want to build a kernel module for a custom Debian derivative.
I do have the kernel headers and make seemed to work at first shot. But when I did insmod the module, it crashed.

BTW: In order to not screw up the target system, I built in a Docker container on the target system.

I found that the contents of the .config file in the kernel-headers folder do not match the contents of /proc/config.gz of the target system.

My question is: When I copy the configuration from /proc/config.gz (from the target) to .config in the kernel-headers folder (inside the container where I build), what do I do next to "apply" the changes before building my module?

I admit, I am a bit confused by all the make targets available and for a while I was trying things google found for me, like:
make headers_check
make headers_install
make scripts

This combination finally worked - at least the module seems to work without crashing.

But I am unsure whether this was the proper way of doing things or just luck with who-knows-what-side-effects lurking behind the curtains!

What would be the correct way?
Thanks a lot!
 
Old 02-16-2022, 03:50 PM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,842

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
Hm. looks like we have Carlsbad in California, but also we have Karlsbad in Europe.
You need to use modprobe instead of insmod.
What you posted is not enough to answer. It depends on a lot of things, especially would be nice to know why did it crash. What steps did you make before?
Anyway, I would start here: https://wiki.debian.org/Modules (you can find additional links at the bottom of this page). But probably you know it already.
 
1 members found this post helpful.
Old 02-16-2022, 03:52 PM   #3
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Trying random things on google works for some things, but not the best idea for kernel modules. Best is to use the directions in the kernel source.

https://elixir.bootlin.com/linux/lat...ld/modules.rst

"make help" prints a description of the kernel make targets.
 
1 members found this post helpful.
Old 02-24-2022, 01:03 PM   #4
Dilbert of Carlsbad
LQ Newbie
 
Registered: Feb 2022
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks guys!
It's Carlsbad in California BTW. But I'm back in Europe since 2011 though... But not in Karlsbad...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[kernel-headers-3.2.45-x86-3] OR [kernel-headers-3.2.45_smp-x86-3]? Sefid par Slackware 3 07-24-2013 09:59 AM
Zypper wants to dl the wrong kernel headers... YaST doesnt have current headers zorb SUSE / openSUSE 2 11-28-2009 11:12 AM
Difference between packages linux-headers-foo and linux-headers-foo-generic? jhwilliams Ubuntu 1 10-19-2009 05:04 AM
third party makefile not correct? Missing version.h with installed kernel-headers. Lytse Flap Programming 3 07-31-2008 05:24 PM
Making sure the correct kernel headers are used djgerbavore Fedora 2 09-06-2007 08:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 11:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration