2
1

adding-packages-kconfig.txt 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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
  28. source configuration file. It is not possible to use this target
  29. when fragment files are set.
  30. * +foo-update-defconfig+, which copies the configuration back to the
  31. source configuration file. The configuration file will only list the
  32. options that differ from the default values. It is not possible to
  33. use this target when fragment files are set.
  34. and ensures that the source configuration file is copied to the build
  35. directory at the right moment.
  36. In addition to these minimally required lines, several optional variables can
  37. be set to suit the needs of the package under consideration:
  38. * +FOO_KCONFIG_EDITORS+: a space-separated list of kconfig editors to
  39. support, for example 'menuconfig xconfig'. By default, 'menuconfig'.
  40. * +FOO_KCONFIG_FRAGMENT_FILES+: a space-separated list of configuration
  41. fragment files that are merged to the main configuration file.
  42. Fragment files are typically used when there is a desire to stay in sync
  43. with an upstream (def)config file, with some minor modifications.
  44. * +FOO_KCONFIG_OPTS+: extra options to pass when calling the kconfig
  45. editors. This may need to include '$(FOO_MAKE_OPTS)', for example. By
  46. default, empty.
  47. * +FOO_KCONFIG_FIXUP_CMDS+: a list of shell commands needed to fixup the
  48. configuration file after copying it or running a kconfig editor. Such
  49. commands may be needed to ensure a configuration consistent with other
  50. configuration of Buildroot, for example. By default, empty.