3 ms·
A rough rule of thumb is 20 bytes of object for 1 line of C.[1] So if you have a 5MB kernel you might have 250k source lines of code. That said, the Linux kern
by jws 6y ago
A rough rule of thumb is 20 bytes of object for 1 line of C.[1] So if you have a 5MB kernel you might have 250k source lines of code.
That said, the Linux kernel is not typical code. Great swaths of it are architectures and devices you will not need, so they are rightly ignored.
[1] https://www.leshatton.org/Documents/LOC2005.pdf https://www.leshatton.org/Documents/LOC2005.pdf
- dodobirdlord 6y agoI think that’s the core of the question. How much of the kernel is left if you strip out all of the sections that would be stripped by the preprocessor when building for a current-generation 64-bit x86 target. AWS had a blog post about this topic a few years back. They created a cut-down Linux variant for running Lambda functions that only supported exactly their server architecture, only contained exactly the drivers they actually use, and notably only had 1 keyboard driver for a keyboard with only 1 key, which was mapped to Halt.
- mgharrisdc 6y agohttps://aws.amazon.com/blogs/opensource/firecracker-open-source-secure-fast-microvm-serverless/ https://aws.amazon.com/blogs/opensource/firecracker-open-sou...