aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2008-01-28 15:49:46 -0500
committerSam Ravnborg <sam@ravnborg.org>2008-01-28 17:21:19 -0500
commit9b3e4dad7e58405de398faa17cb4691ca85eb050 (patch)
tree3b0703f130441038b5c733426186d4c00c284862 /Documentation
parent312b1485fb509c9bc32eda28ad29537896658cb8 (diff)
kconfig: document use of HAVE_*
It has been discussed on lkml several times but we need it documented as this is new stuff. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/kbuild/kconfig-language.txt36
1 files changed, 36 insertions, 0 deletions
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt
index a43fcc68e171..649cb8799890 100644
--- a/Documentation/kbuild/kconfig-language.txt
+++ b/Documentation/kbuild/kconfig-language.txt
@@ -330,6 +330,42 @@ This is a collection of Kconfig tips, most of which aren't obvious at
330first glance and most of which have become idioms in several Kconfig 330first glance and most of which have become idioms in several Kconfig
331files. 331files.
332 332
333Adding common features and make the usage configurable
334~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
335It is a common idiom to implement a feature/functionality that are
336relevant for some architectures but not all.
337The recommended way to do so is to use a config variable named HAVE_*
338that is defined in a common Kconfig file and selected by the relevant
339architectures.
340An example is the generic IOMAP functionality.
341
342We would in lib/Kconfig see:
343
344# Generic IOMAP is used to ...
345config HAVE_GENERIC_IOMAP
346
347config GENERIC_IOMAP
348 depends on HAVE_GENERIC_IOMAP && FOO
349
350And in lib/Makefile we would see:
351obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
352
353For each architecture using the generic IOMAP functionality we would see:
354
355config X86
356 select ...
357 select HAVE_GENERIC_IOMAP
358 select ...
359
360Note: we use the existing config option and avoid creating a new
361config variable to select HAVE_GENERIC_IOMAP.
362
363Note: the use of the internal config variable HAVE_GENERIC_IOMAP, it is
364introduced to overcome the limitation of select which will force a
365config option to 'y' no matter the dependencies.
366The dependencies are moved to the symbol GENERIC_IOMAP and we avoid the
367situation where select forces a symbol equals to 'y'.
368
333Build as module only 369Build as module only
334~~~~~~~~~~~~~~~~~~~~ 370~~~~~~~~~~~~~~~~~~~~
335To restrict a component build to module-only, qualify its config symbol 371To restrict a component build to module-only, qualify its config symbol