LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 05-25-2018, 04:49 PM   #1
Poison Nuke
Member
 
Registered: Aug 2012
Location: Germany
Posts: 40

Rep: Reputation: Disabled
fastest/easiest way to recompile simple module inside source tree?


Hello,

Ive build my own kernel with some modifications, now I need to change some parts of a single module. How to recompile only this one without building the whole kernel?
 
Old 05-25-2018, 04:58 PM   #2
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 3,616
Blog Entries: 1

Rep: Reputation: 784Reputation: 784Reputation: 784Reputation: 784Reputation: 784Reputation: 784Reputation: 784
You could go down the source tree to that module and use the Makefile to build it there. And insmod it from there. Otherwise if you kept the build files (did not make clean), with things like ccache in place, it wont take much time to rebuild the kernel through normal routes. Installing the new module is the hard part if you choose the former. A lot of which requires root permissions since it's the kernel.
 
Old 05-25-2018, 08:11 PM   #3
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,511

Rep: Reputation: 1000Reputation: 1000Reputation: 1000Reputation: 1000Reputation: 1000Reputation: 1000Reputation: 1000Reputation: 1000
I think you have to run depmod last thing if you build just the module.
 
Old 05-28-2018, 08:51 AM   #4
Poison Nuke
Member
 
Registered: Aug 2012
Location: Germany
Posts: 40

Original Poster
Rep: Reputation: Disabled
I cant get the makefile inside the mouse-driver directory to work for me, but currently Iam doing a "make modules" in the root of the source-tree, which seems to only rebuild the changed module. But still takes a couple of seconds to check the other 1500 modules in the build.

After that I copy the regarding .ko file into the corresponding lib/modules directory and then rmmod and modprobe.
 
Old 05-28-2018, 09:05 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 17,240

Rep: Reputation: 2638Reputation: 2638Reputation: 2638Reputation: 2638Reputation: 2638Reputation: 2638Reputation: 2638Reputation: 2638Reputation: 2638Reputation: 2638Reputation: 2638
So what's the problem ?. Takes a few seconds as you say.
 
Old 05-28-2018, 09:44 AM   #6
Poison Nuke
Member
 
Registered: Aug 2012
Location: Germany
Posts: 40

Original Poster
Rep: Reputation: Disabled
153 seconds, to be exactly. Raspberry Pi 3B+ and no cross-compile capable machine around here.

Last edited by Poison Nuke; 05-28-2018 at 09:52 AM.
 
Old 06-03-2018, 11:34 PM   #7
X-LFS-2010
Member
 
Registered: Apr 2016
Posts: 382

Rep: Reputation: Disabled
is there such a thing as "simple kernel module" when the rest of the tree is involved?

the fact is there's always a chance that re-using ".o" from a previous build may not work

if your assembler (and compiler) are perfect in a perfect world you won't have problems

the problem is people can spend hours debugging things only to find the assembler is putting in "the wrong instructions" causing STALE ".o" to not work

if you knew the junk GCC and ASM did when translating C code to machine code you'd have a headache. it's not like the old days when things were "more pure" and there was a strong relation between C code and the underlying ASM code

for example: you might say "INC CX" in asm. you might write C code known to do exactly that given the surrounding code (if you know what your doing).

but today's compilers will look at your "arch" and add and remove ASM code in a highly speculative manner to "use the processor better". doing that changes the code size. you have a speculative linker to worry about to. the result: you link a new to an old and they depend on different holes - the "true" dependencies of physical time and space are not met, the program may crash or have an extremely difficult bug to find.

you'd expect that from a high level language. but hackers didn't care about purity.

you'd say: hey if i wanted ASM bloat added I would call C functions from a library like STDIO that provided wrapped services.

ah! that's where you'd be wrong. they are going to force you to use their ASM code, their idea of speculative cascasing memory permissions, their idea about everthing: in every language, below the root before you get the compiler

Last edited by X-LFS-2010; 06-03-2018 at 11:56 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How does one export a symbol from a module built outside the kernel source tree? opsimath Linux - Kernel 3 09-15-2011 11:56 AM
make only specific module is kernel source tree saranjothy Linux - Kernel 2 08-16-2006 11:05 AM
single module compile in clean source tree henryquinn Linux - Software 3 02-15-2006 04:38 AM
Fastest,easiest and the best way to master linux. shyamsundar General 22 02-11-2006 10:21 AM
which source tree to choose for module compilation ? roemisch Linux - Hardware 4 03-31-2005 05:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 04:42 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration