README.kconfig 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. Kconfig in U-Boot
  2. =================
  3. This document describes the configuration infrastructure of U-Boot.
  4. The conventional configuration was replaced by Kconfig at v2014.10-rc1 release.
  5. Language Specification
  6. ----------------------
  7. Kconfig originates in Linux Kernel.
  8. See the file "Documentation/kbuild/kconfig*.txt" in your Linux Kernel
  9. source directory for a basic specification of Kconfig.
  10. Difference from Linux's Kconfig
  11. -------------------------------
  12. Here are some worth-mentioning configuration targets.
  13. - silentoldconfig
  14. This target updates .config, include/generated/autoconf.h and
  15. include/configs/* as in Linux. In U-Boot, it also does the following
  16. for the compatibility with the old configuration system:
  17. * create a symbolic link "arch/${ARCH}/include/asm/arch" pointing to
  18. the SoC/CPU specific header directory
  19. * create include/config.h
  20. * create include/autoconf.mk
  21. * create spl/include/autoconf.mk (SPL and TPL only)
  22. * create tpl/include/autoconf.mk (TPL only)
  23. If we could completely switch to Kconfig in a long run
  24. (i.e. remove all the include/configs/*.h), those additional processings
  25. above would be removed.
  26. - defconfig
  27. In U-Boot, "make defconfig" is a shorthand of "make sandbox_defconfig"
  28. - <board>_defconfig
  29. Now it works as in Linux.
  30. The prefixes such as "+S:" in *_defconfig are deprecated.
  31. You can simply remove the prefixes. Do not add them for new boards.
  32. - <board>_config
  33. This does not exist in Linux's Kconfig.
  34. "make <board>_config" works the same as "make <board>_defconfig".
  35. Prior to Kconfig, in U-Boot, "make <board>_config" was used for the
  36. configuration. It is still supported for backward compatibility, so
  37. we do not need to update the distro recipes.
  38. The other configuration targets work as in Linux Kernel.
  39. Migration steps to Kconfig
  40. --------------------------
  41. Prior to Kconfig, the C preprocessor based board configuration had been used
  42. in U-Boot.
  43. Although Kconfig was introduced and some configs have been moved to Kconfig,
  44. many of configs are still defined in C header files. It will take a very
  45. long term to move all of them to Kconfig. In the interim, the two different
  46. configuration infrastructures should coexist.
  47. The configuration files are generated by both Kconfig and the old preprocessor
  48. based configuration as follows:
  49. Configuration files for use in C sources
  50. - include/generated/autoconf.h (generated by Kconfig for Normal)
  51. - include/configs/<board>.h (exists for all boards)
  52. Configuration file for use in makefiles
  53. - include/config/auto.conf (generated by Kconfig)
  54. - include/autoconf.mk (generated by the old config for Normal)
  55. - spl/include/autoconfig.mk (generated by the old config for SPL)
  56. - tpl/include/autoconfig.mk (generated by the old config for TPL)
  57. When adding a new CONFIG macro, it is highly recommended to add it to Kconfig
  58. rather than to a header file.
  59. Conversion from boards.cfg to Kconfig
  60. -------------------------------------
  61. Prior to Kconfig, boards.cfg was a primary database that contained Arch, CPU,
  62. SoC, etc. of all the supported boards. It was deleted when switching to
  63. Kconfig. Each field of boards.cfg was converted as follows:
  64. Status -> "S:" entry of MAINTAINERS
  65. Arch -> CONFIG_SYS_ARCH defined by Kconfig
  66. CPU -> CONFIG_SYS_CPU defined by Kconfig
  67. SoC -> CONFIG_SYS_SOC defined by Kconfig
  68. Vendor -> CONFIG_SYS_VENDOR defined by Kconfig
  69. Board -> CONFIG_SYS_BOARD defined by Kconfig
  70. Target -> File name of defconfig (configs/<target>_defconfig)
  71. Maintainers -> "M:" entry of MAINTAINERS
  72. Tips to add/remove boards
  73. -------------------------
  74. When adding a new board, the following steps are generally needed:
  75. [1] Add a header file include/configs/<target>.h
  76. [2] Make sure to define necessary CONFIG_SYS_* in Kconfig:
  77. Define CONFIG_SYS_CPU="cpu" to compile arch/<arch>/cpu/<cpu>
  78. Define CONFIG_SYS_SOC="soc" to compile arch/<arch>/cpu/<cpu>/<soc>
  79. Define CONFIG_SYS_VENDOR="vendor" to compile board/<vendor>/common/*
  80. and board/<vendor>/<board>/*
  81. Define CONFIG_SYS_BOARD="board" to compile board/<board>/*
  82. (or board/<vendor>/<board>/* if CONFIG_SYS_VENDOR is defined)
  83. Define CONFIG_SYS_CONFIG_NAME="target" to include
  84. include/configs/<target>.h
  85. [3] Add a new entry to the board select menu in Kconfig.
  86. The board select menu is located in arch/<arch>/Kconfig or
  87. arch/<arch>/*/Kconfig.
  88. [4] Add a MAINTAINERS file
  89. It is generally placed at board/<board>/MAINTAINERS or
  90. board/<vendor>/<board>/MAINTAINERS
  91. [5] Add configs/<target>_defconfig
  92. When removing an obsolete board, the following steps are generally needed:
  93. [1] Remove configs/<target>_defconfig
  94. [2] Remove include/configs/<target>.h if it is not used by any other boards
  95. [3] Remove board/<vendor>/<board>/* or board/<board>/* if it is not used
  96. by any other boards
  97. [4] Update MAINTAINERS if necessary
  98. [5] Remove the unused entry from the board select menu in Kconfig
  99. [6] Add an entry to doc/README.scrapyard
  100. TODO
  101. ----
  102. - In the pre-Kconfig, a single board had multiple entries in the boards.cfg
  103. file with differences in the option fields. The corresponding defconfig
  104. files were auto-generated when switching to Kconfig. Now we have too many
  105. defconfig files compared with the number of the supported boards. It is
  106. recommended to have only one defconfig per board and allow users to select
  107. the config options.
  108. - Move the config macros in header files to Kconfig. When we move at least
  109. macros used in makefiles, we can drop include/autoconfig.mk, which makes
  110. the build scripts much simpler.