Re: [PATCH] Declare the file_operations struct as const

From: Bryan Brattlof
Date: Tue Aug 31 2021 - 09:36:05 EST


On this day, August 31, 2021, thus sayeth Krish Jain:
> Hi, could someone help with this? Still stuck. Maybe someone else has
> some insight into this issue too? Or Greg or Bryan.
>
> Thanks
>

Just another friendly reminder about top posting. I liked Greg's link to
John Gruber's opinion. TLDR: It's poor form.

http://daringfireball.net/2007/07/on_top

Ignoring these bits of advice send signals to the community that you
don't value the time we donate to you.

>
> On Mon, Aug 30, 2021 at 3:01 PM Krish Jain <krishjain02939@xxxxxxxxx> wrote:
> >
> > One sec this got even more confusing. I saw
> > https://stackoverflow.com/questions/23184181/error-while-running-make-install-include-generated-autoconf-h-or-include-confi
> > and it says
> >
> > -------
> > You are including the V=1 which causes Make to show the commands as
> > they're being run. From the looks of it, you're not actually seeing
> > the error itself, but you're seeing the test that it's running to
> > check if those files exist:
> >
> > test -e include/generated/autoconf.h -a -e include/config/auto.conf ||
> > ( \ ... echo error messages here ... \ )
> >
> > That test is being run, and if it fails, it would echo those messages
> > to standard error, which it's not. If your module isn't building it's
> > probably due to some other issue.
> > ------
> >
> > So where is it going all wrong? Messing up the file ashmem.c does not
> > print the errors.
> >

I have no clue where you got V=1 from. Are you sure you need it?

As for "So where is it going all wrong?"

Like Greg said a few emails ago:

"Are you sure the file is being built at all? You usually have to
select the proper configuration option to enable that driver as well."

After a response from Greg like that, I would ask myself: How do I
select the proper configuration options? and How do I know if the proper
one is set?

Having had the same issue as you when I first started, I will try to
save you some time. Read the documentation, it is faster than you think
and will give you more information than I can give you over email:

https://www.kernel.org/doc/html/latest/kbuild/makefiles.html

> > >
> > > https://pastebin.com/NuvqMUWu is the link to the .config file.
> > > The error I get is https://imgur.com/gkwh7Sb .
> > >

Your .config will be different to everyone else. I have different
hardware to you, Greg or Fabio. And I will need different modules and
options enabled. I have no idea if your .config file is correct.

This error seems to indicate you're missing your Module.symvers file,
not your .config file. It's hard to tell with the V=1 option set.

> > > >
> > > > 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.
> > > >

Excellent! This has nothing to do with test building our shared memory
system. We can either turn the warning off, find a way to generate the
file, or fake that we've generated the file.

Though it's important you know the impact of your decision.

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

After everything above, (See what we mean about top posting?) Are you
sure you're getting this ERROR?

> > > > >
> > > > > Are there any other 'make *config' options we could try?
> > > >
> > > > Yes, like main menuconfig. I tried it but it still doesn't work.
> > > >

There are more (faster) options. Though 'menuconfig' would be a great
option to select specific modules you would like to build.

> > > > >
> > > > > 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.
> > > >

"removed it" makes me think your editing your .config file by hand.
It's not wrong to do so, just be sure you know what you're doing.

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

My advice would be to familiarize yourself with how modules are built
with "Linux Kernel Makefiles" section in the documentation.

https://www.kernel.org/doc/html/latest/kbuild/makefiles.html

It describes everything in greater detail than I could ever give here.

If anyone else wants to jump in here, feel free.
~Bryan