Current location - Health Preservation Learning Network - Healthy weight loss - Why is the linux kernel and driver compiled by myself much bigger than the system itself?
Why is the linux kernel and driver compiled by myself much bigger than the system itself?
1, there are many debugging options in the configuration (not necessarily with the word "debugging"), and the locations are scattered;

2. The built-in kernel often needs to be carefully configured for a long time, which will be more comprehensive than the personal configuration for more than ten minutes.

These two reasons affect the size of kernel and module, but they have little effect.

Compiled kernel modules contain many segments that are not used at runtime (they may be used when compiling connections, not errors), and are usually deleted in the distribution, which is probably the reason.

You can consider using [strip -S mod_name.ko] to deal with the kernel module (note: the option here is to use uppercase S, lowercase S or not to write it will delete the symbol table together, which will cause the module to fail to load), and see if the file becomes smaller (don't do this to the kernel itself).

If the above command obviously reduces the number of files, consider defining the environment variable INSTALL_MOD_STRIP as 1 (number) before compiling the kernel, so that all kernel modules after make modules_install are handled by STRIP.