e87d3930704351bf9d32391cb9dee78268bd3017
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / docs / manual / adding-packages-kconfig.txt
1 // -*- mode:doc; -*-
2 // vim: set syntax=asciidoc:
3
4 === Infrastructure for packages using kconfig for configuration files
5
6 A popular way for a software package to handle user-specified
7 configuration is +kconfig+. Among others, it is used by the Linux
8 kernel, Busybox, and Buildroot itself. The presence of a .config file
9 and a +menuconfig+ target are two well-known symptoms of kconfig being
10 used.
11
12 Buildroot features an infrastructure for packages that use kconfig for
13 their configuration. This infrastructure provides the necessary logic to
14 expose the package's +menuconfig+ target as +foo-menuconfig+ in
15 Buildroot, and to handle the copying back and forth of the configuration
16 file in a correct way.
17
18 The +kconfig-package+ infrastructure is based on the +generic-package+
19 infrastructure. All variables supported by +generic-package+ are
20 available in +kconfig-package+ as well. See
21 xref:generic-package-reference[] for more details.
22
23 In order to use the +kconfig-package+ infrastructure for a Buildroot
24 package, the minimally required lines in the +.mk+ file, in addition to
25 the variables required by the +generic-package+ infrastructure, are:
26
27 ------------------------------
28 FOO_KCONFIG_FILE = reference-to-source-configuration-file
29
30 $(eval $(kconfig-package))
31 ------------------------------
32
33 This snippet creates the following make targets:
34
35 * +foo-menuconfig+, which calls the package's +menuconfig+ target
36
37 * +foo-update-config+, which copies the configuration back to the source
38   configuration file.
39
40 and ensures that the source configuration file is copied to the build
41 directory at the right moment.
42
43 In addition to these minimally required lines, several optional variables can
44 be set to suit the needs of the package under consideration:
45
46 * +FOO_KCONFIG_EDITORS+: a space-separated list of kconfig editors to
47   support, for example 'menuconfig xconfig'. By default, 'menuconfig'.
48
49 * +FOO_KCONFIG_OPTS+: extra options to pass when calling the kconfig
50   editors. This may need to include '$(FOO_MAKE_OPTS)', for example. By
51   default, empty.
52
53 * +FOO_KCONFIG_FIXUP_CMDS+: a list of shell commands needed to fixup the
54   configuration file after copying it or running a kconfig editor. Such
55   commands may be needed to ensure a configuration consistent with other
56   configuration of Buildroot, for example. By default, empty.