Does /proc/config.gz always contain all supported options of a kernel?
Assuming I have a running Linux system that has the /proc/config.gz file:
Does the (unpacked) file always contain all of the options the particular kernel supports, including commented out like:
#CONFIG_SOMETHING is not set
or is it possible that some options which the kernel supports do not appear at all in that file?
(the usefulness of knowing that for sure is to, perhaps, be able to do some problem hunting without currently having access to the buildroot config files that were used to create the Linux image at hand)
1 answer
It is possible - while being unlikely - that /proc/config.gz does not match the actual kernel configuration.
Normally, /proc/config.gz should reflect the kernel configuration truthfully. But whether you can really rely on /proc/config.gz being truthful or not depends on the build process for the kernel (or in other words: where you got the kernel or its build files from).
In rare and extraordinary circumstances, a developer might decide to build a kernel with a certain configuration while letting /proc/config.gz pretend the kernel having a different configuration.
One such example case would be workarounds for compatibility issues, as is the case in this real-world project about a custom kernel for Xiaomi mido Android devices: https://github.com/franciscofranco/mido/commit/c9ea8d1f6bb5f9cd0c30053e98c2130b5a9499ab. To quote the message of the commit i linked to:
Userspace reads /proc/config.gz and spits out an error message after boot finishes when it doesn't like the kernel's configuration. In order to preserve our freedom to customize the kernel however we'd like, show userspace the stock config so that it never complains about our kernel configuration.
0 comment threads