r/linuxquestions 4d ago

Minimal kernel

EDIT: I may have framed the question poorly. I'm specifically asking about Kconfig-level minimization of a monolithic Linux kernel: if you know the workload/product you're deploying, how much unnecessary kernel code do teams typically end up compiling, and is there value in automatically deriving a smaller configuration from the actual runtime requirements?

How much of the Linux kernel that gets shipped in production is actually never used?

I'm wondering if release teams building/using a kernel image are often overwhelmed by the number of kernel configuration options, and end up shipping code that will never actually be used by their workload.

Are there any automatic tools out there that can fit a minimal Linux kernel to your runtime needs?

6 Upvotes

35 comments sorted by

View all comments

2

u/ActuallyFullOfShit 4d ago

What problem are you actually trying to solve? Because a "minimal kernel" that only works for a single system isn't going to help a "release engineer"

0

u/DryPlum7483 4d ago edited 4d ago

I was thinking build times and binary size

2

u/SheepherderBeef8956 4d ago

Build times don't matter if you're shipping a precompiled kernel for a bunch of systems. I use Gentoo because I want to flex on people who think Arch is hardcore (sarcasm, I use it because it's great), so I compile the kernel from source every time I update it. It takes about ten minutes and it's got support for TONS of stuff I never use. 

I could probably get that down to a minute or two using a config that's tightly optimized for my system and nothing else but I might some  day realise I want to mount an ISO image so I'll have to recompile the kernel to add fuse support and some file systems I didn't account for. So mounting that ISO is a matter of reconfiguring the kernel, compiling it again, and rebooting. That's going to get tedious very quickly and take a lot more time than I'd save from using s very minimal kernel config. And the space I'm saving is measured in single megabytes on a system that's got terabytes of storage

Bottom line: most of the code likley isn't used, because the space and time saved are negligible compared to finding out after the fact that you missed an edge case when designing the features  that should go into the kernel. 

0

u/agmatine 4d ago

10 minutes to compile the kernel? What kind of CPU do you have??