log EVERY module your kernel used for efficient kernel builds

Here's a trivial bash script that will keep track of EVERY kernel module in uses every. Why? For those of us who are obsessed with a minimal kernel - compile in the right kernel modules via a make localmodconfig

My advice is to cron up this script and use your system for a few weeks which should hopefully catch all needed modules. You can then cat the log into a modprobe prior to your kernel compilation like so:

I've not tested it much, so it's only run with the same number of mods loaded.It should work though as the array is associative and indexed by the mod name, so new modules will generate new array items. That's the theory, anyway.

NOTE: It uses gawk for the sort functionality. I have seen sorts in basic awk but would need to look them up.

Last edited by skanky (2010-10-12 10:31:03)

"...one cannot be angry when one looks at a penguin." - John Ruskin"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Re: log EVERY module your kernel used for efficient kernel builds

Nice idea. One potential issue I *think* I see with the code is that it doesn't distinguish between mod lists that shrink --- however is that likely?

It's supposed to record all of the possible modules you may use. So the list will never shrink. Only grow, like a blob eating everything in its path until it consumes the world! 0_0

Yes, that's what's supposed to happen. The way I read the code (which was this morning, and I may have misread) was that if the list changes in anyway, the new version overrides the old. If the new version has fewer modules, then you'd lose some. I think my code avoids that.

"...one cannot be angry when one looks at a penguin." - John Ruskin"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Re: log EVERY module your kernel used for efficient kernel builds

skanky wrote:

The way I read the code (which was this morning, and I may have misread) was that if the list changes in anyway, the new version overrides the old. If the new version has fewer modules, then you'd lose some. I think my code avoids that.

Re: log EVERY module your kernel used for efficient kernel builds

Simplicity is at the foundation of the "arch way", which doesn't necessarily entail minimalism. One might argue that simplicity means leaving the defaults alone and using the binary packages provided to us graciously by upstream. The time/effort expended to streamline your kernel is almost guaranteed to be far greater than the time recouped by any recognizable increases in performance.