linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Krish Jain <krishjain02939@gmail.com>
Cc: Bryan Brattlof <hello@bryanbrattlof.com>,
	"Fabio M. De Francesco" <fmdefrancesco@gmail.com>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Declare the file_operations struct as const
Date: Wed, 1 Sep 2021 18:51:09 +0200	[thread overview]
Message-ID: <YS+vfVTV0fls6KuN@kroah.com> (raw)
In-Reply-To: <CAPGkw+z+uepM0hiNh48xjjD7=2rpgr+RSLzMcHbw2iE=8y+xqQ@mail.gmail.com>

On Wed, Sep 01, 2021 at 05:34:36PM +0200, Krish Jain wrote:
> Oh ok, thanks Greg. I only attempted to use "make CCFLAGS=-Werror W=1
> M=drivers/staging/android/" as that's the command Bryan used earlier
> and it worked.
> 
> "As for your patch, I built the driver using:
> 
>   $ make CCFLAGS=-Werror W=1 M=drivers/staging/android"
> 
> 
> Can you tell me why this is the case?

Again, it depends on your kernel configuration file as to what will, or
will not, be built.

If you have some things set as modules, they can be built as a module,
but the ashmem code can not be built as a module, so you would never
build it if you did the above line.

Here, look at this sequence, starting with a tree that does nothing if I
do a simple 'make' in it, as the whole kernel is already built, and
ashmem is enabled in the kernel configuration

$ grep ASHMEM .config
CONFIG_ASHMEM=y
$ make
$

So, let's change the time stamp on the ashmem.c file and see what gets
built if you use the M= option:

$ touch drivers/staging/android/ashmem.c
$ make M=drivers/staging/android
  MODPOST drivers/staging/android/Module.symvers
$

Nothing gets built as ashmem is NOT a module, and M= only builds any
modules in the directory you specified.

But, if you tell make to just build the whole subdirectory, no matter
what the setting is, it will be built:

$ make drivers/staging/android/
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND objtool
  CC      drivers/staging/android/ashmem.o
  AR      drivers/staging/android/built-in.a
$

So that's the difference, "M=" builds modules in that directory, but if
you tell it to build the subdir, everything in there that needs to be
built, will be built.

Be careful about your kernel configuration, that is the key for what
will, and will not, be built.

Perhaps you should look at the book, "Linux Kernel in a Nutshell" that
is free online.  It talks all about building and configuring a kernel.
Parts of it are out of date, but the general ideas are good.

hope this helps,

greg k-h

  reply	other threads:[~2021-09-01 16:51 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-29 14:45 [PATCH] Declare the file_operations struct as const Bryan Brattlof
2021-08-29 16:20 ` Krish Jain
2021-08-29 16:34   ` Krish Jain
2021-08-29 16:49   ` Bryan Brattlof
2021-08-29 16:56     ` Krish Jain
2021-08-29 18:28       ` Krish Jain
2021-08-29 18:46         ` Krish Jain
2021-08-29 21:00           ` Bryan Brattlof
2021-08-29 22:11             ` Krish Jain
2021-08-30 12:40               ` Krish Jain
2021-08-30 13:01                 ` Krish Jain
2021-08-31  0:42                   ` Krish Jain
2021-08-31 13:35                     ` Bryan Brattlof
2021-08-31 14:00                       ` Fabio M. De Francesco
2021-08-31 23:00                         ` Bryan Brattlof
2021-09-01 15:20                           ` Krish Jain
2021-09-01 15:30                             ` Greg KH
2021-09-01 15:34                               ` Krish Jain
2021-09-01 16:51                                 ` Greg KH [this message]
2021-09-01 17:34                                   ` Bryan Brattlof
2021-09-01 18:04                                     ` Krish Jain
2021-09-01 20:29                                       ` Bryan Brattlof
     [not found] <CAPGkw+x+B1731SL=afoSKiWwH-n-FA5YJ+WOwYdv8iyFhWk1zA@mail.gmail.com>
     [not found] ` <3634721.RBzQ2xsved@localhost.localdomain>
2021-08-27  7:48   ` Fabio M. De Francesco
2021-08-27  8:50     ` Krish Jain
2021-08-27 18:38       ` Krish Jain
2021-08-27 19:46         ` Krish Jain
2021-08-27 23:38           ` Bryan Brattlof
2021-08-28  9:37             ` Krish Jain
2021-08-28  9:46               ` Greg KH
2021-08-28  9:52                 ` Krish Jain
2021-08-28 11:13                   ` Fabio M. De Francesco
2021-08-29  2:13             ` Krish Jain
2021-08-29  2:16               ` Krish Jain
2021-08-29  6:16               ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2021-08-27  2:19 Krish Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YS+vfVTV0fls6KuN@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=fmdefrancesco@gmail.com \
    --cc=hello@bryanbrattlof.com \
    --cc=krishjain02939@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).