]> Git Repo - buildroot-mgba.git/blame - docs/manual/adding-packages-kconfig.txt
package/pkg-generic: add check that target variant is defined before host variant
[buildroot-mgba.git] / docs / manual / adding-packages-kconfig.txt
CommitLineData
e91cd290
TDS
1// -*- mode:doc; -*-
2// vim: set syntax=asciidoc:
3
4=== Infrastructure for packages using kconfig for configuration files
5
6A popular way for a software package to handle user-specified
7configuration is +kconfig+. Among others, it is used by the Linux
8kernel, Busybox, and Buildroot itself. The presence of a .config file
9and a +menuconfig+ target are two well-known symptoms of kconfig being
10used.
11
12Buildroot features an infrastructure for packages that use kconfig for
13their configuration. This infrastructure provides the necessary logic to
14expose the package's +menuconfig+ target as +foo-menuconfig+ in
15Buildroot, and to handle the copying back and forth of the configuration
16file in a correct way.
17
18The +kconfig-package+ infrastructure is based on the +generic-package+
19infrastructure. All variables supported by +generic-package+ are
20available in +kconfig-package+ as well. See
21xref:generic-package-reference[] for more details.
22
23In order to use the +kconfig-package+ infrastructure for a Buildroot
24package, the minimally required lines in the +.mk+ file, in addition to
25the variables required by the +generic-package+ infrastructure, are:
26
27------------------------------
28FOO_KCONFIG_FILE = reference-to-source-configuration-file
29
30$(eval $(kconfig-package))
31------------------------------
32
33This snippet creates the following make targets:
34
35* +foo-menuconfig+, which calls the package's +menuconfig+ target
36
0cfb5549
FB
37* +foo-update-config+, which copies the configuration back to the
38 source configuration file. It is not possible to use this target
39 when fragment files are set.
40
41* +foo-update-defconfig+, which copies the configuration back to the
42 source configuration file. The configuration file will only list the
43 options that differ from the default values. It is not possible to
44 use this target when fragment files are set.
e91cd290
TDS
45
46and ensures that the source configuration file is copied to the build
47directory at the right moment.
48
217493ee
YM
49There are two options to specify a configuration file to use, either
50+FOO_KCONFIG_FILE+ (as in the example, above) or +FOO_KCONFIG_DEFCONFIG+.
51It is mandatory to provide either, but not both:
52
53* +FOO_KCONFIG_FILE+ specifies the path to a defconfig or full-config file
54 to be used to configure the package.
55
56* +FOO_KCONFIG_DEFCONFIG+ specifies the defconfig 'make' rule to call to
57 configure the package.
58
e91cd290
TDS
59In addition to these minimally required lines, several optional variables can
60be set to suit the needs of the package under consideration:
61
62* +FOO_KCONFIG_EDITORS+: a space-separated list of kconfig editors to
63 support, for example 'menuconfig xconfig'. By default, 'menuconfig'.
64
0cfb5549
FB
65* +FOO_KCONFIG_FRAGMENT_FILES+: a space-separated list of configuration
66 fragment files that are merged to the main configuration file.
67 Fragment files are typically used when there is a desire to stay in sync
68 with an upstream (def)config file, with some minor modifications.
69
146f7dc4 70* +FOO_KCONFIG_OPTS+: extra options to pass when calling the kconfig
0518a98a 71 editors. This may need to include '$(FOO_MAKE_OPTS)', for example. By
e91cd290
TDS
72 default, empty.
73
74* +FOO_KCONFIG_FIXUP_CMDS+: a list of shell commands needed to fixup the
75 configuration file after copying it or running a kconfig editor. Such
76 commands may be needed to ensure a configuration consistent with other
77 configuration of Buildroot, for example. By default, empty.
4309092e
TP
78
79* +FOO_KCONFIG_DOTCONFIG+: path (with filename) of the +.config+ file,
80 relative to the package source tree. The default, +.config+, should
81 be well suited for all packages that use the standard kconfig
82 infrastructure as inherited from the Linux kernel; some packages use
83 a derivative of kconfig that use a different location.
This page took 0.366068 seconds and 4 git commands to generate.