adding-packages-kconfig.txt 2.3 KB

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