first of a few questions about kbuild system

Robert P. J. Day rpjday at crashcourse.ca
Tue Jul 30 07:09:58 EDT 2019


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



More information about the Kernelnewbies mailing list