You are not logged in.

#1 2015-12-26 10:32:24

Zenexer
Member
Registered: 2015-12-26
Posts: 3

Partially compiling Linux kernel

I've been using ABS to build a patched Linux kernel.  There's one module that I need to tinker with quite a bit, but I don't want to recompile the entire kernel every time I make a one-line change.  Is there a way I can either compile a single module or only build out-of-date files with ABS?  I tried bypassing ABS and just using make without any lucky.  I'd like to keep as close to the official Arch kernel as possible, so I'd rather not get in the habit of building without ABS.  Right now I'm using 4.3.3-2 from the testing repo with a few patches for hardware compatibility.

On a related note, if I modify a module, is reloading is sufficient (modprobe -r and modprobe), or should I perform a reboot?

Offline

#2 2015-12-26 11:40:39

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,731
Website

Re: Partially compiling Linux kernel

Which module are you building?  Which patch are you applying?

Offline

#3 2015-12-26 12:09:22

ugjka
Member
From: Latvia
Registered: 2014-04-01
Posts: 1,957
Website

Re: Partially compiling Linux kernel

Offline

#4 2015-12-26 12:37:12

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: Partially compiling Linux kernel

Run make help. A single module can be built with make xxx/yyy/zzz.ko or something like that.

Reloading the module should be sufficient, unless it does really weird things like leaving some hardware in such state that the module itself won't know how to handle it after reload smile

And the fastest way to reload is rmmod zzz ; insmod xxx/yyy/zzz.ko. You don't need to install anything if you only want to test some quick change.

EDIT: And yes, this all means "don't use ABS". Unpack source corresponding to your running kernel somewhere and run these commands there. It will save you lots of time and typing.

Last edited by mich41 (2015-12-26 12:49:27)

Offline

#5 2015-12-26 12:50:50

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,731
Website

Re: Partially compiling Linux kernel

mich41 wrote:

EDIT: And yes, this all means "don't use ABS". Unpack source corresponding to your running kernel somewhere and run these commands there. It will save you lots of time and typing.

Or better yet, create a PKGBUILD that just applies the patch and builds/installs the single module you require.

Offline

#6 2015-12-26 16:47:37

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,655

Re: Partially compiling Linux kernel

On Arch, graysky's suggestion is the ideal form.  But, as an old Gentoo guy, I am comfortable building kernels and moving files around by hand.

If you compile the kernel once using make, then change a single source file, then when you run make again it does not need to recompile everything.  It will just compile what it needs.
This works well for me -- In addition to the Arch stock kernel I generally keep a kernel around with all my required modules built in so I don't need an initrd.  As such there is always a kernel tree compiled in my "build" directory.  When I need a new module, it is simple to run a make config to turn modules on and compile them.

Last edited by ewaller (2015-12-27 16:05:28)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#7 2015-12-26 23:31:26

bstaletic
Member
Registered: 2014-02-02
Posts: 658

Re: Partially compiling Linux kernel

As others said, get confortable with kernel config and make command if you already aren't. Also watch aout not to mess things up, like blindly running scripts in kernel build directory. Otherwise, I think mitch41's suggestion is the best.

Offline

#8 2015-12-27 07:59:15

Zenexer
Member
Registered: 2015-12-26
Posts: 3

Re: Partially compiling Linux kernel

Thanks for the help.  I'm pretty familiar with GNU make, so I settled on make something.ko.  I hadn't tried that originally because I figured it couldn't possibly that simple, but it works great.

Now I have a bug report: https://bugzilla.kernel.org/show_bug.cgi?id=110021
And a pull request/patch: https://github.com/torvalds/linux/pull/236

What's the process for attracting some attention to these?  From what I've seen, patches are typically communicated via mailing lists and such rather than pull requests, so I'm not sure if I need to do something else to get noticed.  It's a single-character patch that fixes a pretty obvious regression on some laptops, so I figured it'd be a good first contribution.

Offline

#9 2015-12-27 14:01:36

post-factum
Member
From: /cz
Registered: 2008-09-12
Posts: 156
Website

Re: Partially compiling Linux kernel

Does Linus accept pull requests via github? Unlikely.


uname == latest pf-kernel

Offline

#10 2015-12-27 14:09:57

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: Partially compiling Linux kernel

See Documentation/SubmittingPatches and scripts/get_maintainer.pl.

Offline

#11 2015-12-28 05:06:44

Zenexer
Member
Registered: 2015-12-26
Posts: 3

Re: Partially compiling Linux kernel

post-factum wrote:

Does Linus accept pull requests via github? Unlikely.

They do not.  I submitted one anyway.  Their mailing list is rejecting my emails.

Offline

Board footer

Powered by FluxBB