Re: [PATCH] Declare the file_operations struct as const
From: Krish Jain <hidden>
Date: 2021-08-29 22:11:37
Also in:
lkml
On Sun, Aug 29, 2021 at 11:00 PM Bryan Brattlof [off-list ref] wrote:
On this day, August 29, 2021, thus sayeth Krish Jain:quoted
Keeping you updated. Small win. The "Symbol version dump "Module.symvers" is missing. " error disappeared. Now I still don't know whyWhoop! Any win, no matter their size, always feel great. I ran around the house yesterday after cross compiling DOOM! for an armel chip. It's that "win" feeling you get that keeps me involved. It is important that you find out why though. What is the importance to having Module.symvers? and why is it a WARNING and not an ERROR?
When a module is loaded/used, the values contained in the kernel are compared with similar values in the module; if they are not equal, the kernel refuses to load the module. I don't need it in my case.
What would happen if we didn't have the proper symbols when compiling or installing this driver? How and what generates the Module.symvers file when we *do* need it?
The kernel would refuse to load the module.
How can we turn this warning off when we don't need it? This is covered in chapter "6. Module Versioning" https://www.kernel.org/doc/html/latest/kbuild/modules.htmlquoted
ERROR: Kernel configuration is invalid."; \ echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\ echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ is still present. How can I fix this?Are there any other 'make *config' options we could try?
Yes, like main menuconfig. I tried it but it still doesn't work.
What does 'make prepare' even do?
Prepares for different architectures etc.
Why do we even need a configuration file? https://www.kernel.org/doc/html/latest/kbuild/kconfig.htmlquoted
Best Regards On Sun, Aug 29, 2021 at 8:28 PM Krish Jain [off-list ref] wrote:quoted
Basically it says "you must have a prebuilt kernel available that contains the configuration and header files used in the build." Since for the staging kernel "make oldconfig" asked me for more configurations apart from my old configuration file (as it reads the existing .config file that was used for an old kernel and prompts the user for options in the current kernel source that are not found in the file) . So I *don't* currently have a prebuilt kernel that contains all the configuration in my staging kernel's .config file. So do I have to build the kernel once before I can just build the module with "make CCFLAGS=-Werror W=1 M=drivers/staging/android" ?What do all these other configuration settings turn on and off anyway? Do we really need CONFIG_INFINIBAND turned on if we're working in the drivers/staging tree of the kernel?
No, we don't. I removed it.
What would we gain from having a compiled kernel if we want to test a single staging driver?
No need to compile the entire kernel I guess for my use case. But after all this reading :( I still don't get why " sudo make CCFLAGS=-Werror W=1 M=drivers/staging/android/ V=1" worked for you but not for me. I still get the following errors test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \ echo >&2; \ echo >&2 " ERROR: Kernel configuration is invalid."; \ echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\ echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ echo >&2 ; \ /bin/false) ..... How can I fix this?
If you found what Module.symvers does, you should know this.quoted
quoted
quoted
quoted
Again, do not allow others to rob you of learning how to solve these issues yourself. I *strongly* encourage you to familiarize yourself with the Kernel Build System in the Documentation. https://www.kernel.org/doc/html/latest/kbuild/modules.html Specifically the first paragraph of "2. How to Build External Modules" It may seem like a lot for such a simple issue but it *is* worth it. ~BryanThat section says "To build external modules, *you must have a prebuilt kernel available* that contains the configuration and header files used in the build. Also, the kernel must have been built with modules enabled. If you are using a distribution kernel, there will be a package for the kernel you are running provided by your distribution. An alternative is to use the “make” target “modules_prepare.” This will make sure the kernel contains the information required. The target exists solely as a simple way to prepare a kernel source tree for building external modules. NOTE: “modules_prepare” will not build Module.symvers even if CONFIG_MODVERSIONS is set; therefore, *a full kernel build needs to be executed to make module versioning work.*" So I am just trying to confirm with you whether I have to first build the kernel with like "make" or not? As you can imagine my hardware takes *very* long to build a kernel as I did in my last attempt so I am asking whether it is needed. Hope you understand.I understand. Though I still don't wish to rob you of this opportunity. Your ability to come up with these questions and answer them yourself is what will make you a better programmer and developer. Don't get me wrong. Greg knows all too well the garbage I can shovel his way. It's not about knowing the answer. It about knowing how to find the answer yourself. ~Bryan