Optimization of the Linux Kernel
Linux Kernel can be optimized in the following way
Remove Unnecessary Functionality
[Decision on "What is essential?" and "What is extra?" depends upon the actual product definition]
- Drivers and subsystems that are not required in the product can simply be left out of the kernel configuration.
- If the product does not support any of MTD devices, the corresponding drivers and support for flash file systems like JFFS2 can be removed from the kernel configuration.
Postpone (Deferred Initialization)
[?initcalls for some modules may take quite long delaying the boot process]
- Locate the initcall definition of these modules in the source code.
- Change the declaration of the initcalls from?module_init()?to?deferred_module_init()
- Once the system has booted, deferred initcalls can be executed by:
$ echo 1 >/proc/deferred_initcalls.
For Example, in one of our projects we reduced init time from 2+ secs to 0.2+ secs.
Debugging Optimization
[debug infrastructure can be removed.]
???????? Remove option?-g?from the compiler.
???????? Disable?Kernel debugging
???????? Disable?Debug Filesystem
???????? Disable?Tracer
There are other methods also available that can be implemented for optimizing the Linux Kernel, we will discuss further.