Re: [PATCH] Declare the file_operations struct as const

From: Krish Jain
Date: Sun Aug 29 2021 - 14:28:48 EST


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" ?


Thanks again

On Sun, Aug 29, 2021 at 6:56 PM Krish Jain <krishjain02939@xxxxxxxxx> wrote:
>
> On Sun, Aug 29, 2021 at 6:49 PM Bryan Brattlof <hello@xxxxxxxxxxxxxxxxx> wrote:
> >
> > On this day, August 29, 2021, thus sayeth Krish Jain:
> > > > >
> > > > > Hi, what option do you mean? I already ran make allmodconfig and sudo
> > > > > make modules_install install and then make "CCFLAGS=-Werror W=1
> > > > > M=drivers/staging/android/" and now I do get output but one line
> > > > > "WARNING: Symbol version dump "Module.symvers" is missing. Modules may
> > > > > not have dependencies or modversions. You may get many unresolved
> > > > > symbol warnings." . Then I tried "make CCFLAGS=-Werror V=1
> > > > > M=drivers/staging/android/" and that outputted the following:
> > > > >
> > > >
> > > > Most of the answers you're asking for are going to get vague responses
> > > > (if any) on the mailing lists. The idea being (and I agree with) that
> > > > giving out the answers will steal your opportunity to explore and learn
> > > > the material yourself.
> > > >
> > > > Yes, it would be faster if we told you the answer, but ultimately, we
> > > > would be doing a disservice to you.
> > > >
> > > > Besides, more times than not we (me especially) don't have the answer.
> > > >
> > > > With that said, I will give a (generous) hint. :)
> > > >
> > >
> > > Hi. Do I have to build the kernel once before this works? Or can I
> > > just build a module directly?
> > >
> >
> > 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.
> > ~Bryan
> >
>
>
>
> That 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.
>
> Best Regards