Blame view

doc/README.kconfig 6 KB
6933b5c9f   Masahiro Yamada   README.kconfig: a...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  Kconfig in U-Boot
  =================
  
  This document describes the configuration infrastructure of U-Boot.
  
  The conventional configuration was replaced by Kconfig at v2014.10-rc1 release.
  
  
  Language Specification
  ----------------------
  
  Kconfig originates in Linux Kernel.
  See the file "Documentation/kbuild/kconfig*.txt" in your Linux Kernel
  source directory for a basic specification of Kconfig.
  
  
  Difference from Linux's Kconfig
  -------------------------------
e02ee2548   Masahiro Yamada   kconfig: switch t...
19
  Here are some worth-mentioning configuration targets.
6933b5c9f   Masahiro Yamada   README.kconfig: a...
20

e02ee2548   Masahiro Yamada   kconfig: switch t...
21
  - silentoldconfig
6933b5c9f   Masahiro Yamada   README.kconfig: a...
22

e02ee2548   Masahiro Yamada   kconfig: switch t...
23
    This target updates .config, include/generated/autoconf.h and
c21fc7e22   Masahiro Yamada   treewide: fix "fo...
24
    include/configs/* as in Linux.  In U-Boot, it also does the following
e02ee2548   Masahiro Yamada   kconfig: switch t...
25
    for the compatibility with the old configuration system:
6933b5c9f   Masahiro Yamada   README.kconfig: a...
26

e02ee2548   Masahiro Yamada   kconfig: switch t...
27
28
29
30
31
32
     * create a symbolic link "arch/${ARCH}/include/asm/arch" pointing to
       the SoC/CPU specific header directory
     * create include/config.h
     * create include/autoconf.mk
     * create spl/include/autoconf.mk (SPL and TPL only)
     * create tpl/include/autoconf.mk (TPL only)
6933b5c9f   Masahiro Yamada   README.kconfig: a...
33

e02ee2548   Masahiro Yamada   kconfig: switch t...
34
35
36
     If we could completely switch to Kconfig in a long run
     (i.e. remove all the include/configs/*.h), those additional processings
     above would be removed.
6933b5c9f   Masahiro Yamada   README.kconfig: a...
37

e02ee2548   Masahiro Yamada   kconfig: switch t...
38
39
40
41
42
43
44
45
46
  - defconfig
  
    In U-Boot, "make defconfig" is a shorthand of "make sandbox_defconfig"
  
  - <board>_defconfig
  
    Now it works as in Linux.
    The prefixes such as "+S:" in *_defconfig are deprecated.
    You can simply remove the prefixes.  Do not add them for new boards.
6933b5c9f   Masahiro Yamada   README.kconfig: a...
47

d1b60d340   Masahiro Yamada   README.kconfig: d...
48
49
50
  - <board>_config
  
    This does not exist in Linux's Kconfig.
e02ee2548   Masahiro Yamada   kconfig: switch t...
51
    "make <board>_config" works the same as "make <board>_defconfig".
d1b60d340   Masahiro Yamada   README.kconfig: d...
52
    Prior to Kconfig, in U-Boot, "make <board>_config" was used for the
e02ee2548   Masahiro Yamada   kconfig: switch t...
53
54
55
56
57
    configuration.  It is still supported for backward compatibility, so
    we do not need to update the distro recipes.
  
  
  The other configuration targets work as in Linux Kernel.
d1b60d340   Masahiro Yamada   README.kconfig: d...
58

6933b5c9f   Masahiro Yamada   README.kconfig: a...
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
  
  Migration steps to Kconfig
  --------------------------
  
  Prior to Kconfig, the C preprocessor based board configuration had been used
  in U-Boot.
  
  Although Kconfig was introduced and some configs have been moved to Kconfig,
  many of configs are still defined in C header files.  It will take a very
  long term to move all of them to Kconfig.  In the interim, the two different
  configuration infrastructures should coexist.
  The configuration files are generated by both Kconfig and the old preprocessor
  based configuration as follows:
  
  Configuration files for use in C sources
    - include/generated/autoconf.h     (generated by Kconfig for Normal)
6933b5c9f   Masahiro Yamada   README.kconfig: a...
75
76
77
    - include/configs/<board>.h        (exists for all boards)
  
  Configuration file for use in makefiles
e02ee2548   Masahiro Yamada   kconfig: switch t...
78
    - include/config/auto.conf         (generated by Kconfig)
6933b5c9f   Masahiro Yamada   README.kconfig: a...
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
    - include/autoconf.mk              (generated by the old config for Normal)
    - spl/include/autoconfig.mk        (generated by the old config for SPL)
    - tpl/include/autoconfig.mk        (generated by the old config for TPL)
  
  When adding a new CONFIG macro, it is highly recommended to add it to Kconfig
  rather than to a header file.
  
  
  Conversion from boards.cfg to Kconfig
  -------------------------------------
  
  Prior to Kconfig, boards.cfg was a primary database that contained Arch, CPU,
  SoC, etc. of all the supported boards.  It was deleted when switching to
  Kconfig.  Each field of boards.cfg was converted as follows:
  
   Status      ->  "S:" entry of MAINTAINERS
   Arch        ->  CONFIG_SYS_ARCH defined by Kconfig
   CPU         ->  CONFIG_SYS_CPU defined by Kconfig
   SoC         ->  CONFIG_SYS_SOC defined by Kconfig
   Vendor      ->  CONFIG_SYS_VENDOR defined by Kconfig
   Board       ->  CONFIG_SYS_BOARD defined by Kconfig
   Target      ->  File name of defconfig (configs/<target>_defconfig)
   Options     ->  CONFIG_SYS_EXTRA_OPTIONS defined by Kconfig
   Maintainers ->  "M:" entry of MAINTAINERS
  
  
  Tips to add/remove boards
  -------------------------
  
  When adding a new board, the following steps are generally needed:
  
   [1] Add a header file include/configs/<target>.h
   [2] Make sure to define necessary CONFIG_SYS_* in Kconfig:
         Define CONFIG_SYS_CPU="cpu" to compile arch/<arch>/cpu/<cpu>
         Define CONFIG_SYS_SOC="soc" to compile arch/<arch>/cpu/<cpu>/<soc>
         Define CONFIG_SYS_VENDOR="vendor" to compile board/<vendor>/common/*
           and board/<vendor>/<board>/*
         Define CONFIG_SYS_BOARD="board" to compile board/<board>/*
           (or board/<vendor>/<board>/* if CONFIG_SYS_VENDOR is defined)
         Define CONFIG_SYS_CONFIG_NAME="target" to include
           include/configs/<target>.h
   [3] Add a new entry to the board select menu in Kconfig.
       The board select menu is located in arch/<arch>/Kconfig or
       arch/<arch>/*/Kconfig.
   [4] Add a MAINTAINERS file
       It is generally placed at board/<board>/MAINTAINERS or
       board/<vendor>/<board>/MAINTAINERS
   [5] Add configs/<target>_defconfig
  
  When removing an obsolete board, the following steps are generally needed:
  
   [1] Remove configs/<target>_defconfig
   [2] Remove include/configs/<target>.h if it is not used by any other boards
   [3] Remove board/<vendor>/<board>/* or board/<board>/* if it is not used
       by any other boards
   [4] Update MAINTAINERS if necessary
   [5] Remove the unused entry from the board select menu in Kconfig
   [6] Add an entry to doc/README.scrapyard
  
  
  TODO
  ----
  
  - The option field of boards.cfg, which was used for the pre-Kconfig
    configuration, moved to CONFIG_SYS_EXTRA_OPTIONS verbatim now.
    Board maintainers are expected to implement proper Kconfig options
    and switch over to them.  Eventually CONFIG_SYS_EXTRA_OPTIONS will go away.
    CONFIG_SYS_EXTRA_OPTIONS should not be used for new boards.
  
  - In the pre-Kconfig, a single board had multiple entries in the boards.cfg
e02ee2548   Masahiro Yamada   kconfig: switch t...
149
150
    file with differences in the option fields.  The corresponding defconfig
    files were auto-generated when switching to Kconfig.  Now we have too many
6933b5c9f   Masahiro Yamada   README.kconfig: a...
151
152
153
154
155
156
157
    defconfig files compared with the number of the supported boards.  It is
    recommended to have only one defconfig per board and allow users to select
    the config options.
  
  - Move the config macros in header files to Kconfig.  When we move at least
    macros used in makefiles, we can drop include/autoconfig.mk, which makes
    the build scripts much simpler.