Kernel Newbies archive on lore.kernel.org
 help / color / Atom feed
From: "Robert P. J. Day" <rpjday@crashcourse.ca>
To: Kernel Newbies <kernelnewbies@kernelnewbies.org>
Subject: first of a few questions about kbuild system
Date: Tue, 30 Jul 2019 07:09:58 -0400 (EDT)
Message-ID: <alpine.LFD.2.21.1907300653380.8637@localhost.localdomain> (raw)


  friend who is getting into kernel programming wants to submit a few
patches just to get experience contributing to kernel, and i suggested
there's always potential cleanup in the numerous Kconfig files, but i
want to make *absolutely* sure i'm giving good advice so if i could
clarify a couple things (and, yes, they look trivial, but i've been
burned before thinking things are straightforward).

  first, the doc file kconfig-language.rst proposes the equivalence
between a single "if M" conditional versus individually depending on
the same Kconfig variable in each directive:

  In practice, this is achieved by using one of the next two constructs::

  (1):
  menuconfig M
  if M
      config C1
      config C2
  endif

  (2):
  menuconfig M
  config C1
      depends on M
  config C2
      depends on M

as an example, consider this from the current version of init/Kconfig:

  menuconfig MODULES
        bool "Enable loadable module support"
        option modules
        help

        ... snip ...

  if MODULES

  ...

  config MODULE_SIG
        bool "Module signature verification"
        depends on MODULES        <---

  ...

  config MODULE_COMPRESS
        bool "Compress modules on installation"
        depends on MODULES        <---

  ... etc etc ...

  endif # MODULES

it *should* be obvious that, between "if MODULES" and the
corresponding "endif", there should be no need for an explicit
dependency on "MODULES", correct? i ask since i have vague memories of
there being some subtleties if Kbuild symbols are tristate rather than
simply bool but, in this case, since MODULES is bool, any such
dependencies should be redundant, correct? am i overlooking any
possible complications?

  as an associated (and much longer) example, in that same
init/Kconfig file:

  menuconfig EXPERT
        bool "Configure standard kernel features (expert users)"
        # Unhide debug options, to make the on-by-default options visible
        select DEBUG_KERNEL
        ... snip ...

after which there are *numerous* config options whose prompt string is
qualified with conditional "if EXPERT":

  config UID16
        bool "Enable 16-bit UID system calls" if EXPERT

all the way down to:

  # end of the "standard kernel features (expert users)" menu

  # syscall, maps, verifier
  config BPF_SYSCALL

assuming that, in the midst of all those config directives, there is
not a single directive that does *not* in some way depend on EXPERT,
could that entire section not simply be wrapped in "if EXPERT" and
"endif" as well?

  i just want to verify that i'm not overlooking, perhaps, any changes
to the Kbuild infrastructure that i'm unaware of. thanks.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                         http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publically 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=alpine.LFD.2.21.1907300653380.8637@localhost.localdomain \
    --to=rpjday@crashcourse.ca \
    --cc=kernelnewbies@kernelnewbies.org \
    /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

Kernel Newbies archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kernelnewbies/0 kernelnewbies/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kernelnewbies kernelnewbies/ https://lore.kernel.org/kernelnewbies \
		kernelnewbies@kernelnewbies.org kernelnewbies@archiver.kernel.org
	public-inbox-index kernelnewbies


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernelnewbies.kernelnewbies


AGPL code for this site: git clone https://public-inbox.org/ public-inbox