History

Merge tag 'kbuild-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild updates from Masahiro Yamada: - Generate a list of built DTB files (arch/*/boot/dts/dtbs-list) - Use more threads when building Debian packages in parallel - Fix warnings shown during the RPM kernel package uninstallation - Change OBJECT_FILES_NON_STANDARD_*.o etc. to take a relative path to Makefile - Support GCC's -fmin-function-alignment flag - Fix a null pointer dereference bug in modpost - Add the DTB support to the RPM package - Various fixes and cleanups in Kconfig * tag 'kbuild-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (67 commits) kconfig: tests: test dependency after shuffling choices kconfig: tests: add a test for randconfig with dependent choices kconfig: tests: support KCONFIG_SEED for the randconfig runner kbuild: rpm-pkg: add dtb files in kernel rpm kconfig: remove unneeded menu_is_visible() call in conf_write_defconfig() kconfig: check prompt for choice while parsing kconfig: lxdialog: remove unused dialog colors kconfig: lxdialog: fix button color for blackbg theme modpost: fix null pointer dereference kbuild: remove GCC's default -Wpacked-bitfield-compat flag kbuild: unexport abs_srctree and abs_objtree kbuild: Move -Wenum-{compare-conditional,enum-conversion} into W=1 kconfig: remove named choice support kconfig: use linked list in get_symbol_str() to iterate over menus kconfig: link menus to a symbol kbuild: fix inconsistent indentation in top Makefile kbuild: Use -fmin-function-alignment when available alpha: merge two entries for CONFIG_ALPHA_GAMMA alpha: merge two entries for CONFIG_ALPHA_EV4 kbuild: change DTC_FLAGS_<basetarget>.o to take the path relative to $(obj) ...

Linus Torvalds committed 2 years ago

Commit 1d35aae2 parents 88d92fb f2fd2aa69 files · +1133 −792Browse files

Unified · Split

69 files
  1. .gitignore +1 −0
  2. Documentation/kbuild/kconfig-language.rst +1 −5
  3. Documentation/kbuild/kconfig.rst +166 −197
  4. Makefile +28 −21
  5. arch/Kconfig +12 −0
  6. arch/alpha/Kconfig +4 −11
  7. arch/hexagon/Kconfig +3 −9
  8. arch/parisc/Kconfig +2 −2
  9. arch/riscv/kernel/tests/Kconfig.debug +1 −1
  10. arch/x86/entry/vdso/Makefile +2 −0
  11. arch/x86/kvm/Kconfig +1 −1
  12. arch/x86/kvm/Makefile +2 −1
  13. arch/x86/xen/Kconfig +0 −1
  14. drivers/acpi/Kconfig +0 −1
  15. drivers/iommu/intel/Kconfig +1 −1
  16. drivers/md/Kconfig +0 −1
  17. include/linux/compiler_types.h +5 −5
  18. init/Kconfig +1 −1
  19. kernel/module/Kconfig +1 −2
  20. lib/Kconfig.debug +1 −1
  21. mm/Kconfig +3 −4
  22. net/dccp/ccids/Kconfig +1 −1
  23. rust/Makefile +2 −2
  24. scripts/Kbuild.include +0 −6
  25. scripts/Makefile.build +13 −9
  26. scripts/Makefile.dtbinst +18 −14
  27. scripts/Makefile.extrawarn +2 −1
  28. scripts/Makefile.lib +16 −10
  29. scripts/Makefile.package +1 −1
  30. scripts/kconfig/array_size.h +11 −0
  31. scripts/kconfig/conf.c +6 −6
  32. scripts/kconfig/confdata.c +18 −78
  33. scripts/kconfig/expr.h +11 −18
  34. scripts/kconfig/hashtable.h +48 −0
  35. scripts/kconfig/internal.h +12 −0
  36. scripts/kconfig/lexer.l +61 −69
  37. scripts/kconfig/list.h +189 −65
  38. scripts/kconfig/list_types.h +17 −0
  39. scripts/kconfig/lkc.h +3 −3
  40. scripts/kconfig/lkc_proto.h +0 −15
  41. scripts/kconfig/lxdialog/checklist.c +2 −3
  42. scripts/kconfig/lxdialog/dialog.h +0 −4
  43. scripts/kconfig/lxdialog/util.c +1 −19
  44. scripts/kconfig/mconf.c +1 −0
  45. scripts/kconfig/menu.c +20 −28
  46. scripts/kconfig/nconf.c +1 −0
  47. scripts/kconfig/parser.y +76 −49
  48. scripts/kconfig/preprocess.c +13 −10
  49. scripts/kconfig/preprocess.h +19 −0
  50. scripts/kconfig/qconf.cc +1 −1
  51. scripts/kconfig/symbol.c +22 −27
  52. scripts/kconfig/tests/choice_randomize/Kconfig +22 −0
  53. scripts/kconfig/tests/choice_randomize/__init__.py +34 −0
  54. scripts/kconfig/tests/choice_randomize/expected_config0 +6 −0
  55. scripts/kconfig/tests/choice_randomize/expected_config1 +8 −0
  56. scripts/kconfig/tests/choice_randomize/expected_config2 +8 −0
  57. scripts/kconfig/tests/choice_randomize2/Kconfig +32 −0
  58. scripts/kconfig/tests/choice_randomize2/__init__.py +18 −0
  59. scripts/kconfig/tests/choice_randomize2/expected_config0 +8 −0
  60. scripts/kconfig/tests/choice_randomize2/expected_config1 +7 −0
  61. scripts/kconfig/tests/choice_randomize2/expected_config2 +6 −0
  62. scripts/kconfig/tests/conftest.py +10 −6
  63. scripts/kconfig/tests/err_recursive_dep/expected_stderr +11 −11
  64. scripts/kconfig/util.c +36 −11
  65. scripts/mod/modpost.c +3 −1
  66. scripts/package/builddeb +12 −38
  67. scripts/package/debian/rules +54 −9
  68. scripts/package/kernel.spec +37 −11
  69. tools/lib/bpf/Makefile +1 −1
.gitignore+1−0
@@ -52,6 +52,7 @@ · 51 unmodified lines
52*.xz52*.xz
53*.zst53*.zst
54Module.symvers54Module.symvers
55dtbs-list
55modules.order56modules.order
56 57
57#58#
Documentation/kbuild/kconfig-language.rst+1−5
@@ -393,7 +393,7 @@ of C0, which doesn't depend on M:: · 392 unmodified lines
393 393
394choices::394choices::
395 395
396 "choice" [symbol]396 "choice"
397 <choice options>397 <choice options>
398 <choice block>398 <choice block>
399 "endchoice"399 "endchoice"
@@ -412,10 +412,6 @@ the kernel, but all drivers can be compiled as modules. · 12 unmodified lines
412 412
413A choice accepts another option "optional", which allows to set the413A choice accepts another option "optional", which allows to set the
414choice to 'n' and no entry needs to be selected.414choice to 'n' and no entry needs to be selected.
415If no [symbol] is associated with a choice, then you can not have multiple
416definitions of that choice. If a [symbol] is associated to the choice,
417then you may define the same choice (i.e. with the same entries) in another
418place.
419 415
420comment::416comment::
421 417
Documentation/kbuild/kconfig.rst+166−197
@@ -1,10 +1,10 @@
1===================1=================================
2Kconfig make config2Configuration targets and editors
3===================3=================================
4 4
5This file contains some assistance for using `make *config`.5This file contains some assistance for using ``make *config``.
6 6
7Use "make help" to list all of the possible configuration targets.7Use ``make help`` to list all of the possible configuration targets.
8 8
9The xconfig ('qconf'), menuconfig ('mconf'), and nconfig ('nconf')9The xconfig ('qconf'), menuconfig ('mconf'), and nconfig ('nconf')
10programs also have embedded help text. Be sure to check that for10programs also have embedded help text. Be sure to check that for
@@ -12,8 +12,9 @@ navigation, search, and other general help text. · 1 unmodified line
12 12
13The gconfig ('gconf') program has limited help text.13The gconfig ('gconf') program has limited help text.
14 14
15
15General16General
16-------17=======
17 18
18New kernel releases often introduce new config symbols. Often more19New kernel releases often introduce new config symbols. Often more
19important, new kernel releases may rename config symbols. When20important, new kernel releases may rename config symbols. When
@@ -24,118 +25,102 @@ symbols have been introduced. · 4 unmodified lines
24 25
25To see a list of new config symbols, use::26To see a list of new config symbols, use::
26 27
27 cp user/some/old.config .config28 cp user/some/old.config .config
28 make listnewconfig29 make listnewconfig
29 30
30and the config program will list any new symbols, one per line.31and the config program will list any new symbols, one per line.
31 32
32Alternatively, you can use the brute force method::33Alternatively, you can use the brute force method::
33 34
34 make oldconfig35 make oldconfig
35 scripts/diffconfig .config.old .config | less36 scripts/diffconfig .config.old .config | less
36
37----------------------------------------------------------------------
38
39Environment variables for `*config`
40 37
41KCONFIG_CONFIG
42--------------
43This environment variable can be used to specify a default kernel config
44file name to override the default name of ".config".
45 38
46KCONFIG_DEFCONFIG_LIST39Environment variables
47----------------------40=====================
48 41
49This environment variable specifies a list of config files which can be used42Environment variables for ``*config``:
50as a base configuration in case the .config does not exist yet. Entries in
51the list are separated with whitespaces to each other, and the first one
52that exists is used.
53 43
54KCONFIG_OVERWRITECONFIG44``KCONFIG_CONFIG``
55-----------------------45 This environment variable can be used to specify a default kernel config
56If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not46 file name to override the default name of ".config".
57break symlinks when .config is a symlink to somewhere else.
58 47
59KCONFIG_WARN_UNKNOWN_SYMBOLS48``KCONFIG_DEFCONFIG_LIST``
60----------------------------49 This environment variable specifies a list of config files which can be
61This environment variable makes Kconfig warn about all unrecognized50 used as a base configuration in case the .config does not exist yet.
62symbols in the config input.51 Entries in the list are separated with whitespaces to each other, and
52 the first one that exists is used.
63 53
64KCONFIG_WERROR54``KCONFIG_OVERWRITECONFIG``
65--------------55 If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not
66If set, Kconfig treats warnings as errors.56 break symlinks when .config is a symlink to somewhere else.
67 57
68`CONFIG_`58``KCONFIG_WARN_UNKNOWN_SYMBOLS``
69---------59 This environment variable makes Kconfig warn about all unrecognized
70If you set `CONFIG_` in the environment, Kconfig will prefix all symbols60 symbols in the config input.
71with its value when saving the configuration, instead of using the default,
72`CONFIG_`.
73 61
74----------------------------------------------------------------------62``KCONFIG_WERROR``
63 If set, Kconfig treats warnings as errors.
75 64
76Environment variables for '{allyes/allmod/allno/rand}config'65``CONFIG_``
66 If you set ``CONFIG_`` in the environment, Kconfig will prefix all symbols
67 with its value when saving the configuration, instead of using the
68 default, ``CONFIG_``.
77 69
78KCONFIG_ALLCONFIG70Environment variables for ``{allyes/allmod/allno/rand}config``:
79-----------------
80(partially based on lkml email from/by Rob Landley, re: miniconfig)
81 71
82--------------------------------------------------72``KCONFIG_ALLCONFIG``
73 The allyesconfig/allmodconfig/allnoconfig/randconfig variants can also
74 use the environment variable KCONFIG_ALLCONFIG as a flag or a filename
75 that contains config symbols that the user requires to be set to a
76 specific value. If KCONFIG_ALLCONFIG is used without a filename where
77 KCONFIG_ALLCONFIG == "" or KCONFIG_ALLCONFIG == "1", ``make *config``
78 checks for a file named "all{yes/mod/no/def/random}.config"
79 (corresponding to the ``*config`` command that was used) for symbol values
80 that are to be forced. If this file is not found, it checks for a
81 file named "all.config" to contain forced values.
83 82
84The allyesconfig/allmodconfig/allnoconfig/randconfig variants can also83 This enables you to create "miniature" config (miniconfig) or custom
85use the environment variable KCONFIG_ALLCONFIG as a flag or a filename84 config files containing just the config symbols that you are interested
86that contains config symbols that the user requires to be set to a85 in. Then the kernel config system generates the full .config file,
87specific value. If KCONFIG_ALLCONFIG is used without a filename where86 including symbols of your miniconfig file.
88KCONFIG_ALLCONFIG == "" or KCONFIG_ALLCONFIG == "1", `make *config`
89checks for a file named "all{yes/mod/no/def/random}.config"
90(corresponding to the `*config` command that was used) for symbol values
91that are to be forced. If this file is not found, it checks for a
92file named "all.config" to contain forced values.
93 87
94This enables you to create "miniature" config (miniconfig) or custom88 This ``KCONFIG_ALLCONFIG`` file is a config file which contains
95config files containing just the config symbols that you are interested89 (usually a subset of all) preset config symbols. These variable
96in. Then the kernel config system generates the full .config file,90 settings are still subject to normal dependency checks.
97including symbols of your miniconfig file.
98
99This 'KCONFIG_ALLCONFIG' file is a config file which contains
100(usually a subset of all) preset config symbols. These variable
101settings are still subject to normal dependency checks.
102
103Examples::
104 91
105 KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfig92 Examples::
106 93
107or::94 KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfig
108 95
109 KCONFIG_ALLCONFIG=mini.config make allnoconfig96 or::
110 97
111or::98 KCONFIG_ALLCONFIG=mini.config make allnoconfig
112 99
113 make KCONFIG_ALLCONFIG=mini.config allnoconfig100 or::
114 101
115These examples will disable most options (allnoconfig) but enable or102 make KCONFIG_ALLCONFIG=mini.config allnoconfig
116disable the options that are explicitly listed in the specified
117mini-config files.
118 103
119----------------------------------------------------------------------104 These examples will disable most options (allnoconfig) but enable or
105 disable the options that are explicitly listed in the specified
106 mini-config files.
120 107
121Environment variables for 'randconfig'108Environment variables for ``randconfig``:
122 109
123KCONFIG_SEED110``KCONFIG_SEED``
124------------111 You can set this to the integer value used to seed the RNG, if you want
125You can set this to the integer value used to seed the RNG, if you want112 to somehow debug the behaviour of the kconfig parser/frontends.
126to somehow debug the behaviour of the kconfig parser/frontends.113 If not set, the current time will be used.
127If not set, the current time will be used.
128 114
129KCONFIG_PROBABILITY115``KCONFIG_PROBABILITY``
130-------------------116 This variable can be used to skew the probabilities. This variable can
131This variable can be used to skew the probabilities. This variable can117 be unset or empty, or set to three different formats:
132be unset or empty, or set to three different formats:
133 118
134 ======================= ================== =====================119 ======================= ================== =====================
135 KCONFIG_PROBABILITY y:n split y:m:n split120 KCONFIG_PROBABILITY y:n split y:m:n split
136 ======================= ================== =====================121 ======================= ================== =====================
137 unset or empty 50 : 50 33 : 33 : 34122 unset or empty 50 : 50 33 : 33 : 34
138 N N : 100-N N/2 : N/2 : 100-N123 N N : 100-N N/2 : N/2 : 100-N
139 [1] N:M N+M : 100-(N+M) N : M : 100-(N+M)124 [1] N:M N+M : 100-(N+M) N : M : 100-(N+M)
140 [2] N:M:L N : 100-N M : L : 100-(M+L)125 [2] N:M:L N : 100-N M : L : 100-(M+L)
141 ======================= ================== =====================126 ======================= ================== =====================
@@ -149,112 +134,98 @@ that: · 7 unmodified lines
149 134
150Examples::135Examples::
151 136
152 KCONFIG_PROBABILITY=10137 KCONFIG_PROBABILITY=10
153 10% of booleans will be set to 'y', 90% to 'n'138 10% of booleans will be set to 'y', 90% to 'n'
154 5% of tristates will be set to 'y', 5% to 'm', 90% to 'n'139 5% of tristates will be set to 'y', 5% to 'm', 90% to 'n'
155 KCONFIG_PROBABILITY=15:25140 KCONFIG_PROBABILITY=15:25
156 40% of booleans will be set to 'y', 60% to 'n'141 40% of booleans will be set to 'y', 60% to 'n'
157 15% of tristates will be set to 'y', 25% to 'm', 60% to 'n'142 15% of tristates will be set to 'y', 25% to 'm', 60% to 'n'
158 KCONFIG_PROBABILITY=10:15:15143 KCONFIG_PROBABILITY=10:15:15
159 10% of booleans will be set to 'y', 90% to 'n'144 10% of booleans will be set to 'y', 90% to 'n'
160 15% of tristates will be set to 'y', 15% to 'm', 70% to 'n'145 15% of tristates will be set to 'y', 15% to 'm', 70% to 'n'
161 146
162----------------------------------------------------------------------147Environment variables for ``syncconfig``:
163 148
164Environment variables for 'syncconfig'149``KCONFIG_NOSILENTUPDATE``
150 If this variable has a non-blank value, it prevents silent kernel
151 config updates (requires explicit updates).
165 152
166KCONFIG_NOSILENTUPDATE153``KCONFIG_AUTOCONFIG``
167----------------------154 This environment variable can be set to specify the path & name of the
168If this variable has a non-blank value, it prevents silent kernel155 "auto.conf" file. Its default value is "include/config/auto.conf".
169config updates (requires explicit updates).
170 156
171KCONFIG_AUTOCONFIG157``KCONFIG_AUTOHEADER``
172------------------158 This environment variable can be set to specify the path & name of the
173This environment variable can be set to specify the path & name of the159 "autoconf.h" (header) file.
174"auto.conf" file. Its default value is "include/config/auto.conf".160 Its default value is "include/generated/autoconf.h".
175 161
176KCONFIG_AUTOHEADER
177------------------
178This environment variable can be set to specify the path & name of the
179"autoconf.h" (header) file.
180Its default value is "include/generated/autoconf.h".
181
182
183----------------------------------------------------------------------
184 162
185menuconfig163menuconfig
186----------164==========
187
188SEARCHING for CONFIG symbols
189 165
190Searching in menuconfig:166Searching in menuconfig:
191 167
192 The Search function searches for kernel configuration symbol168 The Search function searches for kernel configuration symbol
193 names, so you have to know something close to what you are169 names, so you have to know something close to what you are
194 looking for.170 looking for.
195 171
196 Example::172 Example::
197 173
198 /hotplug174 /hotplug
199 This lists all config symbols that contain "hotplug",175 This lists all config symbols that contain "hotplug",
200 e.g., HOTPLUG_CPU, MEMORY_HOTPLUG.176 e.g., HOTPLUG_CPU, MEMORY_HOTPLUG.
201 177
202 For search help, enter / followed by TAB-TAB (to highlight178 For search help, enter / followed by TAB-TAB (to highlight
203 <Help>) and Enter. This will tell you that you can also use179 <Help>) and Enter. This will tell you that you can also use
204 regular expressions (regexes) in the search string, so if you180 regular expressions (regexes) in the search string, so if you
205 are not interested in MEMORY_HOTPLUG, you could try::181 are not interested in MEMORY_HOTPLUG, you could try::
206 182
207 /^hotplug183 /^hotplug
208 184
209 When searching, symbols are sorted thus:185 When searching, symbols are sorted thus:
210 186
211 - first, exact matches, sorted alphabetically (an exact match187 - first, exact matches, sorted alphabetically (an exact match
212 is when the search matches the complete symbol name);188 is when the search matches the complete symbol name);
213 - then, other matches, sorted alphabetically.189 - then, other matches, sorted alphabetically.
214 190
215 For example: ^ATH.K matches:191 For example, ^ATH.K matches:
216 192
217 ATH5K ATH9K ATH5K_AHB ATH5K_DEBUG [...] ATH6KL ATH6KL_DEBUG193 ATH5K ATH9K ATH5K_AHB ATH5K_DEBUG [...] ATH6KL ATH6KL_DEBUG
218 [...] ATH9K_AHB ATH9K_BTCOEX_SUPPORT ATH9K_COMMON [...]194 [...] ATH9K_AHB ATH9K_BTCOEX_SUPPORT ATH9K_COMMON [...]
219 195
220 of which only ATH5K and ATH9K match exactly and so are sorted196 of which only ATH5K and ATH9K match exactly and so are sorted
221 first (and in alphabetical order), then come all other symbols,197 first (and in alphabetical order), then come all other symbols,
222 sorted in alphabetical order.198 sorted in alphabetical order.
223 199
224 In this menu, pressing the key in the (#) prefix will jump200 In this menu, pressing the key in the (#) prefix will jump
225 directly to that location. You will be returned to the current201 directly to that location. You will be returned to the current
226 search results after exiting this new menu.202 search results after exiting this new menu.
227 203
228----------------------------------------------------------------------204User interface options for 'menuconfig':
229 205
230User interface options for 'menuconfig'206``MENUCONFIG_COLOR``
207 It is possible to select different color themes using the variable
208 MENUCONFIG_COLOR. To select a theme use::
231 209
232MENUCONFIG_COLOR210 make MENUCONFIG_COLOR=<theme> menuconfig
233----------------
234It is possible to select different color themes using the variable
235MENUCONFIG_COLOR. To select a theme use::
236 211
237 make MENUCONFIG_COLOR=<theme> menuconfig212 Available themes are::
238 213
239Available themes are::214 - mono => selects colors suitable for monochrome displays
215 - blackbg => selects a color scheme with black background
216 - classic => theme with blue background. The classic look
217 - bluetitle => a LCD friendly version of classic. (default)
240 218
241 - mono => selects colors suitable for monochrome displays219``MENUCONFIG_MODE``
242 - blackbg => selects a color scheme with black background220 This mode shows all sub-menus in one large tree.
243 - classic => theme with blue background. The classic look
244 - bluetitle => a LCD friendly version of classic. (default)
245 221
246MENUCONFIG_MODE222 Example::
247---------------
248This mode shows all sub-menus in one large tree.
249 223
250Example::224 make MENUCONFIG_MODE=single_menu menuconfig
251 225
252 make MENUCONFIG_MODE=single_menu menuconfig
253
254----------------------------------------------------------------------
255 226
256nconfig227nconfig
257-------228=======
258 229
259nconfig is an alternate text-based configurator. It lists function230nconfig is an alternate text-based configurator. It lists function
260keys across the bottom of the terminal (window) that execute commands.231keys across the bottom of the terminal (window) that execute commands.
@@ -266,61 +237,59 @@ Use F1 for Global help or F3 for the Short help menu. · 5 unmodified lines
266 237
267Searching in nconfig:238Searching in nconfig:
268 239
269 You can search either in the menu entry "prompt" strings240 You can search either in the menu entry "prompt" strings
270 or in the configuration symbols.241 or in the configuration symbols.
242
243 Use / to begin a search through the menu entries. This does
244 not support regular expressions. Use <Down> or <Up> for
245 Next hit and Previous hit, respectively. Use <Esc> to
246 terminate the search mode.
271 247
272 Use / to begin a search through the menu entries. This does248 F8 (SymSearch) searches the configuration symbols for the
273 not support regular expressions. Use <Down> or <Up> for249 given string or regular expression (regex).
274 Next hit and Previous hit, respectively. Use <Esc> to
275 terminate the search mode.
276 250
277 F8 (SymSearch) searches the configuration symbols for the251 In the SymSearch, pressing the key in the (#) prefix will
278 given string or regular expression (regex).252 jump directly to that location. You will be returned to the
253 current search results after exiting this new menu.
279 254
280 In the SymSearch, pressing the key in the (#) prefix will255Environment variables:
281 jump directly to that location. You will be returned to the
282 current search results after exiting this new menu.
283 256
284NCONFIG_MODE257``NCONFIG_MODE``
285------------258 This mode shows all sub-menus in one large tree.
286This mode shows all sub-menus in one large tree.
287 259
288Example::260 Example::
289 261
290 make NCONFIG_MODE=single_menu nconfig262 make NCONFIG_MODE=single_menu nconfig
291 263
292----------------------------------------------------------------------
293 264
294xconfig265xconfig
295-------266=======
296 267
297Searching in xconfig:268Searching in xconfig:
298 269
299 The Search function searches for kernel configuration symbol270 The Search function searches for kernel configuration symbol
300 names, so you have to know something close to what you are271 names, so you have to know something close to what you are
301 looking for.272 looking for.
302
303 Example::
304 273
305 Ctrl-F hotplug274 Example::
306 275
307 or::276 Ctrl-F hotplug
308 277
309 Menu: File, Search, hotplug278 or::
310 279
311 lists all config symbol entries that contain "hotplug" in280 Menu: File, Search, hotplug
312 the symbol name. In this Search dialog, you may change the
313 config setting for any of the entries that are not grayed out.
314 You can also enter a different search string without having
315 to return to the main menu.
316 281
282 lists all config symbol entries that contain "hotplug" in
283 the symbol name. In this Search dialog, you may change the
284 config setting for any of the entries that are not grayed out.
285 You can also enter a different search string without having
286 to return to the main menu.
317 287
318----------------------------------------------------------------------
319 288
320gconfig289gconfig
321-------290=======
322 291
323Searching in gconfig:292Searching in gconfig:
324 293
325 There is no search command in gconfig. However, gconfig does294 There is no search command in gconfig. However, gconfig does
326 have several different viewing choices, modes, and options.295 have several different viewing choices, modes, and options.
Makefile+28−21
@@ -39,8 +39,8 @@ __all: · 38 unmodified lines
39# prepare rule.39# prepare rule.
40 40
41this-makefile := $(lastword $(MAKEFILE_LIST))41this-makefile := $(lastword $(MAKEFILE_LIST))
42export abs_srctree := $(realpath $(dir $(this-makefile)))42abs_srctree := $(realpath $(dir $(this-makefile)))
43export abs_objtree := $(CURDIR)43abs_objtree := $(CURDIR)
44 44
45ifneq ($(sub_make_done),1)45ifneq ($(sub_make_done),1)
46 46
@@ -295,51 +295,51 @@ single-build := · 248 unmodified lines
295 295
296ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)296ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
297 ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)297 ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
298 need-config :=298 need-config :=
299 endif299 endif
300endif300endif
301 301
302ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)302ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)
303 ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)303 ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
304 may-sync-config :=304 may-sync-config :=
305 endif305 endif
306endif306endif
307 307
308need-compiler := $(may-sync-config)308need-compiler := $(may-sync-config)
309 309
310ifneq ($(KBUILD_EXTMOD),)310ifneq ($(KBUILD_EXTMOD),)
311 may-sync-config :=311 may-sync-config :=
312endif312endif
313 313
314ifeq ($(KBUILD_EXTMOD),)314ifeq ($(KBUILD_EXTMOD),)
315 ifneq ($(filter %config,$(MAKECMDGOALS)),)315 ifneq ($(filter %config,$(MAKECMDGOALS)),)
316 config-build := 1316 config-build := 1
317 ifneq ($(words $(MAKECMDGOALS)),1)317 ifneq ($(words $(MAKECMDGOALS)),1)
318 mixed-build := 1318 mixed-build := 1
319 endif
320 endif319 endif
320 endif
321endif321endif
322 322
323# We cannot build single targets and the others at the same time323# We cannot build single targets and the others at the same time
324ifneq ($(filter $(single-targets), $(MAKECMDGOALS)),)324ifneq ($(filter $(single-targets), $(MAKECMDGOALS)),)
325 single-build := 1325 single-build := 1
326 ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),)326 ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),)
327 mixed-build := 1327 mixed-build := 1
328 endif328 endif
329endif329endif
330 330
331# For "make -j clean all", "make -j mrproper defconfig all", etc.331# For "make -j clean all", "make -j mrproper defconfig all", etc.
332ifneq ($(filter $(clean-targets),$(MAKECMDGOALS)),)332ifneq ($(filter $(clean-targets),$(MAKECMDGOALS)),)
333 ifneq ($(filter-out $(clean-targets),$(MAKECMDGOALS)),)333 ifneq ($(filter-out $(clean-targets),$(MAKECMDGOALS)),)
334 mixed-build := 1334 mixed-build := 1
335 endif335 endif
336endif336endif
337 337
338# install and modules_install need also be processed one by one338# install and modules_install need also be processed one by one
339ifneq ($(filter install,$(MAKECMDGOALS)),)339ifneq ($(filter install,$(MAKECMDGOALS)),)
340 ifneq ($(filter modules_install,$(MAKECMDGOALS)),)340 ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
341 mixed-build := 1341 mixed-build := 1
342 endif342 endif
343endif343endif
344 344
345ifdef mixed-build345ifdef mixed-build
@@ -965,8 +965,15 @@ export CC_FLAGS_CFI · 619 unmodified lines
965endif965endif
966 966
967ifneq ($(CONFIG_FUNCTION_ALIGNMENT),0)967ifneq ($(CONFIG_FUNCTION_ALIGNMENT),0)
968# Set the minimal function alignment. Use the newer GCC option
969# -fmin-function-alignment if it is available, or fall back to -falign-funtions.
970# See also CONFIG_CC_HAS_SANE_FUNCTION_ALIGNMENT.
971ifdef CONFIG_CC_HAS_MIN_FUNCTION_ALIGNMENT
972KBUILD_CFLAGS += -fmin-function-alignment=$(CONFIG_FUNCTION_ALIGNMENT)
973else
968KBUILD_CFLAGS += -falign-functions=$(CONFIG_FUNCTION_ALIGNMENT)974KBUILD_CFLAGS += -falign-functions=$(CONFIG_FUNCTION_ALIGNMENT)
969endif975endif
976endif
970 977
971# arch Makefile may override CC so keep this after arch Makefile is included978# arch Makefile may override CC so keep this after arch Makefile is included
972NOSTDINC_FLAGS += -nostdinc979NOSTDINC_FLAGS += -nostdinc
@@ -1384,7 +1391,7 @@ ifneq ($(dtstree),) · 411 unmodified lines
1384 1391
1385PHONY += dtbs dtbs_prepare dtbs_install dtbs_check1392PHONY += dtbs dtbs_prepare dtbs_install dtbs_check
1386dtbs: dtbs_prepare1393dtbs: dtbs_prepare
1387 $(Q)$(MAKE) $(build)=$(dtstree)1394 $(Q)$(MAKE) $(build)=$(dtstree) need-dtbslist=1
1388 1395
1389# include/config/kernel.release is actually needed when installing DTBs because1396# include/config/kernel.release is actually needed when installing DTBs because
1390# INSTALL_DTBS_PATH contains $(KERNELRELEASE). However, we do not want to make1397# INSTALL_DTBS_PATH contains $(KERNELRELEASE). However, we do not want to make
@@ -1402,7 +1409,7 @@ endif · 11 unmodified lines
1402dtbs_check: dtbs1409dtbs_check: dtbs
1403 1410
1404dtbs_install:1411dtbs_install:
1405 $(Q)$(MAKE) $(dtbinst)=$(dtstree) dst=$(INSTALL_DTBS_PATH)1412 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.dtbinst obj=$(dtstree)
1406 1413
1407ifdef CONFIG_OF_EARLY_FLATTREE1414ifdef CONFIG_OF_EARLY_FLATTREE
1408all: dtbs1415all: dtbs
@@ -1923,7 +1930,7 @@ clean: $(clean-dirs) · 514 unmodified lines
1923 -o -name '*.ko.*' \1930 -o -name '*.ko.*' \
1924 -o -name '*.dtb' -o -name '*.dtbo' \1931 -o -name '*.dtb' -o -name '*.dtbo' \
1925 -o -name '*.dtb.S' -o -name '*.dtbo.S' \1932 -o -name '*.dtb.S' -o -name '*.dtbo.S' \
1926 -o -name '*.dt.yaml' \1933 -o -name '*.dt.yaml' -o -name 'dtbs-list' \
1927 -o -name '*.dwo' -o -name '*.lst' \1934 -o -name '*.dwo' -o -name '*.lst' \
1928 -o -name '*.su' -o -name '*.mod' \1935 -o -name '*.su' -o -name '*.mod' \
1929 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \1936 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
arch/Kconfig+12−0
@@ -1597,4 +1597,16 @@ config FUNCTION_ALIGNMENT · 1596 unmodified lines
1597 default 4 if FUNCTION_ALIGNMENT_4B1597 default 4 if FUNCTION_ALIGNMENT_4B
1598 default 01598 default 0
1599 1599
1600config CC_HAS_MIN_FUNCTION_ALIGNMENT
1601 # Detect availability of the GCC option -fmin-function-alignment which
1602 # guarantees minimal alignment for all functions, unlike
1603 # -falign-functions which the compiler ignores for cold functions.
1604 def_bool $(cc-option, -fmin-function-alignment=8)
1605
1606config CC_HAS_SANE_FUNCTION_ALIGNMENT
1607 # Set if the guaranteed alignment with -fmin-function-alignment is
1608 # available or extra care is required in the kernel. Clang provides
1609 # strict alignment always, even with -falign-functions.
1610 def_bool CC_HAS_MIN_FUNCTION_ALIGNMENT || CC_IS_CLANG
1611
1600endmenu1612endmenu
arch/alpha/Kconfig+4−11
@@ -339,6 +339,7 @@ config ALPHA_EV4 · 338 unmodified lines
339 bool339 bool
340 depends on ALPHA_JENSEN || (ALPHA_SABLE && !ALPHA_GAMMA) || ALPHA_LYNX || ALPHA_NORITAKE && !ALPHA_PRIMO || ALPHA_MIKASA && !ALPHA_PRIMO || ALPHA_CABRIOLET || ALPHA_AVANTI_CH || ALPHA_EB64P_CH || ALPHA_XL || ALPHA_NONAME || ALPHA_EB66 || ALPHA_EB66P || ALPHA_P2K340 depends on ALPHA_JENSEN || (ALPHA_SABLE && !ALPHA_GAMMA) || ALPHA_LYNX || ALPHA_NORITAKE && !ALPHA_PRIMO || ALPHA_MIKASA && !ALPHA_PRIMO || ALPHA_CABRIOLET || ALPHA_AVANTI_CH || ALPHA_EB64P_CH || ALPHA_XL || ALPHA_NONAME || ALPHA_EB66 || ALPHA_EB66P || ALPHA_P2K
341 default y if !ALPHA_LYNX341 default y if !ALPHA_LYNX
342 default y if !ALPHA_EV5
342 343
343config ALPHA_LCA344config ALPHA_LCA
344 bool345 bool
@@ -366,10 +367,6 @@ config ALPHA_EV5 · 21 unmodified lines
366 bool "EV5 CPU(s) (model 5/xxx)?" if ALPHA_LYNX367 bool "EV5 CPU(s) (model 5/xxx)?" if ALPHA_LYNX
367 default y if ALPHA_RX164 || ALPHA_RAWHIDE || ALPHA_MIATA || ALPHA_LX164 || ALPHA_SX164 || ALPHA_RUFFIAN || ALPHA_SABLE && ALPHA_GAMMA || ALPHA_NORITAKE && ALPHA_PRIMO || ALPHA_MIKASA && ALPHA_PRIMO || ALPHA_PC164 || ALPHA_TAKARA || ALPHA_EB164 || ALPHA_ALCOR368 default y if ALPHA_RX164 || ALPHA_RAWHIDE || ALPHA_MIATA || ALPHA_LX164 || ALPHA_SX164 || ALPHA_RUFFIAN || ALPHA_SABLE && ALPHA_GAMMA || ALPHA_NORITAKE && ALPHA_PRIMO || ALPHA_MIKASA && ALPHA_PRIMO || ALPHA_PC164 || ALPHA_TAKARA || ALPHA_EB164 || ALPHA_ALCOR
368 369
369config ALPHA_EV4
370 bool
371 default y if ALPHA_LYNX && !ALPHA_EV5
372
373config ALPHA_CIA370config ALPHA_CIA
374 bool371 bool
375 depends on ALPHA_MIATA || ALPHA_LX164 || ALPHA_SX164 || ALPHA_RUFFIAN || ALPHA_NORITAKE && ALPHA_PRIMO || ALPHA_MIKASA && ALPHA_PRIMO || ALPHA_PC164 || ALPHA_TAKARA || ALPHA_EB164 || ALPHA_ALCOR372 depends on ALPHA_MIATA || ALPHA_LX164 || ALPHA_SX164 || ALPHA_RUFFIAN || ALPHA_NORITAKE && ALPHA_PRIMO || ALPHA_MIKASA && ALPHA_PRIMO || ALPHA_PC164 || ALPHA_TAKARA || ALPHA_EB164 || ALPHA_ALCOR
@@ -394,16 +391,12 @@ config ALPHA_PRIMO · 18 unmodified lines
394 Say Y if you have an AS 1000 5/xxx or an AS 1000A 5/xxx.391 Say Y if you have an AS 1000 5/xxx or an AS 1000A 5/xxx.
395 392
396config ALPHA_GAMMA393config ALPHA_GAMMA
397 bool "EV5 CPU(s) (model 5/xxx)?"394 bool "EV5 CPU(s) (model 5/xxx)?" if ALPHA_SABLE
398 depends on ALPHA_SABLE395 depends on ALPHA_SABLE || ALPHA_LYNX
396 default ALPHA_LYNX
399 help397 help
400 Say Y if you have an AS 2000 5/xxx or an AS 2100 5/xxx.398 Say Y if you have an AS 2000 5/xxx or an AS 2100 5/xxx.
401 399
402config ALPHA_GAMMA
403 bool
404 depends on ALPHA_LYNX
405 default y
406
407config ALPHA_T2400config ALPHA_T2
408 bool401 bool
409 depends on ALPHA_SABLE || ALPHA_LYNX402 depends on ALPHA_SABLE || ALPHA_LYNX
arch/hexagon/Kconfig+3−9
@@ -7,11 +7,13 @@ config HEXAGON · 6 unmodified lines
7 select ARCH_32BIT_OFF_T7 select ARCH_32BIT_OFF_T
8 select ARCH_HAS_SYNC_DMA_FOR_DEVICE8 select ARCH_HAS_SYNC_DMA_FOR_DEVICE
9 select ARCH_NO_PREEMPT9 select ARCH_NO_PREEMPT
10 select ARCH_WANT_FRAME_POINTERS
10 select DMA_GLOBAL_POOL11 select DMA_GLOBAL_POOL
11 select HAVE_PAGE_SIZE_4KB12 select HAVE_PAGE_SIZE_4KB
12 select HAVE_PAGE_SIZE_16KB13 select HAVE_PAGE_SIZE_16KB
13 select HAVE_PAGE_SIZE_64KB14 select HAVE_PAGE_SIZE_64KB
14 select HAVE_PAGE_SIZE_256KB15 select HAVE_PAGE_SIZE_256KB
16 select FRAME_POINTER
15 # Other pending projects/to-do items.17 # Other pending projects/to-do items.
16 # select HAVE_REGS_AND_STACK_ACCESS_API18 # select HAVE_REGS_AND_STACK_ACCESS_API
17 # select HAVE_HW_BREAKPOINT if PERF_EVENTS19 # select HAVE_HW_BREAKPOINT if PERF_EVENTS
@@ -23,6 +25,7 @@ config HEXAGON · 5 unmodified lines
23 select HAVE_PERF_EVENTS25 select HAVE_PERF_EVENTS
24 # GENERIC_ALLOCATOR is used by dma_alloc_coherent()26 # GENERIC_ALLOCATOR is used by dma_alloc_coherent()
25 select GENERIC_ALLOCATOR27 select GENERIC_ALLOCATOR
28 select GENERIC_IRQ_PROBE
26 select GENERIC_IRQ_SHOW29 select GENERIC_IRQ_SHOW
27 select HAVE_ARCH_KGDB30 select HAVE_ARCH_KGDB
28 select HAVE_ARCH_TRACEHOOK31 select HAVE_ARCH_TRACEHOOK
@@ -47,9 +50,6 @@ config HEXAGON_PHYS_OFFSET · 18 unmodified lines
47 help50 help
48 Platforms that don't load the kernel at zero set this.51 Platforms that don't load the kernel at zero set this.
49 52
50config FRAME_POINTER
51 def_bool y
52
53config LOCKDEP_SUPPORT53config LOCKDEP_SUPPORT
54 def_bool y54 def_bool y
55 55
@@ -62,12 +62,6 @@ config MMU · 6 unmodified lines
62config GENERIC_CSUM62config GENERIC_CSUM
63 def_bool y63 def_bool y
64 64
65#
66# Use the generic interrupt handling code in kernel/irq/:
67#
68config GENERIC_IRQ_PROBE
69 def_bool y
70
71config GENERIC_HWEIGHT65config GENERIC_HWEIGHT
72 def_bool y66 def_bool y
73 67
arch/parisc/Kconfig+2−2
@@ -238,9 +238,9 @@ config PARISC_HUGE_KERNEL · 237 unmodified lines
238 def_bool y if !MODULES || UBSAN || FTRACE || COMPILE_TEST238 def_bool y if !MODULES || UBSAN || FTRACE || COMPILE_TEST
239 239
240config MLONGCALLS240config MLONGCALLS
241 def_bool y if PARISC_HUGE_KERNEL
242 bool "Enable the -mlong-calls compiler option for big kernels" if !PARISC_HUGE_KERNEL241 bool "Enable the -mlong-calls compiler option for big kernels" if !PARISC_HUGE_KERNEL
243 depends on PA8X00242 depends on PA8X00
243 default PARISC_HUGE_KERNEL
244 help244 help
245 If you configure the kernel to include many drivers built-in instead245 If you configure the kernel to include many drivers built-in instead
246 as modules, the kernel executable may become too big, so that the246 as modules, the kernel executable may become too big, so that the
@@ -255,9 +255,9 @@ config MLONGCALLS · 8 unmodified lines
255 Enabling this option will probably slow down your kernel.255 Enabling this option will probably slow down your kernel.
256 256
257config 64BIT257config 64BIT
258 def_bool y if "$(ARCH)" = "parisc64"
259 bool "64-bit kernel" if "$(ARCH)" = "parisc"258 bool "64-bit kernel" if "$(ARCH)" = "parisc"
260 depends on PA8X00259 depends on PA8X00
260 default "$(ARCH)" = "parisc64"
261 help261 help
262 Enable this if you want to support 64bit kernel on PA-RISC platform.262 Enable this if you want to support 64bit kernel on PA-RISC platform.
263 263
arch/riscv/kernel/tests/Kconfig.debug+1−1
@@ -6,7 +6,7 @@ config AS_HAS_ULEB128 · 5 unmodified lines
6 6
7menuconfig RUNTIME_KERNEL_TESTING_MENU7menuconfig RUNTIME_KERNEL_TESTING_MENU
8 bool "arch/riscv/kernel runtime Testing"8 bool "arch/riscv/kernel runtime Testing"
9 def_bool y9 default y
10 help10 help
11 Enable riscv kernel runtime testing.11 Enable riscv kernel runtime testing.
12 12
arch/x86/entry/vdso/Makefile+2−0
@@ -9,7 +9,9 @@ include $(srctree)/lib/vdso/Makefile · 8 unmodified lines
9# Sanitizer runtimes are unavailable and cannot be linked here.9# Sanitizer runtimes are unavailable and cannot be linked here.
10KASAN_SANITIZE := n10KASAN_SANITIZE := n
11KMSAN_SANITIZE_vclock_gettime.o := n11KMSAN_SANITIZE_vclock_gettime.o := n
12KMSAN_SANITIZE_vdso32/vclock_gettime.o := n
12KMSAN_SANITIZE_vgetcpu.o := n13KMSAN_SANITIZE_vgetcpu.o := n
14KMSAN_SANITIZE_vdso32/vgetcpu.o := n
13 15
14UBSAN_SANITIZE := n16UBSAN_SANITIZE := n
15KCSAN_SANITIZE := n17KCSAN_SANITIZE := n
arch/x86/kvm/Kconfig+1−1
@@ -118,8 +118,8 @@ config KVM_AMD · 117 unmodified lines
118 will be called kvm-amd.118 will be called kvm-amd.
119 119
120config KVM_AMD_SEV120config KVM_AMD_SEV
121 def_bool y
122 bool "AMD Secure Encrypted Virtualization (SEV) support"121 bool "AMD Secure Encrypted Virtualization (SEV) support"
122 default y
123 depends on KVM_AMD && X86_64123 depends on KVM_AMD && X86_64
124 depends on CRYPTO_DEV_SP_PSP && !(KVM_AMD=y && CRYPTO_DEV_CCP_DD=m)124 depends on CRYPTO_DEV_SP_PSP && !(KVM_AMD=y && CRYPTO_DEV_CCP_DD=m)
125 help125 help
arch/x86/kvm/Makefile+2−1
@@ -4,7 +4,8 @@ ccflags-y += -I $(srctree)/arch/x86/kvm · 3 unmodified lines
4ccflags-$(CONFIG_KVM_WERROR) += -Werror4ccflags-$(CONFIG_KVM_WERROR) += -Werror
5 5
6ifeq ($(CONFIG_FRAME_POINTER),y)6ifeq ($(CONFIG_FRAME_POINTER),y)
7OBJECT_FILES_NON_STANDARD_vmenter.o := y7OBJECT_FILES_NON_STANDARD_vmx/vmenter.o := y
8OBJECT_FILES_NON_STANDARD_svm/vmenter.o := y
8endif9endif
9 10
10include $(srctree)/virt/kvm/Makefile.kvm11include $(srctree)/virt/kvm/Makefile.kvm
arch/x86/xen/Kconfig+0−1
@@ -81,7 +81,6 @@ config XEN_PVH · 80 unmodified lines
81 bool "Xen PVH guest support"81 bool "Xen PVH guest support"
82 depends on XEN && XEN_PVHVM && ACPI82 depends on XEN && XEN_PVHVM && ACPI
83 select PVH83 select PVH
84 def_bool n
85 help84 help
86 Support for running as a Xen PVH guest.85 Support for running as a Xen PVH guest.
87 86
drivers/acpi/Kconfig+0−1
@@ -460,7 +460,6 @@ config ACPI_BGRT · 459 unmodified lines
460 460
461config ACPI_REDUCED_HARDWARE_ONLY461config ACPI_REDUCED_HARDWARE_ONLY
462 bool "Hardware-reduced ACPI support only" if EXPERT462 bool "Hardware-reduced ACPI support only" if EXPERT
463 def_bool n
464 help463 help
465 This config item changes the way the ACPI code is built. When this464 This config item changes the way the ACPI code is built. When this
466 option is selected, the kernel will use a specialized version of465 option is selected, the kernel will use a specialized version of
drivers/iommu/intel/Kconfig+1−1
@@ -87,8 +87,8 @@ config INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON · 86 unmodified lines
87 the default value.87 the default value.
88 88
89config INTEL_IOMMU_PERF_EVENTS89config INTEL_IOMMU_PERF_EVENTS
90 def_bool y
91 bool "Intel IOMMU performance events"90 bool "Intel IOMMU performance events"
91 default y
92 depends on INTEL_IOMMU && PERF_EVENTS92 depends on INTEL_IOMMU && PERF_EVENTS
93 help93 help
94 Selecting this option will enable the performance monitoring94 Selecting this option will enable the performance monitoring
drivers/md/Kconfig+0−1
@@ -519,7 +519,6 @@ config DM_VERITY · 518 unmodified lines
519 If unsure, say N.519 If unsure, say N.
520 520
521config DM_VERITY_VERIFY_ROOTHASH_SIG521config DM_VERITY_VERIFY_ROOTHASH_SIG
522 def_bool n
523 bool "Verity data device root hash signature verification support"522 bool "Verity data device root hash signature verification support"
524 depends on DM_VERITY523 depends on DM_VERITY
525 select SYSTEM_DATA_VERIFICATION524 select SYSTEM_DATA_VERIFICATION
include/linux/compiler_types.h+5−5
@@ -99,17 +99,17 @@ static inline void __chk_io_ptr(const volatile void __iomem *ptr) { } · 98 unmodified lines
99 * gcc: https://gcc.gnu.org/onlinedocs/gcc/Label-Attributes.html#index-cold-label-attribute99 * gcc: https://gcc.gnu.org/onlinedocs/gcc/Label-Attributes.html#index-cold-label-attribute
100 *100 *
101 * When -falign-functions=N is in use, we must avoid the cold attribute as101 * When -falign-functions=N is in use, we must avoid the cold attribute as
102 * contemporary versions of GCC drop the alignment for cold functions. Worse,102 * GCC drops the alignment for cold functions. Worse, GCC can implicitly mark
103 * GCC can implicitly mark callees of cold functions as cold themselves, so103 * callees of cold functions as cold themselves, so it's not sufficient to add
104 * it's not sufficient to add __function_aligned here as that will not ensure104 * __function_aligned here as that will not ensure that callees are correctly
105 * that callees are correctly aligned.105 * aligned.
106 *106 *
107 * See:107 * See:
108 *108 *
109 * https://lore.kernel.org/lkml/Y77%2FqVgvaJidFpYt@FVFF77S0Q05N109 * https://lore.kernel.org/lkml/Y77%2FqVgvaJidFpYt@FVFF77S0Q05N
110 * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88345#c9110 * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88345#c9
111 */111 */
112#if !defined(CONFIG_CC_IS_GCC) || (CONFIG_FUNCTION_ALIGNMENT == 0)112#if defined(CONFIG_CC_HAS_SANE_FUNCTION_ALIGNMENT) || (CONFIG_FUNCTION_ALIGNMENT == 0)
113#define __cold __attribute__((__cold__))113#define __cold __attribute__((__cold__))
114#else114#else
115#define __cold115#define __cold
init/Kconfig+1−1
@@ -1499,7 +1499,7 @@ config MULTIUSER · 1498 unmodified lines
1499 1499
1500config SGETMASK_SYSCALL1500config SGETMASK_SYSCALL
1501 bool "sgetmask/ssetmask syscalls support" if EXPERT1501 bool "sgetmask/ssetmask syscalls support" if EXPERT
1502 def_bool PARISC || M68K || PPC || MIPS || X86 || SPARC || MICROBLAZE || SUPERH1502 default PARISC || M68K || PPC || MIPS || X86 || SPARC || MICROBLAZE || SUPERH
1503 help1503 help
1504 sys_sgetmask and sys_ssetmask are obsolete system calls1504 sys_sgetmask and sys_ssetmask are obsolete system calls
1505 no longer supported in libc but still enabled by default in some1505 no longer supported in libc but still enabled by default in some
kernel/module/Kconfig+1−2
@@ -362,8 +362,7 @@ config MODPROBE_PATH · 361 unmodified lines
362 userspace can still load modules explicitly).362 userspace can still load modules explicitly).
363 363
364config TRIM_UNUSED_KSYMS364config TRIM_UNUSED_KSYMS
365 bool "Trim unused exported kernel symbols" if EXPERT365 bool "Trim unused exported kernel symbols"
366 depends on !COMPILE_TEST
367 help366 help
368 The kernel and some modules make many symbols available for367 The kernel and some modules make many symbols available for
369 other modules to use via EXPORT_SYMBOL() and variants. Depending368 other modules to use via EXPORT_SYMBOL() and variants. Depending
lib/Kconfig.debug+1−1
@@ -2127,7 +2127,7 @@ config KCOV_IRQ_AREA_SIZE · 2126 unmodified lines
2127 2127
2128menuconfig RUNTIME_TESTING_MENU2128menuconfig RUNTIME_TESTING_MENU
2129 bool "Runtime Testing"2129 bool "Runtime Testing"
2130 def_bool y2130 default y
2131 2131
2132if RUNTIME_TESTING_MENU2132if RUNTIME_TESTING_MENU
2133 2133
mm/Kconfig+3−4
@@ -583,7 +583,7 @@ config MEMORY_BALLOON · 582 unmodified lines
583# support for memory balloon compaction583# support for memory balloon compaction
584config BALLOON_COMPACTION584config BALLOON_COMPACTION
585 bool "Allow for balloon memory compaction/migration"585 bool "Allow for balloon memory compaction/migration"
586 def_bool y586 default y
587 depends on COMPACTION && MEMORY_BALLOON587 depends on COMPACTION && MEMORY_BALLOON
588 help588 help
589 Memory fragmentation introduced by ballooning might reduce589 Memory fragmentation introduced by ballooning might reduce
@@ -598,7 +598,7 @@ config BALLOON_COMPACTION · 8 unmodified lines
598# support for memory compaction598# support for memory compaction
599config COMPACTION599config COMPACTION
600 bool "Allow for memory compaction"600 bool "Allow for memory compaction"
601 def_bool y601 default y
602 select MIGRATION602 select MIGRATION
603 depends on MMU603 depends on MMU
604 help604 help
@@ -621,7 +621,6 @@ config COMPACT_UNEVICTABLE_DEFAULT · 16 unmodified lines
621# support for free page reporting621# support for free page reporting
622config PAGE_REPORTING622config PAGE_REPORTING
623 bool "Free page reporting"623 bool "Free page reporting"
624 def_bool n
625 help624 help
626 Free page reporting allows for the incremental acquisition of625 Free page reporting allows for the incremental acquisition of
627 free pages from the buddy allocator for the purpose of reporting626 free pages from the buddy allocator for the purpose of reporting
@@ -633,7 +632,7 @@ config PAGE_REPORTING · 5 unmodified lines
633#632#
634config MIGRATION633config MIGRATION
635 bool "Page migration"634 bool "Page migration"
636 def_bool y635 default y
637 depends on (NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE || COMPACTION || CMA) && MMU636 depends on (NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE || COMPACTION || CMA) && MMU
638 help637 help
639 Allows the migration of the physical location of pages of processes638 Allows the migration of the physical location of pages of processes
net/dccp/ccids/Kconfig+1−1
@@ -13,7 +13,7 @@ config IP_DCCP_CCID2_DEBUG · 12 unmodified lines
13 13
14config IP_DCCP_CCID314config IP_DCCP_CCID3
15 bool "CCID-3 (TCP-Friendly)"15 bool "CCID-3 (TCP-Friendly)"
16 def_bool y if (IP_DCCP = y || IP_DCCP = m)16 default IP_DCCP = y || IP_DCCP = m
17 help17 help
18 CCID-3 denotes TCP-Friendly Rate Control (TFRC), an equation-based18 CCID-3 denotes TCP-Friendly Rate Control (TFRC), an equation-based
19 rate-controlled congestion control mechanism. TFRC is designed to19 rate-controlled congestion control mechanism. TFRC is designed to
rust/Makefile+2−2
@@ -100,7 +100,7 @@ rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \ · 99 unmodified lines
100 -e 's:rust-logo-[0-9a-f]+\.svg:logo.svg:g' \100 -e 's:rust-logo-[0-9a-f]+\.svg:logo.svg:g' \
101 -e 's:favicon-[0-9a-f]+\.svg:logo.svg:g' \101 -e 's:favicon-[0-9a-f]+\.svg:logo.svg:g' \
102 -e 's:<link rel="alternate icon" type="image/png" href="[/.]+/static\.files/favicon-(16x16|32x32)-[0-9a-f]+\.png">::g' \102 -e 's:<link rel="alternate icon" type="image/png" href="[/.]+/static\.files/favicon-(16x16|32x32)-[0-9a-f]+\.png">::g' \
103 -e 's:<a href="srctree/([^"]+)">:<a href="$(abs_srctree)/\1">:g'103 -e 's:<a href="srctree/([^"]+)">:<a href="$(realpath $(srctree))/\1">:g'
104 $(Q)for f in $(rustdoc_output)/static.files/rustdoc-*.css; do \104 $(Q)for f in $(rustdoc_output)/static.files/rustdoc-*.css; do \
105 echo ".logo-container > img { object-fit: contain; }" >> $$f; done105 echo ".logo-container > img { object-fit: contain; }" >> $$f; done
106 106
@@ -414,7 +414,7 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L · 307 unmodified lines
414rust-analyzer:414rust-analyzer:
415 $(Q)$(srctree)/scripts/generate_rust_analyzer.py \415 $(Q)$(srctree)/scripts/generate_rust_analyzer.py \
416 --cfgs='core=$(core-cfgs)' --cfgs='alloc=$(alloc-cfgs)' \416 --cfgs='core=$(core-cfgs)' --cfgs='alloc=$(alloc-cfgs)' \
417 $(abs_srctree) $(abs_objtree) \417 $(realpath $(srctree)) $(realpath $(objtree)) \
418 $(RUST_LIB_SRC) $(KBUILD_EXTMOD) > \418 $(RUST_LIB_SRC) $(KBUILD_EXTMOD) > \
419 $(if $(KBUILD_EXTMOD),$(extmod_prefix),$(objtree))/rust-project.json419 $(if $(KBUILD_EXTMOD),$(extmod_prefix),$(objtree))/rust-project.json
420 420
scripts/Kbuild.include+0−6
@@ -113,12 +113,6 @@ endef · 112 unmodified lines
113# $(Q)$(MAKE) $(build)=dir113# $(Q)$(MAKE) $(build)=dir
114build := -f $(srctree)/scripts/Makefile.build obj114build := -f $(srctree)/scripts/Makefile.build obj
115 115
116###
117# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj=
118# Usage:
119# $(Q)$(MAKE) $(dtbinst)=dir
120dtbinst := -f $(srctree)/scripts/Makefile.dtbinst obj
121
122###116###
123# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=117# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=
124# Usage:118# Usage:
scripts/Makefile.build+13−9
@@ -71,6 +71,7 @@ endif · 70 unmodified lines
71# subdir-builtin and subdir-modorder may contain duplications. Use $(sort ...)71# subdir-builtin and subdir-modorder may contain duplications. Use $(sort ...)
72subdir-builtin := $(sort $(filter %/built-in.a, $(real-obj-y)))72subdir-builtin := $(sort $(filter %/built-in.a, $(real-obj-y)))
73subdir-modorder := $(sort $(filter %/modules.order, $(obj-m)))73subdir-modorder := $(sort $(filter %/modules.order, $(obj-m)))
74subdir-dtbslist := $(sort $(filter %/dtbs-list, $(dtb-y)))
74 75
75targets-for-builtin := $(extra-y)76targets-for-builtin := $(extra-y)
76 77
@@ -213,7 +214,7 @@ endif # CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT · 136 unmodified lines
213# 'OBJECT_FILES_NON_STANDARD_foo.o := 'y': skip objtool checking for a file214# 'OBJECT_FILES_NON_STANDARD_foo.o := 'y': skip objtool checking for a file
214# 'OBJECT_FILES_NON_STANDARD_foo.o := 'n': override directory skip for a file215# 'OBJECT_FILES_NON_STANDARD_foo.o := 'n': override directory skip for a file
215 216
216is-standard-object = $(if $(filter-out y%, $(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n),y)217is-standard-object = $(if $(filter-out y%, $(OBJECT_FILES_NON_STANDARD_$(target-stem).o)$(OBJECT_FILES_NON_STANDARD)n),y)
217 218
218$(obj)/%.o: objtool-enabled = $(if $(is-standard-object),$(if $(delay-objtool),$(is-single-obj-m),y))219$(obj)/%.o: objtool-enabled = $(if $(is-standard-object),$(if $(delay-objtool),$(is-single-obj-m),y))
219 220
@@ -388,6 +389,7 @@ $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler · 168 unmodified lines
388# To build objects in subdirs, we need to descend into the directories389# To build objects in subdirs, we need to descend into the directories
389$(subdir-builtin): $(obj)/%/built-in.a: $(obj)/% ;390$(subdir-builtin): $(obj)/%/built-in.a: $(obj)/% ;
390$(subdir-modorder): $(obj)/%/modules.order: $(obj)/% ;391$(subdir-modorder): $(obj)/%/modules.order: $(obj)/% ;
392$(subdir-dtbslist): $(obj)/%/dtbs-list: $(obj)/% ;
391 393
392#394#
393# Rule to compile a set of .o files into one .a file (without symbol table)395# Rule to compile a set of .o files into one .a file (without symbol table)
@@ -404,19 +406,21 @@ $(obj)/built-in.a: $(real-obj-y) FORCE · 10 unmodified lines
404 $(call if_changed,ar_builtin)406 $(call if_changed,ar_builtin)
405 407
406#408#
407# Rule to create modules.order file409# Rule to create modules.order and dtbs-list
408#410#
409# Create commands to either record .ko file or cat modules.order from411# This is a list of build artifacts (module or dtb) from the current Makefile
410# a subdirectory412# and its sub-directories. The timestamp should be updated when any of the
411# Add $(obj-m) as the prerequisite to avoid updating the timestamp of413# member files.
412# modules.order unless contained modules are updated.
413 414
414cmd_modules_order = { $(foreach m, $(real-prereqs), \415cmd_gen_order = { $(foreach m, $(real-prereqs), \
415 $(if $(filter %/modules.order, $m), cat $m, echo $m);) :; } \416 $(if $(filter %/$(notdir $@), $m), cat $m, echo $m);) :; } \
416 > $@417 > $@
417 418
418$(obj)/modules.order: $(obj-m) FORCE419$(obj)/modules.order: $(obj-m) FORCE
419 $(call if_changed,modules_order)420 $(call if_changed,gen_order)
421
422$(obj)/dtbs-list: $(dtb-y) FORCE
423 $(call if_changed,gen_order)
420 424
421#425#
422# Rule to compile a set of .o files into one .a file (with symbol table)426# Rule to compile a set of .o files into one .a file (with symbol table)
scripts/Makefile.dtbinst+18−14
@@ -8,32 +8,36 @@ · 7 unmodified lines
8# $INSTALL_PATH/dtbs/$KERNELRELEASE8# $INSTALL_PATH/dtbs/$KERNELRELEASE
9# ==========================================================================9# ==========================================================================
10 10
11src := $(obj)
12
13PHONY := __dtbs_install11PHONY := __dtbs_install
14__dtbs_install:12__dtbs_install:
15 13
16include include/config/auto.conf14include include/config/auto.conf
17include $(srctree)/scripts/Kbuild.include15include $(srctree)/scripts/Kbuild.include
18include $(kbuild-file)
19
20dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-)))
21subdirs := $(addprefix $(obj)/, $(subdir-y) $(subdir-m))
22 16
23__dtbs_install: $(dtbs) $(subdirs)17dst := $(INSTALL_DTBS_PATH)
24 @:
25 18
26quiet_cmd_dtb_install = INSTALL $@19quiet_cmd_dtb_install = INSTALL $@
27 cmd_dtb_install = install -D $< $@20 cmd_dtb_install = install -D $< $@
28 21
29$(dst)/%.dtb: $(obj)/%.dtb22$(dst)/%: $(obj)/%
30 $(call cmd,dtb_install)23 $(call cmd,dtb_install)
31 24
32$(dst)/%.dtbo: $(obj)/%.dtbo25dtbs := $(patsubst $(obj)/%,%,$(call read-file, $(obj)/dtbs-list))
33 $(call cmd,dtb_install)26
27ifdef CONFIG_ARCH_WANT_FLAT_DTB_INSTALL
34 28
35PHONY += $(subdirs)29define gen_install_rules
36$(subdirs):30$(dst)/%: $(obj)/$(1)%
37 $(Q)$(MAKE) $(dtbinst)=$@ dst=$(if $(CONFIG_ARCH_WANT_FLAT_DTB_INSTALL),$(dst),$(patsubst $(obj)/%,$(dst)/%,$@))31 $$(call cmd,dtb_install)
32endef
33
34$(foreach d, $(sort $(dir $(dtbs))), $(eval $(call gen_install_rules,$(d))))
35
36dtbs := $(notdir $(dtbs))
37
38endif # CONFIG_ARCH_WANT_FLAT_DTB_INSTALL
39
40__dtbs_install: $(addprefix $(dst)/, $(dtbs))
41 @:
38 42
39.PHONY: $(PHONY)43.PHONY: $(PHONY)
scripts/Makefile.extrawarn+2−1
@@ -132,6 +132,8 @@ KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast) · 131 unmodified lines
132KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare132KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare
133KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access)133KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access)
134KBUILD_CFLAGS += $(call cc-disable-warning, cast-function-type-strict)134KBUILD_CFLAGS += $(call cc-disable-warning, cast-function-type-strict)
135KBUILD_CFLAGS += -Wno-enum-compare-conditional
136KBUILD_CFLAGS += -Wno-enum-enum-conversion
135endif137endif
136 138
137endif139endif
@@ -185,7 +187,6 @@ KBUILD_CFLAGS += -Wpointer-arith · 47 unmodified lines
185KBUILD_CFLAGS += -Wredundant-decls187KBUILD_CFLAGS += -Wredundant-decls
186KBUILD_CFLAGS += -Wsign-compare188KBUILD_CFLAGS += -Wsign-compare
187KBUILD_CFLAGS += -Wswitch-default189KBUILD_CFLAGS += -Wswitch-default
188KBUILD_CFLAGS += $(call cc-option, -Wpacked-bitfield-compat)
189 190
190KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN3191KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN3
191 192
scripts/Makefile.lib+16−10
@@ -45,6 +45,11 @@ else · 44 unmodified lines
45obj-y := $(filter-out %/, $(obj-y))45obj-y := $(filter-out %/, $(obj-y))
46endif46endif
47 47
48ifdef need-dtbslist
49dtb-y += $(addsuffix /dtbs-list, $(subdir-ym))
50always-y += dtbs-list
51endif
52
48# Expand $(foo-objs) $(foo-y) etc. by replacing their individuals53# Expand $(foo-objs) $(foo-y) etc. by replacing their individuals
49suffix-search = $(strip $(foreach s, $3, $($(1:%$(strip $2)=%$s))))54suffix-search = $(strip $(foreach s, $3, $($(1:%$(strip $2)=%$s))))
50# List composite targets that are constructed by combining other targets55# List composite targets that are constructed by combining other targets
@@ -99,6 +104,7 @@ lib-y := $(addprefix $(obj)/,$(lib-y)) · 48 unmodified lines
99real-obj-y := $(addprefix $(obj)/,$(real-obj-y))104real-obj-y := $(addprefix $(obj)/,$(real-obj-y))
100real-obj-m := $(addprefix $(obj)/,$(real-obj-m))105real-obj-m := $(addprefix $(obj)/,$(real-obj-m))
101multi-obj-m := $(addprefix $(obj)/, $(multi-obj-m))106multi-obj-m := $(addprefix $(obj)/, $(multi-obj-m))
107dtb-y := $(addprefix $(obj)/, $(dtb-y))
102multi-dtb-y := $(addprefix $(obj)/, $(multi-dtb-y))108multi-dtb-y := $(addprefix $(obj)/, $(multi-dtb-y))
103real-dtb-y := $(addprefix $(obj)/, $(real-dtb-y))109real-dtb-y := $(addprefix $(obj)/, $(real-dtb-y))
104subdir-ym := $(addprefix $(obj)/,$(subdir-ym))110subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
@@ -148,7 +154,7 @@ _cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(target-stem).lds) · 43 unmodified lines
148#154#
149ifeq ($(CONFIG_GCOV_KERNEL),y)155ifeq ($(CONFIG_GCOV_KERNEL),y)
150_c_flags += $(if $(patsubst n%,, \156_c_flags += $(if $(patsubst n%,, \
151 $(GCOV_PROFILE_$(basetarget).o)$(GCOV_PROFILE)$(CONFIG_GCOV_PROFILE_ALL)), \157 $(GCOV_PROFILE_$(target-stem).o)$(GCOV_PROFILE)$(CONFIG_GCOV_PROFILE_ALL)), \
152 $(CFLAGS_GCOV))158 $(CFLAGS_GCOV))
153endif159endif
154 160
@@ -159,32 +165,32 @@ endif · 4 unmodified lines
159ifeq ($(CONFIG_KASAN),y)165ifeq ($(CONFIG_KASAN),y)
160ifneq ($(CONFIG_KASAN_HW_TAGS),y)166ifneq ($(CONFIG_KASAN_HW_TAGS),y)
161_c_flags += $(if $(patsubst n%,, \167_c_flags += $(if $(patsubst n%,, \
162 $(KASAN_SANITIZE_$(basetarget).o)$(KASAN_SANITIZE)y), \168 $(KASAN_SANITIZE_$(target-stem).o)$(KASAN_SANITIZE)y), \
163 $(CFLAGS_KASAN), $(CFLAGS_KASAN_NOSANITIZE))169 $(CFLAGS_KASAN), $(CFLAGS_KASAN_NOSANITIZE))
164endif170endif
165endif171endif
166 172
167ifeq ($(CONFIG_KMSAN),y)173ifeq ($(CONFIG_KMSAN),y)
168_c_flags += $(if $(patsubst n%,, \174_c_flags += $(if $(patsubst n%,, \
169 $(KMSAN_SANITIZE_$(basetarget).o)$(KMSAN_SANITIZE)y), \175 $(KMSAN_SANITIZE_$(target-stem).o)$(KMSAN_SANITIZE)y), \
170 $(CFLAGS_KMSAN))176 $(CFLAGS_KMSAN))
171_c_flags += $(if $(patsubst n%,, \177_c_flags += $(if $(patsubst n%,, \
172 $(KMSAN_ENABLE_CHECKS_$(basetarget).o)$(KMSAN_ENABLE_CHECKS)y), \178 $(KMSAN_ENABLE_CHECKS_$(target-stem).o)$(KMSAN_ENABLE_CHECKS)y), \
173 , -mllvm -msan-disable-checks=1)179 , -mllvm -msan-disable-checks=1)
174endif180endif
175 181
176ifeq ($(CONFIG_UBSAN),y)182ifeq ($(CONFIG_UBSAN),y)
177_c_flags += $(if $(patsubst n%,, \183_c_flags += $(if $(patsubst n%,, \
178 $(UBSAN_SANITIZE_$(basetarget).o)$(UBSAN_SANITIZE)y), \184 $(UBSAN_SANITIZE_$(target-stem).o)$(UBSAN_SANITIZE)y), \
179 $(CFLAGS_UBSAN))185 $(CFLAGS_UBSAN))
180_c_flags += $(if $(patsubst n%,, \186_c_flags += $(if $(patsubst n%,, \
181 $(UBSAN_SIGNED_WRAP_$(basetarget).o)$(UBSAN_SANITIZE_$(basetarget).o)$(UBSAN_SIGNED_WRAP)$(UBSAN_SANITIZE)y), \187 $(UBSAN_SIGNED_WRAP_$(target-stem).o)$(UBSAN_SANITIZE_$(target-stem).o)$(UBSAN_SIGNED_WRAP)$(UBSAN_SANITIZE)y), \
182 $(CFLAGS_UBSAN_SIGNED_WRAP))188 $(CFLAGS_UBSAN_SIGNED_WRAP))
183endif189endif
184 190
185ifeq ($(CONFIG_KCOV),y)191ifeq ($(CONFIG_KCOV),y)
186_c_flags += $(if $(patsubst n%,, \192_c_flags += $(if $(patsubst n%,, \
187 $(KCOV_INSTRUMENT_$(basetarget).o)$(KCOV_INSTRUMENT)$(CONFIG_KCOV_INSTRUMENT_ALL)), \193 $(KCOV_INSTRUMENT_$(target-stem).o)$(KCOV_INSTRUMENT)$(CONFIG_KCOV_INSTRUMENT_ALL)), \
188 $(CFLAGS_KCOV))194 $(CFLAGS_KCOV))
189endif195endif
190 196
@@ -194,12 +200,12 @@ endif · 3 unmodified lines
194#200#
195ifeq ($(CONFIG_KCSAN),y)201ifeq ($(CONFIG_KCSAN),y)
196_c_flags += $(if $(patsubst n%,, \202_c_flags += $(if $(patsubst n%,, \
197 $(KCSAN_SANITIZE_$(basetarget).o)$(KCSAN_SANITIZE)y), \203 $(KCSAN_SANITIZE_$(target-stem).o)$(KCSAN_SANITIZE)y), \
198 $(CFLAGS_KCSAN))204 $(CFLAGS_KCSAN))
199# Some uninstrumented files provide implied barriers required to avoid false205# Some uninstrumented files provide implied barriers required to avoid false
200# positives: set KCSAN_INSTRUMENT_BARRIERS for barrier instrumentation only.206# positives: set KCSAN_INSTRUMENT_BARRIERS for barrier instrumentation only.
201_c_flags += $(if $(patsubst n%,, \207_c_flags += $(if $(patsubst n%,, \
202 $(KCSAN_INSTRUMENT_BARRIERS_$(basetarget).o)$(KCSAN_INSTRUMENT_BARRIERS)n), \208 $(KCSAN_INSTRUMENT_BARRIERS_$(target-stem).o)$(KCSAN_INSTRUMENT_BARRIERS)n), \
203 -D__KCSAN_INSTRUMENT_BARRIERS__)209 -D__KCSAN_INSTRUMENT_BARRIERS__)
204endif210endif
205 211
@@ -364,7 +370,7 @@ DTC_FLAGS += -Wnode_name_chars_strict \ · 158 unmodified lines
364 -Wunique_unit_address370 -Wunique_unit_address
365endif371endif
366 372
367DTC_FLAGS += $(DTC_FLAGS_$(basetarget))373DTC_FLAGS += $(DTC_FLAGS_$(target-stem))
368 374
369# Set -@ if the target is a base DTB that overlay is applied onto375# Set -@ if the target is a base DTB that overlay is applied onto
370DTC_FLAGS += $(if $(filter $(patsubst $(obj)/%,%,$@), $(base-dtb-y)), -@)376DTC_FLAGS += $(if $(filter $(patsubst $(obj)/%,%,$@), $(base-dtb-y)), -@)
scripts/Makefile.package+1−1
@@ -135,7 +135,7 @@ snap-pkg: · 134 unmodified lines
135 mkdir $(objtree)/snap135 mkdir $(objtree)/snap
136 $(MAKE) clean136 $(MAKE) clean
137 sed "s@KERNELRELEASE@$(KERNELRELEASE)@; \137 sed "s@KERNELRELEASE@$(KERNELRELEASE)@; \
138 s@SRCTREE@$(abs_srctree)@" \138 s@SRCTREE@$(realpath $(srctree))@" \
139 $(srctree)/scripts/package/snapcraft.template > \139 $(srctree)/scripts/package/snapcraft.template > \
140 $(objtree)/snap/snapcraft.yaml140 $(objtree)/snap/snapcraft.yaml
141 cd $(objtree)/snap && \141 cd $(objtree)/snap && \
scripts/kconfig/array_size.h+11−0
@@ -0,0 +1,11 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef ARRAY_SIZE_H
3#define ARRAY_SIZE_H
4
5/**
6 * ARRAY_SIZE - get the number of elements in array @arr
7 * @arr: array to be sized
8 */
9#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
10
11#endif /* ARRAY_SIZE_H */
scripts/kconfig/conf.c+6−6
@@ -14,6 +14,7 @@ · 13 unmodified lines
14#include <sys/time.h>14#include <sys/time.h>
15#include <errno.h>15#include <errno.h>
16 16
17#include "internal.h"
17#include "lkc.h"18#include "lkc.h"
18 19
19static void conf(struct menu *menu);20static void conf(struct menu *menu);
@@ -171,7 +172,7 @@ enum conf_def_mode { · 151 unmodified lines
171static bool conf_set_all_new_symbols(enum conf_def_mode mode)172static bool conf_set_all_new_symbols(enum conf_def_mode mode)
172{173{
173 struct symbol *sym, *csym;174 struct symbol *sym, *csym;
174 int i, cnt;175 int cnt;
175 /*176 /*
176 * can't go as the default in switch-case below, otherwise gcc whines177 * can't go as the default in switch-case below, otherwise gcc whines
177 * about -Wmaybe-uninitialized178 * about -Wmaybe-uninitialized
@@ -226,7 +227,7 @@ static bool conf_set_all_new_symbols(enum conf_def_mode mode) · 48 unmodified lines
226 }227 }
227 }228 }
228 229
229 for_all_symbols(i, sym) {230 for_all_symbols(sym) {
230 if (sym_has_value(sym) || sym->flags & SYMBOL_VALID)231 if (sym_has_value(sym) || sym->flags & SYMBOL_VALID)
231 continue;232 continue;
232 switch (sym_get_type(sym)) {233 switch (sym_get_type(sym)) {
@@ -278,14 +279,14 @@ static bool conf_set_all_new_symbols(enum conf_def_mode mode) · 45 unmodified lines
278 * and the rest to no.279 * and the rest to no.
279 */280 */
280 if (mode != def_random) {281 if (mode != def_random) {
281 for_all_symbols(i, csym) {282 for_all_symbols(csym) {
282 if ((sym_is_choice(csym) && !sym_has_value(csym)) ||283 if ((sym_is_choice(csym) && !sym_has_value(csym)) ||
283 sym_is_choice_value(csym))284 sym_is_choice_value(csym))
284 csym->flags |= SYMBOL_NEED_SET_CHOICE_VALUES;285 csym->flags |= SYMBOL_NEED_SET_CHOICE_VALUES;
285 }286 }
286 }287 }
287 288
288 for_all_symbols(i, csym) {289 for_all_symbols(csym) {
289 if (sym_has_value(csym) || !sym_is_choice(csym))290 if (sym_has_value(csym) || !sym_is_choice(csym))
290 continue;291 continue;
291 292
@@ -304,9 +305,8 @@ static bool conf_set_all_new_symbols(enum conf_def_mode mode) · 12 unmodified lines
304static void conf_rewrite_tristates(tristate old_val, tristate new_val)305static void conf_rewrite_tristates(tristate old_val, tristate new_val)
305{306{
306 struct symbol *sym;307 struct symbol *sym;
307 int i;
308 308
309 for_all_symbols(i, sym) {309 for_all_symbols(sym) {
310 if (sym_get_type(sym) == S_TRISTATE &&310 if (sym_get_type(sym) == S_TRISTATE &&
311 sym->def[S_DEF_USER].tri == old_val)311 sym->def[S_DEF_USER].tri == old_val)
312 sym->def[S_DEF_USER].tri = new_val;312 sym->def[S_DEF_USER].tri = new_val;
scripts/kconfig/confdata.c+18−78
@@ -18,8 +18,11 @@ · 17 unmodified lines
18#include <time.h>18#include <time.h>
19#include <unistd.h>19#include <unistd.h>
20 20
21#include "internal.h"
21#include "lkc.h"22#include "lkc.h"
22 23
24struct gstr autoconf_cmd;
25
23/* return true if 'path' exists, false otherwise */26/* return true if 'path' exists, false otherwise */
24static bool is_present(const char *path)27static bool is_present(const char *path)
25{28{
@@ -293,63 +296,12 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) · 267 unmodified lines
293 return 0;296 return 0;
294}297}
295 298
296#define LINE_GROWTH 16
297static int add_byte(int c, char **lineptr, size_t slen, size_t *n)
298{
299 size_t new_size = slen + 1;
300
301 if (new_size > *n) {
302 new_size += LINE_GROWTH - 1;
303 new_size *= 2;
304 *lineptr = xrealloc(*lineptr, new_size);
305 *n = new_size;
306 }
307
308 (*lineptr)[slen] = c;
309
310 return 0;
311}
312
313static ssize_t compat_getline(char **lineptr, size_t *n, FILE *stream)
314{
315 char *line = *lineptr;
316 size_t slen = 0;
317
318 for (;;) {
319 int c = getc(stream);
320
321 switch (c) {
322 case '\n':
323 if (add_byte(c, &line, slen, n) < 0)
324 goto e_out;
325 slen++;
326 /* fall through */
327 case EOF:
328 if (add_byte('\0', &line, slen, n) < 0)
329 goto e_out;
330 *lineptr = line;
331 if (slen == 0)
332 return -1;
333 return slen;
334 default:
335 if (add_byte(c, &line, slen, n) < 0)
336 goto e_out;
337 slen++;
338 }
339 }
340
341e_out:
342 line[slen-1] = '\0';
343 *lineptr = line;
344 return -1;
345}
346
347/* like getline(), but the newline character is stripped away */299/* like getline(), but the newline character is stripped away */
348static ssize_t getline_stripped(char **lineptr, size_t *n, FILE *stream)300static ssize_t getline_stripped(char **lineptr, size_t *n, FILE *stream)
349{301{
350 ssize_t len;302 ssize_t len;
351 303
352 len = compat_getline(lineptr, n, stream);304 len = getline(lineptr, n, stream);
353 305
354 if (len > 0 && (*lineptr)[len - 1] == '\n') {306 if (len > 0 && (*lineptr)[len - 1] == '\n') {
355 len--;307 len--;
@@ -371,7 +323,7 @@ int conf_read_simple(const char *name, int def) · 15 unmodified lines
371 size_t line_asize = 0;323 size_t line_asize = 0;
372 char *p, *val;324 char *p, *val;
373 struct symbol *sym;325 struct symbol *sym;
374 int i, def_flags;326 int def_flags;
375 const char *warn_unknown, *sym_name;327 const char *warn_unknown, *sym_name;
376 328
377 warn_unknown = getenv("KCONFIG_WARN_UNKNOWN_SYMBOLS");329 warn_unknown = getenv("KCONFIG_WARN_UNKNOWN_SYMBOLS");
@@ -429,7 +381,7 @@ load: · 51 unmodified lines
429 conf_warnings = 0;381 conf_warnings = 0;
430 382
431 def_flags = SYMBOL_DEF << def;383 def_flags = SYMBOL_DEF << def;
432 for_all_symbols(i, sym) {384 for_all_symbols(sym) {
433 sym->flags |= SYMBOL_CHANGED;385 sym->flags |= SYMBOL_CHANGED;
434 sym->flags &= ~(def_flags|SYMBOL_VALID);386 sym->flags &= ~(def_flags|SYMBOL_VALID);
435 if (sym_is_choice(sym))387 if (sym_is_choice(sym))
@@ -538,7 +490,6 @@ int conf_read(const char *name) · 102 unmodified lines
538{490{
539 struct symbol *sym;491 struct symbol *sym;
540 int conf_unsaved = 0;492 int conf_unsaved = 0;
541 int i;
542 493
543 conf_set_changed(false);494 conf_set_changed(false);
544 495
@@ -549,7 +500,7 @@ int conf_read(const char *name) · 4 unmodified lines
549 500
550 sym_calc_value(modules_sym);501 sym_calc_value(modules_sym);
551 502
552 for_all_symbols(i, sym) {503 for_all_symbols(sym) {
553 sym_calc_value(sym);504 sym_calc_value(sym);
554 if (sym_is_choice(sym) || (sym->flags & SYMBOL_NO_WRITE))505 if (sym_is_choice(sym) || (sym->flags & SYMBOL_NO_WRITE))
555 continue;506 continue;
@@ -573,7 +524,7 @@ int conf_read(const char *name) · 17 unmodified lines
573 /* maybe print value in verbose mode... */524 /* maybe print value in verbose mode... */
574 }525 }
575 526
576 for_all_symbols(i, sym) {527 for_all_symbols(sym) {
577 if (sym_has_value(sym) && !sym_is_choice_value(sym)) {528 if (sym_has_value(sym) && !sym_is_choice_value(sym)) {
578 /* Reset values of generates values, so they'll appear529 /* Reset values of generates values, so they'll appear
579 * as new, if they should become visible, but that530 * as new, if they should become visible, but that
@@ -848,10 +799,7 @@ int conf_write_defconfig(const char *filename) · 268 unmodified lines
848 while (menu != NULL)799 while (menu != NULL)
849 {800 {
850 sym = menu->sym;801 sym = menu->sym;
851 if (sym == NULL) {802 if (sym && !sym_is_choice(sym)) {
852 if (!menu_is_visible(menu))
853 goto next_menu;
854 } else if (!sym_is_choice(sym)) {
855 sym_calc_value(sym);803 sym_calc_value(sym);
856 if (!(sym->flags & SYMBOL_WRITE))804 if (!(sym->flags & SYMBOL_WRITE))
857 goto next_menu;805 goto next_menu;
@@ -911,7 +859,6 @@ int conf_write(const char *name) · 53 unmodified lines
911 const char *str;859 const char *str;
912 char tmpname[PATH_MAX + 1], oldname[PATH_MAX + 1];860 char tmpname[PATH_MAX + 1], oldname[PATH_MAX + 1];
913 char *env;861 char *env;
914 int i;
915 bool need_newline = false;862 bool need_newline = false;
916 863
917 if (!name)864 if (!name)
@@ -995,7 +942,7 @@ end_check: · 77 unmodified lines
995 }942 }
996 fclose(out);943 fclose(out);
997 944
998 for_all_symbols(i, sym)945 for_all_symbols(sym)
999 sym->flags &= ~SYMBOL_WRITTEN;946 sym->flags &= ~SYMBOL_WRITTEN;
1000 947
1001 if (*tmpname) {948 if (*tmpname) {
@@ -1023,7 +970,6 @@ end_check: · 21 unmodified lines
1023static int conf_write_autoconf_cmd(const char *autoconf_name)970static int conf_write_autoconf_cmd(const char *autoconf_name)
1024{971{
1025 char name[PATH_MAX], tmp[PATH_MAX];972 char name[PATH_MAX], tmp[PATH_MAX];
1026 struct file *file;
1027 FILE *out;973 FILE *out;
1028 int ret;974 int ret;
1029 975
@@ -1044,15 +990,9 @@ static int conf_write_autoconf_cmd(const char *autoconf_name) · 14 unmodified lines
1044 return -1;990 return -1;
1045 }991 }
1046 992
1047 fprintf(out, "deps_config := \\\n");993 fprintf(out, "autoconfig := %s\n", autoconf_name);
1048 for (file = file_list; file; file = file->next)
1049 fprintf(out, "\t%s \\\n", file->name);
1050
1051 fprintf(out, "\n%s: $(deps_config)\n\n", autoconf_name);
1052 994
1053 env_write_dep(out, autoconf_name);995 fputs(str_get(&autoconf_cmd), out);
1054
1055 fprintf(out, "\n$(deps_config): ;\n");
1056 996
1057 fflush(out);997 fflush(out);
1058 ret = ferror(out); /* error check for all fprintf() calls */998 ret = ferror(out); /* error check for all fprintf() calls */
@@ -1072,7 +1012,7 @@ static int conf_touch_deps(void) · 13 unmodified lines
1072{1012{
1073 const char *name, *tmp;1013 const char *name, *tmp;
1074 struct symbol *sym;1014 struct symbol *sym;
1075 int res, i;1015 int res;
1076 1016
1077 name = conf_get_autoconfig_name();1017 name = conf_get_autoconfig_name();
1078 tmp = strrchr(name, '/');1018 tmp = strrchr(name, '/');
@@ -1086,7 +1026,7 @@ static int conf_touch_deps(void) · 7 unmodified lines
1086 conf_read_simple(name, S_DEF_AUTO);1026 conf_read_simple(name, S_DEF_AUTO);
1087 sym_calc_value(modules_sym);1027 sym_calc_value(modules_sym);
1088 1028
1089 for_all_symbols(i, sym) {1029 for_all_symbols(sym) {
1090 sym_calc_value(sym);1030 sym_calc_value(sym);
1091 if ((sym->flags & SYMBOL_NO_WRITE) || !sym->name)1031 if ((sym->flags & SYMBOL_NO_WRITE) || !sym->name)
1092 continue;1032 continue;
@@ -1152,7 +1092,7 @@ static int __conf_write_autoconf(const char *filename, · 59 unmodified lines
1152 char tmp[PATH_MAX];1092 char tmp[PATH_MAX];
1153 FILE *file;1093 FILE *file;
1154 struct symbol *sym;1094 struct symbol *sym;
1155 int ret, i;1095 int ret;
1156 1096
1157 if (make_parent_dir(filename))1097 if (make_parent_dir(filename))
1158 return -1;1098 return -1;
@@ -1169,7 +1109,7 @@ static int __conf_write_autoconf(const char *filename, · 10 unmodified lines
1169 1109
1170 conf_write_heading(file, comment_style);1110 conf_write_heading(file, comment_style);
1171 1111
1172 for_all_symbols(i, sym)1112 for_all_symbols(sym)
1173 if ((sym->flags & SYMBOL_WRITE) && sym->name)1113 if ((sym->flags & SYMBOL_WRITE) && sym->name)
1174 print_symbol(file, sym);1114 print_symbol(file, sym);
1175 1115
@@ -1192,7 +1132,7 @@ int conf_write_autoconf(int overwrite) · 16 unmodified lines
1192{1132{
1193 struct symbol *sym;1133 struct symbol *sym;
1194 const char *autoconf_name = conf_get_autoconfig_name();1134 const char *autoconf_name = conf_get_autoconfig_name();
1195 int ret, i;1135 int ret;
1196 1136
1197 if (!overwrite && is_present(autoconf_name))1137 if (!overwrite && is_present(autoconf_name))
1198 return 0;1138 return 0;
@@ -1204,7 +1144,7 @@ int conf_write_autoconf(int overwrite) · 5 unmodified lines
1204 if (conf_touch_deps())1144 if (conf_touch_deps())
1205 return 1;1145 return 1;
1206 1146
1207 for_all_symbols(i, sym)1147 for_all_symbols(sym)
1208 sym_calc_value(sym);1148 sym_calc_value(sym);
1209 1149
1210 ret = __conf_write_autoconf(conf_get_autoheader_name(),1150 ret = __conf_write_autoconf(conf_get_autoheader_name(),
scripts/kconfig/expr.h+11−18
@@ -12,17 +12,12 @@ extern "C" { · 11 unmodified lines
12 12
13#include <assert.h>13#include <assert.h>
14#include <stdio.h>14#include <stdio.h>
15#include "list.h"15#include "list_types.h"
16#ifndef __cplusplus16#ifndef __cplusplus
17#include <stdbool.h>17#include <stdbool.h>
18#endif18#endif
19 19
20struct file {20#include "list_types.h"
21 struct file *next;
22 struct file *parent;
23 const char *name;
24 int lineno;
25};
26 21
27typedef enum tristate {22typedef enum tristate {
28 no, mod, yes23 no, mod, yes
@@ -81,8 +76,8 @@ enum { · 52 unmodified lines
81 * SYMBOL_CHOICE bit set in 'flags'.76 * SYMBOL_CHOICE bit set in 'flags'.
82 */77 */
83struct symbol {78struct symbol {
84 /* The next symbol in the same bucket in the symbol hash table */79 /* link node for the hash table */
85 struct symbol *next;80 struct hlist_node node;
86 81
87 /* The name of the symbol, e.g. "FOO" for 'config FOO' */82 /* The name of the symbol, e.g. "FOO" for 'config FOO' */
88 char *name;83 char *name;
@@ -113,6 +108,9 @@ struct symbol { · 24 unmodified lines
113 */108 */
114 tristate visible;109 tristate visible;
115 110
111 /* config entries associated with this symbol */
112 struct list_head menus;
113
116 /* SYMBOL_* flags */114 /* SYMBOL_* flags */
117 int flags;115 int flags;
118 116
@@ -131,8 +129,6 @@ struct symbol { · 12 unmodified lines
131 struct expr_value implied;129 struct expr_value implied;
132};130};
133 131
134#define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next)
135
136#define SYMBOL_CONST 0x0001 /* symbol is const */132#define SYMBOL_CONST 0x0001 /* symbol is const */
137#define SYMBOL_CHECK 0x0008 /* used during dependency checking */133#define SYMBOL_CHECK 0x0008 /* used during dependency checking */
138#define SYMBOL_CHOICE 0x0010 /* start of a choice block (null name) */134#define SYMBOL_CHOICE 0x0010 /* start of a choice block (null name) */
@@ -157,7 +153,6 @@ struct symbol { · 18 unmodified lines
157#define SYMBOL_NEED_SET_CHOICE_VALUES 0x100000153#define SYMBOL_NEED_SET_CHOICE_VALUES 0x100000
158 154
159#define SYMBOL_MAXLENGTH 256155#define SYMBOL_MAXLENGTH 256
160#define SYMBOL_HASHSIZE 9973
161 156
162/* A property represent the config options that can be associated157/* A property represent the config options that can be associated
163 * with a config "symbol".158 * with a config "symbol".
@@ -195,7 +190,7 @@ struct property { · 31 unmodified lines
195 struct menu *menu; /* the menu the property are associated with190 struct menu *menu; /* the menu the property are associated with
196 * valid for: P_SELECT, P_RANGE, P_CHOICE,191 * valid for: P_SELECT, P_RANGE, P_CHOICE,
197 * P_PROMPT, P_DEFAULT, P_MENU, P_COMMENT */192 * P_PROMPT, P_DEFAULT, P_MENU, P_COMMENT */
198 struct file *file; /* what file was this property defined */193 const char *filename; /* what file was this property defined */
199 int lineno; /* what lineno was this property defined */194 int lineno; /* what lineno was this property defined */
200};195};
201 196
@@ -230,6 +225,8 @@ struct menu { · 28 unmodified lines
230 */225 */
231 struct symbol *sym;226 struct symbol *sym;
232 227
228 struct list_head link; /* link to symbol::menus */
229
233 /*230 /*
234 * The prompt associated with the node. This holds the prompt for a231 * The prompt associated with the node. This holds the prompt for a
235 * symbol as well as the text for a menu or comment, along with the232 * symbol as well as the text for a menu or comment, along with the
@@ -256,7 +253,7 @@ struct menu { · 20 unmodified lines
256 char *help;253 char *help;
257 254
258 /* The location where the menu node appears in the Kconfig files */255 /* The location where the menu node appears in the Kconfig files */
259 struct file *file;256 const char *filename;
260 int lineno;257 int lineno;
261 258
262 /* For use by front ends that need to store auxiliary data */259 /* For use by front ends that need to store auxiliary data */
@@ -277,10 +274,6 @@ struct jump_key { · 14 unmodified lines
277 struct menu *target;274 struct menu *target;
278};275};
279 276
280extern struct file *file_list;
281extern struct file *current_file;
282struct file *lookup_file(const char *name);
283
284extern struct symbol symbol_yes, symbol_no, symbol_mod;277extern struct symbol symbol_yes, symbol_no, symbol_mod;
285extern struct symbol *modules_sym;278extern struct symbol *modules_sym;
286extern int cdebug;279extern int cdebug;
scripts/kconfig/hashtable.h+48−0
@@ -0,0 +1,48 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2#ifndef HASHTABLE_H
3#define HASHTABLE_H
4
5#include "array_size.h"
6#include "list.h"
7
8#define HASH_SIZE(name) (ARRAY_SIZE(name))
9
10#define HASHTABLE_DECLARE(name, size) struct hlist_head name[size]
11
12#define HASHTABLE_DEFINE(name, size) \
13 HASHTABLE_DECLARE(name, size) = \
14 { [0 ... ((size) - 1)] = HLIST_HEAD_INIT }
15
16#define hash_head(table, key) (&(table)[(key) % HASH_SIZE(table)])
17
18/**
19 * hash_add - add an object to a hashtable
20 * @table: hashtable to add to
21 * @node: the &struct hlist_node of the object to be added
22 * @key: the key of the object to be added
23 */
24#define hash_add(table, node, key) \
25 hlist_add_head(node, hash_head(table, key))
26
27/**
28 * hash_for_each - iterate over a hashtable
29 * @table: hashtable to iterate
30 * @obj: the type * to use as a loop cursor for each entry
31 * @member: the name of the hlist_node within the struct
32 */
33#define hash_for_each(table, obj, member) \
34 for (int _bkt = 0; _bkt < HASH_SIZE(table); _bkt++) \
35 hlist_for_each_entry(obj, &table[_bkt], member)
36
37/**
38 * hash_for_each_possible - iterate over all possible objects hashing to the
39 * same bucket
40 * @table: hashtable to iterate
41 * @obj: the type * to use as a loop cursor for each entry
42 * @member: the name of the hlist_node within the struct
43 * @key: the key of the objects to iterate over
44 */
45#define hash_for_each_possible(table, obj, member, key) \
46 hlist_for_each_entry(obj, hash_head(table, key), member)
47
48#endif /* HASHTABLE_H */
scripts/kconfig/internal.h+12−0
@@ -2,8 +2,20 @@ · 1 unmodified line
2#ifndef INTERNAL_H2#ifndef INTERNAL_H
3#define INTERNAL_H3#define INTERNAL_H
4 4
5#include "hashtable.h"
6
7#define SYMBOL_HASHSIZE (1U << 14)
8
9extern HASHTABLE_DECLARE(sym_hashtable, SYMBOL_HASHSIZE);
10
11#define for_all_symbols(sym) \
12 hash_for_each(sym_hashtable, sym, node)
13
5struct menu;14struct menu;
6 15
7extern struct menu *current_menu, *current_entry;16extern struct menu *current_menu, *current_entry;
8 17
18extern const char *cur_filename;
19extern int cur_lineno;
20
9#endif /* INTERNAL_H */21#endif /* INTERNAL_H */
scripts/kconfig/lexer.l+61−69
@@ -14,16 +14,22 @@ · 13 unmodified lines
14#include <string.h>14#include <string.h>
15 15
16#include "lkc.h"16#include "lkc.h"
17#include "preprocess.h"
18
17#include "parser.tab.h"19#include "parser.tab.h"
18 20
19#define YY_DECL static int yylex1(void)21#define YY_DECL static int yylex1(void)
20 22
21#define START_STRSIZE 1623#define START_STRSIZE 16
22 24
23static struct {25/* The Kconfig file currently being parsed. */
24 struct file *file;26const char *cur_filename;
25 int lineno;27
26} current_pos;28/*
29 * The line number of the current statement. This does not match yylineno.
30 * yylineno is used by the lexer, while cur_lineno is used by the parser.
31 */
32int cur_lineno;
27 33
28static int prev_prev_token = T_EOL;34static int prev_prev_token = T_EOL;
29static int prev_token = T_EOL;35static int prev_token = T_EOL;
@@ -33,6 +39,9 @@ static int text_size, text_asize; · 3 unmodified lines
33struct buffer {39struct buffer {
34 struct buffer *parent;40 struct buffer *parent;
35 YY_BUFFER_STATE state;41 YY_BUFFER_STATE state;
42 int yylineno;
43 const char *filename;
44 int source_lineno;
36};45};
37 46
38static struct buffer *current_buf;47static struct buffer *current_buf;
@@ -77,7 +86,7 @@ static void warn_ignored_character(char chr) · 38 unmodified lines
77{86{
78 fprintf(stderr,87 fprintf(stderr,
79 "%s:%d:warning: ignoring unsupported character '%c'\n",88 "%s:%d:warning: ignoring unsupported character '%c'\n",
80 current_file->name, yylineno, chr);89 cur_filename, yylineno, chr);
81}90}
82%}91%}
83 92
@@ -180,7 +189,7 @@ n [A-Za-z0-9_-] · 96 unmodified lines
180 \n {189 \n {
181 fprintf(stderr,190 fprintf(stderr,
182 "%s:%d:warning: multi-line strings not supported\n",191 "%s:%d:warning: multi-line strings not supported\n",
183 zconf_curname(), zconf_lineno());192 cur_filename, cur_lineno);
184 unput('\n');193 unput('\n');
185 BEGIN(INITIAL);194 BEGIN(INITIAL);
186 yylval.string = text;195 yylval.string = text;
@@ -246,9 +255,9 @@ n [A-Za-z0-9_-] · 59 unmodified lines
246 255
247 if (prev_token != T_EOL && prev_token != T_HELPTEXT)256 if (prev_token != T_EOL && prev_token != T_HELPTEXT)
248 fprintf(stderr, "%s:%d:warning: no new line at end of file\n",257 fprintf(stderr, "%s:%d:warning: no new line at end of file\n",
249 current_file->name, yylineno);258 cur_filename, yylineno);
250 259
251 if (current_file) {260 if (current_buf) {
252 zconf_endfile();261 zconf_endfile();
253 return T_EOL;262 return T_EOL;
254 }263 }
@@ -267,19 +276,17 @@ repeat: · 12 unmodified lines
267 token = yylex1();276 token = yylex1();
268 277
269 if (prev_token == T_EOL || prev_token == T_HELPTEXT) {278 if (prev_token == T_EOL || prev_token == T_HELPTEXT) {
270 if (token == T_EOL) {279 if (token == T_EOL)
271 /* Do not pass unneeded T_EOL to the parser. */280 /* Do not pass unneeded T_EOL to the parser. */
272 goto repeat;281 goto repeat;
273 } else {282 else
274 /*283 /*
275 * For the parser, update file/lineno at the first token284 * For the parser, update lineno at the first token
276 * of each statement. Generally, \n is a statement285 * of each statement. Generally, \n is a statement
277 * terminator in Kconfig, but it is not always true286 * terminator in Kconfig, but it is not always true
278 * because \n could be escaped by a backslash.287 * because \n could be escaped by a backslash.
279 */288 */
280 current_pos.file = current_file;289 cur_lineno = yylineno;
281 current_pos.lineno = yylineno;
282 }
283 }290 }
284 291
285 if (prev_prev_token == T_EOL && prev_token == T_WORD &&292 if (prev_prev_token == T_EOL && prev_token == T_WORD &&
@@ -302,8 +309,11 @@ static char *expand_token(const char *in, size_t n) · 16 unmodified lines
302 new_string();309 new_string();
303 append_string(in, n);310 append_string(in, n);
304 311
305 /* get the whole line because we do not know the end of token. */312 /*
306 while ((c = input()) != EOF) {313 * get the whole line because we do not know the end of token.
314 * input() returns 0 (not EOF!) when it reachs the end of file.
315 */
316 while ((c = input()) != 0) {
307 if (c == '\n') {317 if (c == '\n') {
308 unput(c);318 unput(c);
309 break;319 break;
@@ -391,78 +401,60 @@ void zconf_initscan(const char *name) · 81 unmodified lines
391 exit(1);401 exit(1);
392 }402 }
393 403
394 current_buf = xmalloc(sizeof(*current_buf));404 cur_filename = file_lookup(name);
395 memset(current_buf, 0, sizeof(*current_buf));
396
397 current_file = file_lookup(name);
398 yylineno = 1;405 yylineno = 1;
399}406}
400 407
401void zconf_nextfile(const char *name)408void zconf_nextfile(const char *name)
402{409{
403 struct file *iter;
404 struct file *file = file_lookup(name);
405 struct buffer *buf = xmalloc(sizeof(*buf));410 struct buffer *buf = xmalloc(sizeof(*buf));
406 memset(buf, 0, sizeof(*buf));411 bool recur_include = false;
407 412
408 current_buf->state = YY_CURRENT_BUFFER;413 buf->state = YY_CURRENT_BUFFER;
409 yyin = zconf_fopen(file->name);414 buf->yylineno = yylineno;
415 buf->filename = cur_filename;
416 buf->source_lineno = cur_lineno;
417 buf->parent = current_buf;
418 current_buf = buf;
419 yyin = zconf_fopen(name);
410 if (!yyin) {420 if (!yyin) {
411 fprintf(stderr, "%s:%d: can't open file \"%s\"\n",421 fprintf(stderr, "%s:%d: can't open file \"%s\"\n",
412 zconf_curname(), zconf_lineno(), file->name);422 cur_filename, cur_lineno, name);
413 exit(1);423 exit(1);
414 }424 }
415 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));425 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
416 buf->parent = current_buf;
417 current_buf = buf;
418 426
419 current_file->lineno = yylineno;427 for (buf = current_buf; buf; buf = buf->parent) {
420 file->parent = current_file;428 if (!strcmp(buf->filename, name))
421 429 recur_include = true;
422 for (iter = current_file; iter; iter = iter->parent) {
423 if (!strcmp(iter->name, file->name)) {
424 fprintf(stderr,
425 "Recursive inclusion detected.\n"
426 "Inclusion path:\n"
427 " current file : %s\n", file->name);
428 iter = file;
429 do {
430 iter = iter->parent;
431 fprintf(stderr, " included from: %s:%d\n",
432 iter->name, iter->lineno - 1);
433 } while (strcmp(iter->name, file->name));
434 exit(1);
435 }
436 }430 }
437 431
438 yylineno = 1;432 if (recur_include) {
439 current_file = file;433 fprintf(stderr,
440}434 "Recursive inclusion detected.\n"
441 435 "Inclusion path:\n"
442static void zconf_endfile(void)436 " current file : %s\n", name);
443{
444 struct buffer *parent;
445
446 current_file = current_file->parent;
447 if (current_file)
448 yylineno = current_file->lineno;
449 437
450 parent = current_buf->parent;438 for (buf = current_buf; buf; buf = buf->parent)
451 if (parent) {439 fprintf(stderr, " included from: %s:%d\n",
452 fclose(yyin);440 buf->filename, buf->source_lineno);
453 yy_delete_buffer(YY_CURRENT_BUFFER);441 exit(1);
454 yy_switch_to_buffer(parent->state);
455 }442 }
456 free(current_buf);
457 current_buf = parent;
458}
459 443
460int zconf_lineno(void)444 yylineno = 1;
461{445 cur_filename = file_lookup(name);
462 return current_pos.lineno;
463}446}
464 447
465const char *zconf_curname(void)448static void zconf_endfile(void)
466{449{
467 return current_pos.file ? current_pos.file->name : "<none>";450 struct buffer *tmp;
451
452 fclose(yyin);
453 yy_delete_buffer(YY_CURRENT_BUFFER);
454 yy_switch_to_buffer(current_buf->state);
455 yylineno = current_buf->yylineno;
456 cur_filename = current_buf->filename;
457 tmp = current_buf;
458 current_buf = current_buf->parent;
459 free(tmp);
468}460}
scripts/kconfig/list.h+189−65
@@ -2,29 +2,39 @@ · 1 unmodified line
2#ifndef LIST_H2#ifndef LIST_H
3#define LIST_H3#define LIST_H
4 4
5/*5#include <stddef.h>
6 * Copied from include/linux/...
7 */
8 6
9#undef offsetof7#include "list_types.h"
10#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)8
9/* Are two types/vars the same type (ignoring qualifiers)? */
10#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
11 11
12/**12/**
13 * container_of - cast a member of a structure out to the containing structure13 * container_of - cast a member of a structure out to the containing structure
14 * @ptr: the pointer to the member.14 * @ptr: the pointer to the member.
15 * @type: the type of the container struct this is embedded in.15 * @type: the type of the container struct this is embedded in.
16 * @member: the name of the member within the struct.16 * @member: the name of the member within the struct.
17 *17 *
18 */18 */
19#define container_of(ptr, type, member) ({ \19#define container_of(ptr, type, member) ({ \
20 const typeof( ((type *)0)->member ) *__mptr = (ptr); \20 void *__mptr = (void *)(ptr); \
21 (type *)( (char *)__mptr - offsetof(type,member) );})21 _Static_assert(__same_type(*(ptr), ((type *)0)->member) || \
22 22 __same_type(*(ptr), void), \
23 "pointer type mismatch in container_of()"); \
24 ((type *)(__mptr - offsetof(type, member))); })
23 25
24struct list_head {26#define LIST_POISON1 ((void *) 0x100)
25 struct list_head *next, *prev;27#define LIST_POISON2 ((void *) 0x122)
26};
27 28
29/*
30 * Circular doubly linked list implementation.
31 *
32 * Some of the internal functions ("__xxx") are useful when
33 * manipulating whole lists rather than single entries, as
34 * sometimes we already know the next/prev entries and we can
35 * generate better code by using them directly rather than
36 * using the generic single-entry routines.
37 */
28 38
29#define LIST_HEAD_INIT(name) { &(name), &(name) }39#define LIST_HEAD_INIT(name) { &(name), &(name) }
30 40
@@ -32,45 +42,16 @@ struct list_head { · 1 unmodified line
32 struct list_head name = LIST_HEAD_INIT(name)42 struct list_head name = LIST_HEAD_INIT(name)
33 43
34/**44/**
35 * list_entry - get the struct for this entry45 * INIT_LIST_HEAD - Initialize a list_head structure
36 * @ptr: the &struct list_head pointer.46 * @list: list_head structure to be initialized.
37 * @type: the type of the struct this is embedded in.47 *
38 * @member: the name of the list_head within the struct.48 * Initializes the list_head to point to itself. If it is a list header,
39 */49 * the result is an empty list.
40#define list_entry(ptr, type, member) \
41 container_of(ptr, type, member)
42
43/**
44 * list_for_each_entry - iterate over list of given type
45 * @pos: the type * to use as a loop cursor.
46 * @head: the head for your list.
47 * @member: the name of the list_head within the struct.
48 */
49#define list_for_each_entry(pos, head, member) \
50 for (pos = list_entry((head)->next, typeof(*pos), member); \
51 &pos->member != (head); \
52 pos = list_entry(pos->member.next, typeof(*pos), member))
53
54/**
55 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
56 * @pos: the type * to use as a loop cursor.
57 * @n: another type * to use as temporary storage
58 * @head: the head for your list.
59 * @member: the name of the list_head within the struct.
60 */
61#define list_for_each_entry_safe(pos, n, head, member) \
62 for (pos = list_entry((head)->next, typeof(*pos), member), \
63 n = list_entry(pos->member.next, typeof(*pos), member); \
64 &pos->member != (head); \
65 pos = n, n = list_entry(n->member.next, typeof(*n), member))
66
67/**
68 * list_empty - tests whether a list is empty
69 * @head: the list to test.
70 */50 */
71static inline int list_empty(const struct list_head *head)51static inline void INIT_LIST_HEAD(struct list_head *list)
72{52{
73 return head->next == head;53 list->next = list;
54 list->prev = list;
74}55}
75 56
76/*57/*
@@ -79,14 +60,27 @@ static inline int list_empty(const struct list_head *head) · 2 unmodified lines
79 * This is only for internal list manipulation where we know60 * This is only for internal list manipulation where we know
80 * the prev/next entries already!61 * the prev/next entries already!
81 */62 */
82static inline void __list_add(struct list_head *_new,63static inline void __list_add(struct list_head *new,
83 struct list_head *prev,64 struct list_head *prev,
84 struct list_head *next)65 struct list_head *next)
85{66{
86 next->prev = _new;67 next->prev = new;
87 _new->next = next;68 new->next = next;
88 _new->prev = prev;69 new->prev = prev;
89 prev->next = _new;70 prev->next = new;
71}
72
73/**
74 * list_add - add a new entry
75 * @new: new entry to be added
76 * @head: list head to add it after
77 *
78 * Insert a new entry after the specified head.
79 * This is good for implementing stacks.
80 */
81static inline void list_add(struct list_head *new, struct list_head *head)
82{
83 __list_add(new, head, head->next);
90}84}
91 85
92/**86/**
@@ -97,9 +91,9 @@ static inline void __list_add(struct list_head *_new, · 4 unmodified lines
97 * Insert a new entry before the specified head.91 * Insert a new entry before the specified head.
98 * This is useful for implementing queues.92 * This is useful for implementing queues.
99 */93 */
100static inline void list_add_tail(struct list_head *_new, struct list_head *head)94static inline void list_add_tail(struct list_head *new, struct list_head *head)
101{95{
102 __list_add(_new, head->prev, head);96 __list_add(new, head->prev, head);
103}97}
104 98
105/*99/*
@@ -115,8 +109,11 @@ static inline void __list_del(struct list_head *prev, struct list_head *next) · 9 unmodified lines
115 prev->next = next;109 prev->next = next;
116}110}
117 111
118#define LIST_POISON1 ((void *) 0x00100100)112static inline void __list_del_entry(struct list_head *entry)
119#define LIST_POISON2 ((void *) 0x00200200)113{
114 __list_del(entry->prev, entry->next);
115}
116
120/**117/**
121 * list_del - deletes entry from list.118 * list_del - deletes entry from list.
122 * @entry: the element to delete from the list.119 * @entry: the element to delete from the list.
@@ -125,8 +122,135 @@ static inline void __list_del(struct list_head *prev, struct list_head *next) · 2 unmodified lines
125 */122 */
126static inline void list_del(struct list_head *entry)123static inline void list_del(struct list_head *entry)
127{124{
128 __list_del(entry->prev, entry->next);125 __list_del_entry(entry);
129 entry->next = (struct list_head*)LIST_POISON1;126 entry->next = LIST_POISON1;
130 entry->prev = (struct list_head*)LIST_POISON2;127 entry->prev = LIST_POISON2;
128}
129
130/**
131 * list_is_head - tests whether @list is the list @head
132 * @list: the entry to test
133 * @head: the head of the list
134 */
135static inline int list_is_head(const struct list_head *list, const struct list_head *head)
136{
137 return list == head;
138}
139
140/**
141 * list_empty - tests whether a list is empty
142 * @head: the list to test.
143 */
144static inline int list_empty(const struct list_head *head)
145{
146 return head->next == head;
147}
148
149/**
150 * list_entry - get the struct for this entry
151 * @ptr: the &struct list_head pointer.
152 * @type: the type of the struct this is embedded in.
153 * @member: the name of the list_head within the struct.
154 */
155#define list_entry(ptr, type, member) \
156 container_of(ptr, type, member)
157
158/**
159 * list_first_entry - get the first element from a list
160 * @ptr: the list head to take the element from.
161 * @type: the type of the struct this is embedded in.
162 * @member: the name of the list_head within the struct.
163 *
164 * Note, that list is expected to be not empty.
165 */
166#define list_first_entry(ptr, type, member) \
167 list_entry((ptr)->next, type, member)
168
169/**
170 * list_next_entry - get the next element in list
171 * @pos: the type * to cursor
172 * @member: the name of the list_head within the struct.
173 */
174#define list_next_entry(pos, member) \
175 list_entry((pos)->member.next, typeof(*(pos)), member)
176
177/**
178 * list_entry_is_head - test if the entry points to the head of the list
179 * @pos: the type * to cursor
180 * @head: the head for your list.
181 * @member: the name of the list_head within the struct.
182 */
183#define list_entry_is_head(pos, head, member) \
184 (&pos->member == (head))
185
186/**
187 * list_for_each_entry - iterate over list of given type
188 * @pos: the type * to use as a loop cursor.
189 * @head: the head for your list.
190 * @member: the name of the list_head within the struct.
191 */
192#define list_for_each_entry(pos, head, member) \
193 for (pos = list_first_entry(head, typeof(*pos), member); \
194 !list_entry_is_head(pos, head, member); \
195 pos = list_next_entry(pos, member))
196
197/**
198 * list_for_each_entry_safe - iterate over list of given type. Safe against removal of list entry
199 * @pos: the type * to use as a loop cursor.
200 * @n: another type * to use as temporary storage
201 * @head: the head for your list.
202 * @member: the name of the list_head within the struct.
203 */
204#define list_for_each_entry_safe(pos, n, head, member) \
205 for (pos = list_first_entry(head, typeof(*pos), member), \
206 n = list_next_entry(pos, member); \
207 !list_entry_is_head(pos, head, member); \
208 pos = n, n = list_next_entry(n, member))
209
210/*
211 * Double linked lists with a single pointer list head.
212 * Mostly useful for hash tables where the two pointer list head is
213 * too wasteful.
214 * You lose the ability to access the tail in O(1).
215 */
216
217#define HLIST_HEAD_INIT { .first = NULL }
218
219/**
220 * hlist_add_head - add a new entry at the beginning of the hlist
221 * @n: new entry to be added
222 * @h: hlist head to add it after
223 *
224 * Insert a new entry after the specified head.
225 * This is good for implementing stacks.
226 */
227static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
228{
229 struct hlist_node *first = h->first;
230
231 n->next = first;
232 if (first)
233 first->pprev = &n->next;
234 h->first = n;
235 n->pprev = &h->first;
131}236}
132#endif237
238#define hlist_entry(ptr, type, member) container_of(ptr, type, member)
239
240#define hlist_entry_safe(ptr, type, member) \
241 ({ typeof(ptr) ____ptr = (ptr); \
242 ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
243 })
244
245/**
246 * hlist_for_each_entry - iterate over list of given type
247 * @pos: the type * to use as a loop cursor.
248 * @head: the head for your list.
249 * @member: the name of the hlist_node within the struct.
250 */
251#define hlist_for_each_entry(pos, head, member) \
252 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
253 pos; \
254 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
255
256#endif /* LIST_H */
scripts/kconfig/list_types.h+17−0
@@ -0,0 +1,17 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef LIST_TYPES_H
3#define LIST_TYPES_H
4
5struct list_head {
6 struct list_head *next, *prev;
7};
8
9struct hlist_head {
10 struct hlist_node *first;
11};
12
13struct hlist_node {
14 struct hlist_node *next, **pprev;
15};
16
17#endif /* LIST_TYPES_H */
scripts/kconfig/lkc.h+3−3
@@ -36,10 +36,9 @@ void zconf_starthelp(void); · 35 unmodified lines
36FILE *zconf_fopen(const char *name);36FILE *zconf_fopen(const char *name);
37void zconf_initscan(const char *name);37void zconf_initscan(const char *name);
38void zconf_nextfile(const char *name);38void zconf_nextfile(const char *name);
39int zconf_lineno(void);
40const char *zconf_curname(void);
41 39
42/* confdata.c */40/* confdata.c */
41extern struct gstr autoconf_cmd;
43const char *conf_get_configname(void);42const char *conf_get_configname(void);
44void set_all_choice_values(struct symbol *csym);43void set_all_choice_values(struct symbol *csym);
45 44
@@ -53,7 +52,8 @@ static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) · 7 unmodified lines
53}52}
54 53
55/* util.c */54/* util.c */
56struct file *file_lookup(const char *name);55unsigned int strhash(const char *s);
56const char *file_lookup(const char *name);
57void *xmalloc(size_t size);57void *xmalloc(size_t size);
58void *xcalloc(size_t nmemb, size_t size);58void *xcalloc(size_t nmemb, size_t size);
59void *xrealloc(void *p, size_t size);59void *xrealloc(void *p, size_t size);
scripts/kconfig/lkc_proto.h+0−15
@@ -18,8 +18,6 @@ void conf_set_message_callback(void (*fn)(const char *s)); · 17 unmodified lines
18bool conf_errors(void);18bool conf_errors(void);
19 19
20/* symbol.c */20/* symbol.c */
21extern struct symbol * symbol_hash[SYMBOL_HASHSIZE];
22
23struct symbol * sym_lookup(const char *name, int flags);21struct symbol * sym_lookup(const char *name, int flags);
24struct symbol * sym_find(const char *name);22struct symbol * sym_find(const char *name);
25void print_symbol_for_listconfig(struct symbol *sym);23void print_symbol_for_listconfig(struct symbol *sym);
@@ -40,19 +38,6 @@ const char * sym_get_string_value(struct symbol *sym); · 14 unmodified lines
40 38
41const char * prop_get_type_name(enum prop_type type);39const char * prop_get_type_name(enum prop_type type);
42 40
43/* preprocess.c */
44enum variable_flavor {
45 VAR_SIMPLE,
46 VAR_RECURSIVE,
47 VAR_APPEND,
48};
49void env_write_dep(FILE *f, const char *auto_conf_name);
50void variable_add(const char *name, const char *value,
51 enum variable_flavor flavor);
52void variable_all_del(void);
53char *expand_dollar(const char **str);
54char *expand_one_token(const char **str);
55
56/* expr.c */41/* expr.c */
57void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken);42void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken);
58 43
scripts/kconfig/lxdialog/checklist.c+2−3
@@ -188,9 +188,8 @@ do_resize: · 187 unmodified lines
188 188
189 print_buttons(dialog, height, width, 0);189 print_buttons(dialog, height, width, 0);
190 190
191 wnoutrefresh(dialog);191 wmove(list, choice, check_x + 1);
192 wnoutrefresh(list);192 wrefresh(list);
193 doupdate();
194 193
195 while (key != KEY_ESC) {194 while (key != KEY_ESC) {
196 key = wgetch(dialog);195 key = wgetch(dialog);
scripts/kconfig/lxdialog/dialog.h+0−4
@@ -91,10 +91,6 @@ struct dialog_info { · 90 unmodified lines
91 struct dialog_color button_label_active;91 struct dialog_color button_label_active;
92 struct dialog_color button_label_inactive;92 struct dialog_color button_label_inactive;
93 struct dialog_color inputbox;93 struct dialog_color inputbox;
94 struct dialog_color inputbox_border;
95 struct dialog_color searchbox;
96 struct dialog_color searchbox_title;
97 struct dialog_color searchbox_border;
98 struct dialog_color position_indicator;94 struct dialog_color position_indicator;
99 struct dialog_color menubox;95 struct dialog_color menubox;
100 struct dialog_color menubox_border;96 struct dialog_color menubox_border;
scripts/kconfig/lxdialog/util.c+1−19
@@ -29,10 +29,6 @@ static void set_mono_theme(void) · 28 unmodified lines
29 dlg.button_label_active.atr = A_REVERSE;29 dlg.button_label_active.atr = A_REVERSE;
30 dlg.button_label_inactive.atr = A_NORMAL;30 dlg.button_label_inactive.atr = A_NORMAL;
31 dlg.inputbox.atr = A_NORMAL;31 dlg.inputbox.atr = A_NORMAL;
32 dlg.inputbox_border.atr = A_NORMAL;
33 dlg.searchbox.atr = A_NORMAL;
34 dlg.searchbox_title.atr = A_BOLD;
35 dlg.searchbox_border.atr = A_NORMAL;
36 dlg.position_indicator.atr = A_BOLD;32 dlg.position_indicator.atr = A_BOLD;
37 dlg.menubox.atr = A_NORMAL;33 dlg.menubox.atr = A_NORMAL;
38 dlg.menubox_border.atr = A_NORMAL;34 dlg.menubox_border.atr = A_NORMAL;
@@ -69,10 +65,6 @@ static void set_classic_theme(void) · 30 unmodified lines
69 DLG_COLOR(button_label_active, COLOR_YELLOW, COLOR_BLUE, true);65 DLG_COLOR(button_label_active, COLOR_YELLOW, COLOR_BLUE, true);
70 DLG_COLOR(button_label_inactive, COLOR_BLACK, COLOR_WHITE, true);66 DLG_COLOR(button_label_inactive, COLOR_BLACK, COLOR_WHITE, true);
71 DLG_COLOR(inputbox, COLOR_BLACK, COLOR_WHITE, false);67 DLG_COLOR(inputbox, COLOR_BLACK, COLOR_WHITE, false);
72 DLG_COLOR(inputbox_border, COLOR_BLACK, COLOR_WHITE, false);
73 DLG_COLOR(searchbox, COLOR_BLACK, COLOR_WHITE, false);
74 DLG_COLOR(searchbox_title, COLOR_YELLOW, COLOR_WHITE, true);
75 DLG_COLOR(searchbox_border, COLOR_WHITE, COLOR_WHITE, true);
76 DLG_COLOR(position_indicator, COLOR_YELLOW, COLOR_WHITE, true);68 DLG_COLOR(position_indicator, COLOR_YELLOW, COLOR_WHITE, true);
77 DLG_COLOR(menubox, COLOR_BLACK, COLOR_WHITE, false);69 DLG_COLOR(menubox, COLOR_BLACK, COLOR_WHITE, false);
78 DLG_COLOR(menubox_border, COLOR_WHITE, COLOR_WHITE, true);70 DLG_COLOR(menubox_border, COLOR_WHITE, COLOR_WHITE, true);
@@ -101,14 +93,9 @@ static void set_blackbg_theme(void) · 22 unmodified lines
101 DLG_COLOR(button_key_active, COLOR_YELLOW, COLOR_RED, true);93 DLG_COLOR(button_key_active, COLOR_YELLOW, COLOR_RED, true);
102 DLG_COLOR(button_key_inactive, COLOR_RED, COLOR_BLACK, false);94 DLG_COLOR(button_key_inactive, COLOR_RED, COLOR_BLACK, false);
103 DLG_COLOR(button_label_active, COLOR_WHITE, COLOR_RED, false);95 DLG_COLOR(button_label_active, COLOR_WHITE, COLOR_RED, false);
104 DLG_COLOR(button_label_inactive, COLOR_BLACK, COLOR_BLACK, true);96 DLG_COLOR(button_label_inactive, COLOR_WHITE, COLOR_BLACK, false);
105 97
106 DLG_COLOR(inputbox, COLOR_YELLOW, COLOR_BLACK, false);98 DLG_COLOR(inputbox, COLOR_YELLOW, COLOR_BLACK, false);
107 DLG_COLOR(inputbox_border, COLOR_YELLOW, COLOR_BLACK, false);
108
109 DLG_COLOR(searchbox, COLOR_YELLOW, COLOR_BLACK, false);
110 DLG_COLOR(searchbox_title, COLOR_YELLOW, COLOR_BLACK, true);
111 DLG_COLOR(searchbox_border, COLOR_BLACK, COLOR_BLACK, true);
112 99
113 DLG_COLOR(position_indicator, COLOR_RED, COLOR_BLACK, false);100 DLG_COLOR(position_indicator, COLOR_RED, COLOR_BLACK, false);
114 101
@@ -136,7 +123,6 @@ static void set_bluetitle_theme(void) · 21 unmodified lines
136 DLG_COLOR(title, COLOR_BLUE, COLOR_WHITE, true);123 DLG_COLOR(title, COLOR_BLUE, COLOR_WHITE, true);
137 DLG_COLOR(button_key_active, COLOR_YELLOW, COLOR_BLUE, true);124 DLG_COLOR(button_key_active, COLOR_YELLOW, COLOR_BLUE, true);
138 DLG_COLOR(button_label_active, COLOR_WHITE, COLOR_BLUE, true);125 DLG_COLOR(button_label_active, COLOR_WHITE, COLOR_BLUE, true);
139 DLG_COLOR(searchbox_title, COLOR_BLUE, COLOR_WHITE, true);
140 DLG_COLOR(position_indicator, COLOR_BLUE, COLOR_WHITE, true);126 DLG_COLOR(position_indicator, COLOR_BLUE, COLOR_WHITE, true);
141 DLG_COLOR(tag, COLOR_BLUE, COLOR_WHITE, true);127 DLG_COLOR(tag, COLOR_BLUE, COLOR_WHITE, true);
142 DLG_COLOR(tag_key, COLOR_BLUE, COLOR_WHITE, true);128 DLG_COLOR(tag_key, COLOR_BLUE, COLOR_WHITE, true);
@@ -189,10 +175,6 @@ static void init_dialog_colors(void) · 46 unmodified lines
189 init_one_color(&dlg.button_label_active);175 init_one_color(&dlg.button_label_active);
190 init_one_color(&dlg.button_label_inactive);176 init_one_color(&dlg.button_label_inactive);
191 init_one_color(&dlg.inputbox);177 init_one_color(&dlg.inputbox);
192 init_one_color(&dlg.inputbox_border);
193 init_one_color(&dlg.searchbox);
194 init_one_color(&dlg.searchbox_title);
195 init_one_color(&dlg.searchbox_border);
196 init_one_color(&dlg.position_indicator);178 init_one_color(&dlg.position_indicator);
197 init_one_color(&dlg.menubox);179 init_one_color(&dlg.menubox);
198 init_one_color(&dlg.menubox_border);180 init_one_color(&dlg.menubox_border);
scripts/kconfig/mconf.c+1−0
@@ -19,6 +19,7 @@ · 18 unmodified lines
19#include <signal.h>19#include <signal.h>
20#include <unistd.h>20#include <unistd.h>
21 21
22#include "list.h"
22#include "lkc.h"23#include "lkc.h"
23#include "lxdialog/dialog.h"24#include "lxdialog/dialog.h"
24#include "mnconf-common.h"25#include "mnconf-common.h"
scripts/kconfig/menu.c+20−28
@@ -10,20 +10,18 @@ · 9 unmodified lines
10 10
11#include "lkc.h"11#include "lkc.h"
12#include "internal.h"12#include "internal.h"
13#include "list.h"
13 14
14static const char nohelp_text[] = "There is no help available for this option.";15static const char nohelp_text[] = "There is no help available for this option.";
15 16
16struct menu rootmenu;17struct menu rootmenu;
17static struct menu **last_entry_ptr;18static struct menu **last_entry_ptr;
18 19
19struct file *file_list;
20struct file *current_file;
21
22void menu_warn(struct menu *menu, const char *fmt, ...)20void menu_warn(struct menu *menu, const char *fmt, ...)
23{21{
24 va_list ap;22 va_list ap;
25 va_start(ap, fmt);23 va_start(ap, fmt);
26 fprintf(stderr, "%s:%d:warning: ", menu->file->name, menu->lineno);24 fprintf(stderr, "%s:%d:warning: ", menu->filename, menu->lineno);
27 vfprintf(stderr, fmt, ap);25 vfprintf(stderr, fmt, ap);
28 fprintf(stderr, "\n");26 fprintf(stderr, "\n");
29 va_end(ap);27 va_end(ap);
@@ -33,7 +31,7 @@ static void prop_warn(struct property *prop, const char *fmt, ...) · 3 unmodified lines
33{31{
34 va_list ap;32 va_list ap;
35 va_start(ap, fmt);33 va_start(ap, fmt);
36 fprintf(stderr, "%s:%d:warning: ", prop->file->name, prop->lineno);34 fprintf(stderr, "%s:%d:warning: ", prop->filename, prop->lineno);
37 vfprintf(stderr, fmt, ap);35 vfprintf(stderr, fmt, ap);
38 fprintf(stderr, "\n");36 fprintf(stderr, "\n");
39 va_end(ap);37 va_end(ap);
@@ -53,14 +51,16 @@ void menu_add_entry(struct symbol *sym) · 13 unmodified lines
53 memset(menu, 0, sizeof(*menu));51 memset(menu, 0, sizeof(*menu));
54 menu->sym = sym;52 menu->sym = sym;
55 menu->parent = current_menu;53 menu->parent = current_menu;
56 menu->file = current_file;54 menu->filename = cur_filename;
57 menu->lineno = zconf_lineno();55 menu->lineno = cur_lineno;
58 56
59 *last_entry_ptr = menu;57 *last_entry_ptr = menu;
60 last_entry_ptr = &menu->next;58 last_entry_ptr = &menu->next;
61 current_entry = menu;59 current_entry = menu;
62 if (sym)60 if (sym) {
63 menu_add_symbol(P_SYMBOL, sym, NULL);61 menu_add_symbol(P_SYMBOL, sym, NULL);
62 list_add_tail(&menu->link, &sym->menus);
63 }
64}64}
65 65
66struct menu *menu_add_menu(void)66struct menu *menu_add_menu(void)
@@ -134,8 +134,8 @@ static struct property *menu_add_prop(enum prop_type type, struct expr *expr, · 67 unmodified lines
134 prop = xmalloc(sizeof(*prop));134 prop = xmalloc(sizeof(*prop));
135 memset(prop, 0, sizeof(*prop));135 memset(prop, 0, sizeof(*prop));
136 prop->type = type;136 prop->type = type;
137 prop->file = current_file;137 prop->filename = cur_filename;
138 prop->lineno = zconf_lineno();138 prop->lineno = cur_lineno;
139 prop->menu = current_entry;139 prop->menu = current_entry;
140 prop->expr = expr;140 prop->expr = expr;
141 prop->visible.expr = dep;141 prop->visible.expr = dep;
@@ -307,12 +307,6 @@ void menu_finalize(struct menu *parent) · 165 unmodified lines
307 }307 }
308 }308 }
309 }309 }
310 /* set the type of the remaining choice values */
311 for (menu = parent->list; menu; menu = menu->next) {
312 current_entry = menu;
313 if (menu->sym && menu->sym->type == S_UNKNOWN)
314 menu_set_type(sym->type);
315 }
316 310
317 /*311 /*
318 * Use the choice itself as the parent dependency of312 * Use the choice itself as the parent dependency of
@@ -567,9 +561,6 @@ void menu_finalize(struct menu *parent) · 248 unmodified lines
567 if (sym->type == S_UNKNOWN)561 if (sym->type == S_UNKNOWN)
568 menu_warn(parent, "config symbol defined without type");562 menu_warn(parent, "config symbol defined without type");
569 563
570 if (sym_is_choice(sym) && !parent->prompt)
571 menu_warn(parent, "choice must have a prompt");
572
573 /* Check properties connected to this symbol */564 /* Check properties connected to this symbol */
574 sym_check_prop(sym);565 sym_check_prop(sym);
575 sym->flags |= SYMBOL_WARNED;566 sym->flags |= SYMBOL_WARNED;
@@ -676,7 +667,7 @@ struct menu *menu_get_parent_menu(struct menu *menu) · 100 unmodified lines
676static void get_def_str(struct gstr *r, struct menu *menu)667static void get_def_str(struct gstr *r, struct menu *menu)
677{668{
678 str_printf(r, "Defined at %s:%d\n",669 str_printf(r, "Defined at %s:%d\n",
679 menu->file->name, menu->lineno);670 menu->filename, menu->lineno);
680}671}
681 672
682static void get_dep_str(struct gstr *r, struct expr *expr, const char *prefix)673static void get_dep_str(struct gstr *r, struct expr *expr, const char *prefix)
@@ -777,6 +768,7 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym, · 94 unmodified lines
777 struct list_head *head)768 struct list_head *head)
778{769{
779 struct property *prop;770 struct property *prop;
771 struct menu *menu;
780 772
781 if (sym && sym->name) {773 if (sym && sym->name) {
782 str_printf(r, "Symbol: %s [=%s]\n", sym->name,774 str_printf(r, "Symbol: %s [=%s]\n", sym->name,
@@ -793,17 +785,17 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym, · 10 unmodified lines
793 }785 }
794 786
795 /* Print the definitions with prompts before the ones without */787 /* Print the definitions with prompts before the ones without */
796 for_all_properties(sym, prop, P_SYMBOL) {788 list_for_each_entry(menu, &sym->menus, link) {
797 if (prop->menu->prompt) {789 if (menu->prompt) {
798 get_def_str(r, prop->menu);790 get_def_str(r, menu);
799 get_prompt_str(r, prop->menu->prompt, head);791 get_prompt_str(r, menu->prompt, head);
800 }792 }
801 }793 }
802 794
803 for_all_properties(sym, prop, P_SYMBOL) {795 list_for_each_entry(menu, &sym->menus, link) {
804 if (!prop->menu->prompt) {796 if (!menu->prompt) {
805 get_def_str(r, prop->menu);797 get_def_str(r, menu);
806 get_dep_str(r, prop->menu->dep, " Depends on: ");798 get_dep_str(r, menu->dep, " Depends on: ");
807 }799 }
808 }800 }
809 801
scripts/kconfig/nconf.c+1−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
11#include <strings.h>11#include <strings.h>
12#include <stdlib.h>12#include <stdlib.h>
13 13
14#include "list.h"
14#include "lkc.h"15#include "lkc.h"
15#include "mnconf-common.h"16#include "mnconf-common.h"
16#include "nconf.h"17#include "nconf.h"
scripts/kconfig/parser.y+76−49
@@ -13,6 +13,7 @@ · 12 unmodified lines
13 13
14#include "lkc.h"14#include "lkc.h"
15#include "internal.h"15#include "internal.h"
16#include "preprocess.h"
16 17
17#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)18#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
18 19
@@ -27,8 +28,6 @@ static void zconf_error(const char *err, ...); · 8 unmodified lines
27static bool zconf_endtoken(const char *tokenname,28static bool zconf_endtoken(const char *tokenname,
28 const char *expected_tokenname);29 const char *expected_tokenname);
29 30
30struct symbol *symbol_hash[SYMBOL_HASHSIZE];
31
32struct menu *current_menu, *current_entry;31struct menu *current_menu, *current_entry;
33 32
34%}33%}
@@ -95,12 +94,12 @@ struct menu *current_menu, *current_entry; · 60 unmodified lines
95%type <expr> if_expr94%type <expr> if_expr
96%type <string> end95%type <string> end
97%type <menu> if_entry menu_entry choice_entry96%type <menu> if_entry menu_entry choice_entry
98%type <string> word_opt assign_val97%type <string> assign_val
99%type <flavor> assign_op98%type <flavor> assign_op
100 99
101%destructor {100%destructor {
102 fprintf(stderr, "%s:%d: missing end statement for this entry\n",101 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
103 $$->file->name, $$->lineno);102 $$->filename, $$->lineno);
104 if (current_menu == $$)103 if (current_menu == $$)
105 menu_end_menu();104 menu_end_menu();
106} if_entry menu_entry choice_entry105} if_entry menu_entry choice_entry
@@ -143,19 +142,19 @@ config_entry_start: T_CONFIG nonconst_symbol T_EOL · 36 unmodified lines
143{142{
144 $2->flags |= SYMBOL_OPTIONAL;143 $2->flags |= SYMBOL_OPTIONAL;
145 menu_add_entry($2);144 menu_add_entry($2);
146 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), $2->name);145 printd(DEBUG_PARSE, "%s:%d:config %s\n", cur_filename, cur_lineno, $2->name);
147};146};
148 147
149config_stmt: config_entry_start config_option_list148config_stmt: config_entry_start config_option_list
150{149{
151 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());150 printd(DEBUG_PARSE, "%s:%d:endconfig\n", cur_filename, cur_lineno);
152};151};
153 152
154menuconfig_entry_start: T_MENUCONFIG nonconst_symbol T_EOL153menuconfig_entry_start: T_MENUCONFIG nonconst_symbol T_EOL
155{154{
156 $2->flags |= SYMBOL_OPTIONAL;155 $2->flags |= SYMBOL_OPTIONAL;
157 menu_add_entry($2);156 menu_add_entry($2);
158 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), $2->name);157 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", cur_filename, cur_lineno, $2->name);
159};158};
160 159
161menuconfig_stmt: menuconfig_entry_start config_option_list160menuconfig_stmt: menuconfig_entry_start config_option_list
@@ -164,7 +163,7 @@ menuconfig_stmt: menuconfig_entry_start config_option_list · 2 unmodified lines
164 current_entry->prompt->type = P_MENU;163 current_entry->prompt->type = P_MENU;
165 else164 else
166 zconfprint("warning: menuconfig statement without prompt");165 zconfprint("warning: menuconfig statement without prompt");
167 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());166 printd(DEBUG_PARSE, "%s:%d:endconfig\n", cur_filename, cur_lineno);
168};167};
169 168
170config_option_list:169config_option_list:
@@ -177,15 +176,13 @@ config_option_list: · 6 unmodified lines
177config_option: type prompt_stmt_opt T_EOL176config_option: type prompt_stmt_opt T_EOL
178{177{
179 menu_set_type($1);178 menu_set_type($1);
180 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",179 printd(DEBUG_PARSE, "%s:%d:type(%u)\n", cur_filename, cur_lineno, $1);
181 zconf_curname(), zconf_lineno(),
182 $1);
183};180};
184 181
185config_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL182config_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL
186{183{
187 menu_add_prompt(P_PROMPT, $2, $3);184 menu_add_prompt(P_PROMPT, $2, $3);
188 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());185 printd(DEBUG_PARSE, "%s:%d:prompt\n", cur_filename, cur_lineno);
189};186};
190 187
191config_option: default expr if_expr T_EOL188config_option: default expr if_expr T_EOL
@@ -193,27 +190,26 @@ config_option: default expr if_expr T_EOL · 1 unmodified line
193 menu_add_expr(P_DEFAULT, $2, $3);190 menu_add_expr(P_DEFAULT, $2, $3);
194 if ($1 != S_UNKNOWN)191 if ($1 != S_UNKNOWN)
195 menu_set_type($1);192 menu_set_type($1);
196 printd(DEBUG_PARSE, "%s:%d:default(%u)\n",193 printd(DEBUG_PARSE, "%s:%d:default(%u)\n", cur_filename, cur_lineno,
197 zconf_curname(), zconf_lineno(),
198 $1);194 $1);
199};195};
200 196
201config_option: T_SELECT nonconst_symbol if_expr T_EOL197config_option: T_SELECT nonconst_symbol if_expr T_EOL
202{198{
203 menu_add_symbol(P_SELECT, $2, $3);199 menu_add_symbol(P_SELECT, $2, $3);
204 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());200 printd(DEBUG_PARSE, "%s:%d:select\n", cur_filename, cur_lineno);
205};201};
206 202
207config_option: T_IMPLY nonconst_symbol if_expr T_EOL203config_option: T_IMPLY nonconst_symbol if_expr T_EOL
208{204{
209 menu_add_symbol(P_IMPLY, $2, $3);205 menu_add_symbol(P_IMPLY, $2, $3);
210 printd(DEBUG_PARSE, "%s:%d:imply\n", zconf_curname(), zconf_lineno());206 printd(DEBUG_PARSE, "%s:%d:imply\n", cur_filename, cur_lineno);
211};207};
212 208
213config_option: T_RANGE symbol symbol if_expr T_EOL209config_option: T_RANGE symbol symbol if_expr T_EOL
214{210{
215 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,$2, $3), $4);211 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,$2, $3), $4);
216 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());212 printd(DEBUG_PARSE, "%s:%d:range\n", cur_filename, cur_lineno);
217};213};
218 214
219config_option: T_MODULES T_EOL215config_option: T_MODULES T_EOL
@@ -226,18 +222,23 @@ config_option: T_MODULES T_EOL · 6 unmodified lines
226 222
227/* choice entry */223/* choice entry */
228 224
229choice: T_CHOICE word_opt T_EOL225choice: T_CHOICE T_EOL
230{226{
231 struct symbol *sym = sym_lookup($2, SYMBOL_CHOICE);227 struct symbol *sym = sym_lookup(NULL, SYMBOL_CHOICE);
232 sym->flags |= SYMBOL_NO_WRITE;228 sym->flags |= SYMBOL_NO_WRITE;
233 menu_add_entry(sym);229 menu_add_entry(sym);
234 menu_add_expr(P_CHOICE, NULL, NULL);230 menu_add_expr(P_CHOICE, NULL, NULL);
235 free($2);231 printd(DEBUG_PARSE, "%s:%d:choice\n", cur_filename, cur_lineno);
236 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
237};232};
238 233
239choice_entry: choice choice_option_list234choice_entry: choice choice_option_list
240{235{
236 if (!current_entry->prompt) {
237 fprintf(stderr, "%s:%d: error: choice must have a prompt\n",
238 current_entry->filename, current_entry->lineno);
239 yynerrs++;
240 }
241
241 $$ = menu_add_menu();242 $$ = menu_add_menu();
242};243};
243 244
@@ -245,7 +246,7 @@ choice_end: end · 1 unmodified line
245{246{
246 if (zconf_endtoken($1, "choice")) {247 if (zconf_endtoken($1, "choice")) {
247 menu_end_menu();248 menu_end_menu();
248 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());249 printd(DEBUG_PARSE, "%s:%d:endchoice\n", cur_filename, cur_lineno);
249 }250 }
250};251};
251 252
@@ -262,27 +263,25 @@ choice_option_list: · 10 unmodified lines
262choice_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL263choice_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL
263{264{
264 menu_add_prompt(P_PROMPT, $2, $3);265 menu_add_prompt(P_PROMPT, $2, $3);
265 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());266 printd(DEBUG_PARSE, "%s:%d:prompt\n", cur_filename, cur_lineno);
266};267};
267 268
268choice_option: logic_type prompt_stmt_opt T_EOL269choice_option: logic_type prompt_stmt_opt T_EOL
269{270{
270 menu_set_type($1);271 menu_set_type($1);
271 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",272 printd(DEBUG_PARSE, "%s:%d:type(%u)\n", cur_filename, cur_lineno, $1);
272 zconf_curname(), zconf_lineno(), $1);
273};273};
274 274
275choice_option: T_OPTIONAL T_EOL275choice_option: T_OPTIONAL T_EOL
276{276{
277 current_entry->sym->flags |= SYMBOL_OPTIONAL;277 current_entry->sym->flags |= SYMBOL_OPTIONAL;
278 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());278 printd(DEBUG_PARSE, "%s:%d:optional\n", cur_filename, cur_lineno);
279};279};
280 280
281choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL281choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL
282{282{
283 menu_add_symbol(P_DEFAULT, $2, $3);283 menu_add_symbol(P_DEFAULT, $2, $3);
284 printd(DEBUG_PARSE, "%s:%d:default\n",284 printd(DEBUG_PARSE, "%s:%d:default\n", cur_filename, cur_lineno);
285 zconf_curname(), zconf_lineno());
286};285};
287 286
288type:287type:
@@ -304,7 +303,7 @@ default: · 15 unmodified lines
304 303
305if_entry: T_IF expr T_EOL304if_entry: T_IF expr T_EOL
306{305{
307 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());306 printd(DEBUG_PARSE, "%s:%d:if\n", cur_filename, cur_lineno);
308 menu_add_entry(NULL);307 menu_add_entry(NULL);
309 menu_add_dep($2);308 menu_add_dep($2);
310 $$ = menu_add_menu();309 $$ = menu_add_menu();
@@ -314,7 +313,7 @@ if_end: end · 3 unmodified lines
314{313{
315 if (zconf_endtoken($1, "if")) {314 if (zconf_endtoken($1, "if")) {
316 menu_end_menu();315 menu_end_menu();
317 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());316 printd(DEBUG_PARSE, "%s:%d:endif\n", cur_filename, cur_lineno);
318 }317 }
319};318};
320 319
@@ -330,7 +329,7 @@ menu: T_MENU T_WORD_QUOTE T_EOL · 9 unmodified lines
330{329{
331 menu_add_entry(NULL);330 menu_add_entry(NULL);
332 menu_add_prompt(P_MENU, $2, NULL);331 menu_add_prompt(P_MENU, $2, NULL);
333 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());332 printd(DEBUG_PARSE, "%s:%d:menu\n", cur_filename, cur_lineno);
334};333};
335 334
336menu_entry: menu menu_option_list335menu_entry: menu menu_option_list
@@ -342,7 +341,7 @@ menu_end: end · 5 unmodified lines
342{341{
343 if (zconf_endtoken($1, "menu")) {342 if (zconf_endtoken($1, "menu")) {
344 menu_end_menu();343 menu_end_menu();
345 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());344 printd(DEBUG_PARSE, "%s:%d:endmenu\n", cur_filename, cur_lineno);
346 }345 }
347};346};
348 347
@@ -357,7 +356,7 @@ menu_option_list: · 8 unmodified lines
357 356
358source_stmt: T_SOURCE T_WORD_QUOTE T_EOL357source_stmt: T_SOURCE T_WORD_QUOTE T_EOL
359{358{
360 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2);359 printd(DEBUG_PARSE, "%s:%d:source %s\n", cur_filename, cur_lineno, $2);
361 zconf_nextfile($2);360 zconf_nextfile($2);
362 free($2);361 free($2);
363};362};
@@ -368,7 +367,7 @@ comment: T_COMMENT T_WORD_QUOTE T_EOL · 4 unmodified lines
368{367{
369 menu_add_entry(NULL);368 menu_add_entry(NULL);
370 menu_add_prompt(P_COMMENT, $2, NULL);369 menu_add_prompt(P_COMMENT, $2, NULL);
371 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());370 printd(DEBUG_PARSE, "%s:%d:comment\n", cur_filename, cur_lineno);
372};371};
373 372
374comment_stmt: comment comment_option_list373comment_stmt: comment comment_option_list
@@ -383,7 +382,7 @@ comment_option_list: · 8 unmodified lines
383 382
384help_start: T_HELP T_EOL383help_start: T_HELP T_EOL
385{384{
386 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());385 printd(DEBUG_PARSE, "%s:%d:help\n", cur_filename, cur_lineno);
387 zconf_starthelp();386 zconf_starthelp();
388};387};
389 388
@@ -408,7 +407,7 @@ help: help_start T_HELPTEXT · 18 unmodified lines
408depends: T_DEPENDS T_ON expr T_EOL407depends: T_DEPENDS T_ON expr T_EOL
409{408{
410 menu_add_dep($3);409 menu_add_dep($3);
411 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());410 printd(DEBUG_PARSE, "%s:%d:depends on\n", cur_filename, cur_lineno);
412};411};
413 412
414/* visibility option */413/* visibility option */
@@ -455,9 +454,6 @@ symbol: nonconst_symbol · 40 unmodified lines
455 | T_WORD_QUOTE { $$ = sym_lookup($1, SYMBOL_CONST); free($1); }454 | T_WORD_QUOTE { $$ = sym_lookup($1, SYMBOL_CONST); free($1); }
456;455;
457 456
458word_opt: /* empty */ { $$ = NULL; }
459 | T_WORD
460
461/* assignment statement */457/* assignment statement */
462 458
463assignment_stmt: T_WORD assign_op assign_val T_EOL { variable_add($1, $3, $2); free($1); free($3); }459assignment_stmt: T_WORD assign_op assign_val T_EOL { variable_add($1, $3, $2); free($1); free($3); }
@@ -477,8 +473,11 @@ assign_val: · 13 unmodified lines
477 473
478void conf_parse(const char *name)474void conf_parse(const char *name)
479{475{
480 struct symbol *sym;476 struct menu *menu;
481 int i;477
478 autoconf_cmd = str_new();
479
480 str_printf(&autoconf_cmd, "\ndeps_config := \\\n");
482 481
483 zconf_initscan(name);482 zconf_initscan(name);
484 483
@@ -488,13 +487,28 @@ void conf_parse(const char *name) · 3 unmodified lines
488 yydebug = 1;487 yydebug = 1;
489 yyparse();488 yyparse();
490 489
490 /*
491 * FIXME:
492 * cur_filename and cur_lineno are used even after yyparse();
493 * menu_finalize() calls menu_add_symbol(). This should be fixed.
494 */
495 cur_filename = "<none>";
496 cur_lineno = 0;
497
498 str_printf(&autoconf_cmd,
499 "\n"
500 "$(autoconfig): $(deps_config)\n"
501 "$(deps_config): ;\n");
502
503 env_write_dep(&autoconf_cmd);
504
491 /* Variables are expanded in the parse phase. We can free them here. */505 /* Variables are expanded in the parse phase. We can free them here. */
492 variable_all_del();506 variable_all_del();
493 507
494 if (yynerrs)508 if (yynerrs)
495 exit(1);509 exit(1);
496 if (!modules_sym)510 if (!modules_sym)
497 modules_sym = sym_find( "n" );511 modules_sym = &symbol_no;
498 512
499 if (!menu_has_prompt(&rootmenu)) {513 if (!menu_has_prompt(&rootmenu)) {
500 current_entry = &rootmenu;514 current_entry = &rootmenu;
@@ -502,10 +516,23 @@ void conf_parse(const char *name) · 1 unmodified line
502 }516 }
503 517
504 menu_finalize(&rootmenu);518 menu_finalize(&rootmenu);
505 for_all_symbols(i, sym) {519
506 if (sym_check_deps(sym))520 menu = &rootmenu;
521 while (menu) {
522 if (menu->sym && sym_check_deps(menu->sym))
507 yynerrs++;523 yynerrs++;
524
525 if (menu->list) {
526 menu = menu->list;
527 continue;
528 }
529
530 while (!menu->next && menu->parent)
531 menu = menu->parent;
532
533 menu = menu->next;
508 }534 }
535
509 if (yynerrs)536 if (yynerrs)
510 exit(1);537 exit(1);
511 conf_set_changed(true);538 conf_set_changed(true);
@@ -520,11 +547,11 @@ static bool zconf_endtoken(const char *tokenname, · 8 unmodified lines
520 yynerrs++;547 yynerrs++;
521 return false;548 return false;
522 }549 }
523 if (current_menu->file != current_file) {550 if (strcmp(current_menu->filename, cur_filename)) {
524 zconf_error("'%s' in different file than '%s'",551 zconf_error("'%s' in different file than '%s'",
525 tokenname, expected_tokenname);552 tokenname, expected_tokenname);
526 fprintf(stderr, "%s:%d: location of the '%s'\n",553 fprintf(stderr, "%s:%d: location of the '%s'\n",
527 current_menu->file->name, current_menu->lineno,554 current_menu->filename, current_menu->lineno,
528 expected_tokenname);555 expected_tokenname);
529 yynerrs++;556 yynerrs++;
530 return false;557 return false;
@@ -536,7 +563,7 @@ static void zconfprint(const char *err, ...) · 5 unmodified lines
536{563{
537 va_list ap;564 va_list ap;
538 565
539 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());566 fprintf(stderr, "%s:%d: ", cur_filename, cur_lineno);
540 va_start(ap, err);567 va_start(ap, err);
541 vfprintf(stderr, err, ap);568 vfprintf(stderr, err, ap);
542 va_end(ap);569 va_end(ap);
@@ -548,7 +575,7 @@ static void zconf_error(const char *err, ...) · 5 unmodified lines
548 va_list ap;575 va_list ap;
549 576
550 yynerrs++;577 yynerrs++;
551 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());578 fprintf(stderr, "%s:%d: ", cur_filename, cur_lineno);
552 va_start(ap, err);579 va_start(ap, err);
553 vfprintf(stderr, err, ap);580 vfprintf(stderr, err, ap);
554 va_end(ap);581 va_end(ap);
@@ -557,7 +584,7 @@ static void zconf_error(const char *err, ...) · 2 unmodified lines
557 584
558static void yyerror(const char *err)585static void yyerror(const char *err)
559{586{
560 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);587 fprintf(stderr, "%s:%d: %s\n", cur_filename, cur_lineno, err);
561}588}
562 589
563static void print_quoted_string(FILE *out, const char *str)590static void print_quoted_string(FILE *out, const char *str)
scripts/kconfig/preprocess.c+13−10
@@ -9,10 +9,11 @@ · 8 unmodified lines
9#include <stdlib.h>9#include <stdlib.h>
10#include <string.h>10#include <string.h>
11 11
12#include "array_size.h"
13#include "internal.h"
12#include "list.h"14#include "list.h"
13#include "lkc.h"15#include "lkc.h"
14 16#include "preprocess.h"
15#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
16 17
17static char *expand_string_with_args(const char *in, int argc, char *argv[]);18static char *expand_string_with_args(const char *in, int argc, char *argv[]);
18static char *expand_string(const char *in);19static char *expand_string(const char *in);
@@ -21,7 +22,7 @@ static void __attribute__((noreturn)) pperror(const char *format, ...) · 2 unmodified lines
21{22{
22 va_list ap;23 va_list ap;
23 24
24 fprintf(stderr, "%s:%d: ", current_file->name, yylineno);25 fprintf(stderr, "%s:%d: ", cur_filename, yylineno);
25 va_start(ap, format);26 va_start(ap, format);
26 vfprintf(stderr, format, ap);27 vfprintf(stderr, format, ap);
27 va_end(ap);28 va_end(ap);
@@ -87,14 +88,17 @@ static char *env_expand(const char *name) · 59 unmodified lines
87 return xstrdup(value);88 return xstrdup(value);
88}89}
89 90
90void env_write_dep(FILE *f, const char *autoconfig_name)91void env_write_dep(struct gstr *s)
91{92{
92 struct env *e, *tmp;93 struct env *e, *tmp;
93 94
94 list_for_each_entry_safe(e, tmp, &env_list, node) {95 list_for_each_entry_safe(e, tmp, &env_list, node) {
95 fprintf(f, "ifneq \"$(%s)\" \"%s\"\n", e->name, e->value);96 str_printf(s,
96 fprintf(f, "%s: FORCE\n", autoconfig_name);97 "\n"
97 fprintf(f, "endif\n");98 "ifneq \"$(%s)\" \"%s\"\n"
99 "$(autoconfig): FORCE\n"
100 "endif\n",
101 e->name, e->value);
98 env_del(e);102 env_del(e);
99 }103 }
100}104}
@@ -119,7 +123,7 @@ static char *do_error_if(int argc, char *argv[]) · 18 unmodified lines
119 123
120static char *do_filename(int argc, char *argv[])124static char *do_filename(int argc, char *argv[])
121{125{
122 return xstrdup(current_file->name);126 return xstrdup(cur_filename);
123}127}
124 128
125static char *do_info(int argc, char *argv[])129static char *do_info(int argc, char *argv[])
@@ -181,8 +185,7 @@ static char *do_shell(int argc, char *argv[]) · 55 unmodified lines
181static char *do_warning_if(int argc, char *argv[])185static char *do_warning_if(int argc, char *argv[])
182{186{
183 if (!strcmp(argv[0], "y"))187 if (!strcmp(argv[0], "y"))
184 fprintf(stderr, "%s:%d: %s\n",188 fprintf(stderr, "%s:%d: %s\n", cur_filename, yylineno, argv[1]);
185 current_file->name, yylineno, argv[1]);
186 189
187 return xstrdup("");190 return xstrdup("");
188}191}
scripts/kconfig/preprocess.h+19−0
@@ -0,0 +1,19 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2#ifndef PREPROCESS_H
3#define PREPROCESS_H
4
5enum variable_flavor {
6 VAR_SIMPLE,
7 VAR_RECURSIVE,
8 VAR_APPEND,
9};
10
11struct gstr;
12void env_write_dep(struct gstr *gs);
13void variable_add(const char *name, const char *value,
14 enum variable_flavor flavor);
15void variable_all_del(void);
16char *expand_dollar(const char **str);
17char *expand_one_token(const char **str);
18
19#endif /* PREPROCESS_H */
scripts/kconfig/qconf.cc+1−1
@@ -1058,7 +1058,7 @@ void ConfigInfoView::menuInfo(void) · 1057 unmodified lines
1058 stream << "<br><br>";1058 stream << "<br><br>";
1059 }1059 }
1060 1060
1061 stream << "defined at " << _menu->file->name << ":"1061 stream << "defined at " << _menu->filename << ":"
1062 << _menu->lineno << "<br><br>";1062 << _menu->lineno << "<br><br>";
1063 }1063 }
1064 }1064 }
scripts/kconfig/symbol.c+22−27
@@ -9,23 +9,27 @@ · 8 unmodified lines
9#include <string.h>9#include <string.h>
10#include <regex.h>10#include <regex.h>
11 11
12#include "internal.h"
12#include "lkc.h"13#include "lkc.h"
13 14
14struct symbol symbol_yes = {15struct symbol symbol_yes = {
15 .name = "y",16 .name = "y",
16 .curr = { "y", yes },17 .curr = { "y", yes },
18 .menus = LIST_HEAD_INIT(symbol_yes.menus),
17 .flags = SYMBOL_CONST|SYMBOL_VALID,19 .flags = SYMBOL_CONST|SYMBOL_VALID,
18};20};
19 21
20struct symbol symbol_mod = {22struct symbol symbol_mod = {
21 .name = "m",23 .name = "m",
22 .curr = { "m", mod },24 .curr = { "m", mod },
25 .menus = LIST_HEAD_INIT(symbol_mod.menus),
23 .flags = SYMBOL_CONST|SYMBOL_VALID,26 .flags = SYMBOL_CONST|SYMBOL_VALID,
24};27};
25 28
26struct symbol symbol_no = {29struct symbol symbol_no = {
27 .name = "n",30 .name = "n",
28 .curr = { "n", no },31 .curr = { "n", no },
32 .menus = LIST_HEAD_INIT(symbol_no.menus),
29 .flags = SYMBOL_CONST|SYMBOL_VALID,33 .flags = SYMBOL_CONST|SYMBOL_VALID,
30};34};
31 35
@@ -160,9 +164,8 @@ static void sym_set_changed(struct symbol *sym) · 128 unmodified lines
160static void sym_set_all_changed(void)164static void sym_set_all_changed(void)
161{165{
162 struct symbol *sym;166 struct symbol *sym;
163 int i;
164 167
165 for_all_symbols(i, sym)168 for_all_symbols(sym)
166 sym_set_changed(sym);169 sym_set_changed(sym);
167}170}
168 171
@@ -475,9 +478,8 @@ void sym_calc_value(struct symbol *sym) · 306 unmodified lines
475void sym_clear_all_valid(void)478void sym_clear_all_valid(void)
476{479{
477 struct symbol *sym;480 struct symbol *sym;
478 int i;
479 481
480 for_all_symbols(i, sym)482 for_all_symbols(sym)
481 sym->flags &= ~SYMBOL_VALID;483 sym->flags &= ~SYMBOL_VALID;
482 conf_set_changed(true);484 conf_set_changed(true);
483 sym_calc_value(modules_sym);485 sym_calc_value(modules_sym);
@@ -803,14 +805,7 @@ bool sym_is_changeable(struct symbol *sym) · 319 unmodified lines
803 return sym->visible > sym->rev_dep.tri;805 return sym->visible > sym->rev_dep.tri;
804}806}
805 807
806static unsigned strhash(const char *s)808HASHTABLE_DEFINE(sym_hashtable, SYMBOL_HASHSIZE);
807{
808 /* fnv32 hash */
809 unsigned hash = 2166136261U;
810 for (; *s; s++)
811 hash = (hash ^ *s) * 0x01000193;
812 return hash;
813}
814 809
815struct symbol *sym_lookup(const char *name, int flags)810struct symbol *sym_lookup(const char *name, int flags)
816{811{
@@ -826,9 +821,9 @@ struct symbol *sym_lookup(const char *name, int flags) · 9 unmodified lines
826 case 'n': return &symbol_no;821 case 'n': return &symbol_no;
827 }822 }
828 }823 }
829 hash = strhash(name) % SYMBOL_HASHSIZE;824 hash = strhash(name);
830 825
831 for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) {826 hash_for_each_possible(sym_hashtable, symbol, node, hash) {
832 if (symbol->name &&827 if (symbol->name &&
833 !strcmp(symbol->name, name) &&828 !strcmp(symbol->name, name) &&
834 (flags ? symbol->flags & flags829 (flags ? symbol->flags & flags
@@ -846,9 +841,9 @@ struct symbol *sym_lookup(const char *name, int flags) · 11 unmodified lines
846 symbol->name = new_name;841 symbol->name = new_name;
847 symbol->type = S_UNKNOWN;842 symbol->type = S_UNKNOWN;
848 symbol->flags = flags;843 symbol->flags = flags;
844 INIT_LIST_HEAD(&symbol->menus);
849 845
850 symbol->next = symbol_hash[hash];846 hash_add(sym_hashtable, &symbol->node, hash);
851 symbol_hash[hash] = symbol;
852 847
853 return symbol;848 return symbol;
854}849}
@@ -868,9 +863,9 @@ struct symbol *sym_find(const char *name) · 13 unmodified lines
868 case 'n': return &symbol_no;863 case 'n': return &symbol_no;
869 }864 }
870 }865 }
871 hash = strhash(name) % SYMBOL_HASHSIZE;866 hash = strhash(name);
872 867
873 for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) {868 hash_for_each_possible(sym_hashtable, symbol, node, hash) {
874 if (symbol->name &&869 if (symbol->name &&
875 !strcmp(symbol->name, name) &&870 !strcmp(symbol->name, name) &&
876 !(symbol->flags & SYMBOL_CONST))871 !(symbol->flags & SYMBOL_CONST))
@@ -930,7 +925,7 @@ struct symbol **sym_re_search(const char *pattern) · 53 unmodified lines
930 if (regcomp(&re, pattern, REG_EXTENDED|REG_ICASE))925 if (regcomp(&re, pattern, REG_EXTENDED|REG_ICASE))
931 return NULL;926 return NULL;
932 927
933 for_all_symbols(i, sym) {928 for_all_symbols(sym) {
934 if (sym->flags & SYMBOL_CONST || !sym->name)929 if (sym->flags & SYMBOL_CONST || !sym->name)
935 continue;930 continue;
936 if (regexec(&re, sym->name, 1, match, 0))931 if (regexec(&re, sym->name, 1, match, 0))
@@ -1041,42 +1036,42 @@ static void sym_check_print_recursive(struct symbol *last_sym) · 104 unmodified lines
1041 }1036 }
1042 if (stack->sym == last_sym)1037 if (stack->sym == last_sym)
1043 fprintf(stderr, "%s:%d:error: recursive dependency detected!\n",1038 fprintf(stderr, "%s:%d:error: recursive dependency detected!\n",
1044 prop->file->name, prop->lineno);1039 prop->filename, prop->lineno);
1045 1040
1046 if (sym_is_choice(sym)) {1041 if (sym_is_choice(sym)) {
1047 fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n",1042 fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n",
1048 menu->file->name, menu->lineno,1043 menu->filename, menu->lineno,
1049 sym->name ? sym->name : "<choice>",1044 sym->name ? sym->name : "<choice>",
1050 next_sym->name ? next_sym->name : "<choice>");1045 next_sym->name ? next_sym->name : "<choice>");
1051 } else if (sym_is_choice_value(sym)) {1046 } else if (sym_is_choice_value(sym)) {
1052 fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n",1047 fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n",
1053 menu->file->name, menu->lineno,1048 menu->filename, menu->lineno,
1054 sym->name ? sym->name : "<choice>",1049 sym->name ? sym->name : "<choice>",
1055 next_sym->name ? next_sym->name : "<choice>");1050 next_sym->name ? next_sym->name : "<choice>");
1056 } else if (stack->expr == &sym->dir_dep.expr) {1051 } else if (stack->expr == &sym->dir_dep.expr) {
1057 fprintf(stderr, "%s:%d:\tsymbol %s depends on %s\n",1052 fprintf(stderr, "%s:%d:\tsymbol %s depends on %s\n",
1058 prop->file->name, prop->lineno,1053 prop->filename, prop->lineno,
1059 sym->name ? sym->name : "<choice>",1054 sym->name ? sym->name : "<choice>",
1060 next_sym->name ? next_sym->name : "<choice>");1055 next_sym->name ? next_sym->name : "<choice>");
1061 } else if (stack->expr == &sym->rev_dep.expr) {1056 } else if (stack->expr == &sym->rev_dep.expr) {
1062 fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n",1057 fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n",
1063 prop->file->name, prop->lineno,1058 prop->filename, prop->lineno,
1064 sym->name ? sym->name : "<choice>",1059 sym->name ? sym->name : "<choice>",
1065 next_sym->name ? next_sym->name : "<choice>");1060 next_sym->name ? next_sym->name : "<choice>");
1066 } else if (stack->expr == &sym->implied.expr) {1061 } else if (stack->expr == &sym->implied.expr) {
1067 fprintf(stderr, "%s:%d:\tsymbol %s is implied by %s\n",1062 fprintf(stderr, "%s:%d:\tsymbol %s is implied by %s\n",
1068 prop->file->name, prop->lineno,1063 prop->filename, prop->lineno,
1069 sym->name ? sym->name : "<choice>",1064 sym->name ? sym->name : "<choice>",
1070 next_sym->name ? next_sym->name : "<choice>");1065 next_sym->name ? next_sym->name : "<choice>");
1071 } else if (stack->expr) {1066 } else if (stack->expr) {
1072 fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n",1067 fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n",
1073 prop->file->name, prop->lineno,1068 prop->filename, prop->lineno,
1074 sym->name ? sym->name : "<choice>",1069 sym->name ? sym->name : "<choice>",
1075 prop_get_type_name(prop->type),1070 prop_get_type_name(prop->type),
1076 next_sym->name ? next_sym->name : "<choice>");1071 next_sym->name ? next_sym->name : "<choice>");
1077 } else {1072 } else {
1078 fprintf(stderr, "%s:%d:\tsymbol %s %s is visible depending on %s\n",1073 fprintf(stderr, "%s:%d:\tsymbol %s %s is visible depending on %s\n",
1079 prop->file->name, prop->lineno,1074 prop->filename, prop->lineno,
1080 sym->name ? sym->name : "<choice>",1075 sym->name ? sym->name : "<choice>",
1081 prop_get_type_name(prop->type),1076 prop_get_type_name(prop->type),
1082 next_sym->name ? next_sym->name : "<choice>");1077 next_sym->name ? next_sym->name : "<choice>");
scripts/kconfig/tests/choice_randomize/Kconfig+22−0
@@ -0,0 +1,22 @@
1choice
2 prompt "choose A or B"
3
4config A
5 bool "A"
6
7config B
8 bool "B"
9
10endchoice
11
12choice
13 prompt "choose X or Y"
14 depends on B
15
16config X
17 bool "X"
18
19config Y
20 bool "Y"
21
22endchoice
scripts/kconfig/tests/choice_randomize/__init__.py+34−0
@@ -0,0 +1,34 @@
1# SPDX-License-Identifier: GPL-2.0-only
2"""
3Randomize all dependent choices
4
5This is a somewhat tricky case for randconfig; the visibility of one choice is
6determined by a member of another choice. Randconfig should be able to generate
7all possible patterns.
8"""
9
10
11def test(conf):
12
13 expected0 = False
14 expected1 = False
15 expected2 = False
16
17 for i in range(100):
18 assert conf.randconfig(seed=i) == 0
19
20 if conf.config_matches('expected_config0'):
21 expected0 = True
22 elif conf.config_matches('expected_config1'):
23 expected1 = True
24 elif conf.config_matches('expected_config2'):
25 expected2 = True
26 else:
27 assert False
28
29 if expected0 and expected1 and expected2:
30 break
31
32 assert expected0
33 assert expected1
34 assert expected2
scripts/kconfig/tests/choice_randomize/expected_config0+6−0
@@ -0,0 +1,6 @@
1#
2# Automatically generated file; DO NOT EDIT.
3# Main menu
4#
5CONFIG_A=y
6# CONFIG_B is not set
scripts/kconfig/tests/choice_randomize/expected_config1+8−0
@@ -0,0 +1,8 @@
1#
2# Automatically generated file; DO NOT EDIT.
3# Main menu
4#
5# CONFIG_A is not set
6CONFIG_B=y
7CONFIG_X=y
8# CONFIG_Y is not set
scripts/kconfig/tests/choice_randomize/expected_config2+8−0
@@ -0,0 +1,8 @@
1#
2# Automatically generated file; DO NOT EDIT.
3# Main menu
4#
5# CONFIG_A is not set
6CONFIG_B=y
7# CONFIG_X is not set
8CONFIG_Y=y
scripts/kconfig/tests/choice_randomize2/Kconfig+32−0
@@ -0,0 +1,32 @@
1choice
2 prompt "This is always invisible"
3 depends on n
4
5config DUMMY
6 bool "DUMMY"
7
8endchoice
9
10choice
11 prompt "Choose A or B"
12
13config A
14 bool "A"
15
16config B
17 bool "B"
18
19endchoice
20
21config FOO
22 bool "FOO"
23 depends on A
24
25choice
26 prompt "Choose X"
27 depends on FOO
28
29config X
30 bool "X"
31
32endchoice
scripts/kconfig/tests/choice_randomize2/__init__.py+18−0
@@ -0,0 +1,18 @@
1# SPDX-License-Identifier: GPL-2.0-only
2"""
3Randomize choices with correct dependencies
4
5When shuffling a choice may potentially disrupt certain dependencies, symbol
6values must be recalculated.
7
8Related Linux commits:
9 - c8fb7d7e48d11520ad24808cfce7afb7b9c9f798
10"""
11
12
13def test(conf):
14 for i in range(20):
15 assert conf.randconfig(seed=i) == 0
16 assert (conf.config_matches('expected_config0') or
17 conf.config_matches('expected_config1') or
18 conf.config_matches('expected_config2'))
scripts/kconfig/tests/choice_randomize2/expected_config0+8−0
@@ -0,0 +1,8 @@
1#
2# Automatically generated file; DO NOT EDIT.
3# Main menu
4#
5CONFIG_A=y
6# CONFIG_B is not set
7CONFIG_FOO=y
8CONFIG_X=y
scripts/kconfig/tests/choice_randomize2/expected_config1+7−0
@@ -0,0 +1,7 @@
1#
2# Automatically generated file; DO NOT EDIT.
3# Main menu
4#
5CONFIG_A=y
6# CONFIG_B is not set
7# CONFIG_FOO is not set
scripts/kconfig/tests/choice_randomize2/expected_config2+6−0
@@ -0,0 +1,6 @@
1#
2# Automatically generated file; DO NOT EDIT.
3# Main menu
4#
5# CONFIG_A is not set
6CONFIG_B=y
scripts/kconfig/tests/conftest.py+10−6
@@ -154,12 +154,10 @@ class Conf: · 153 unmodified lines
154 defconfig_path = os.path.join(self._test_dir, defconfig)154 defconfig_path = os.path.join(self._test_dir, defconfig)
155 return self._run_conf('--defconfig={}'.format(defconfig_path))155 return self._run_conf('--defconfig={}'.format(defconfig_path))
156 156
157 def _allconfig(self, mode, all_config):157 def _allconfig(self, mode, all_config, extra_env={}):
158 if all_config:158 if all_config:
159 all_config_path = os.path.join(self._test_dir, all_config)159 all_config_path = os.path.join(self._test_dir, all_config)
160 extra_env = {'KCONFIG_ALLCONFIG': all_config_path}160 extra_env['KCONFIG_ALLCONFIG'] = all_config_path
161 else:
162 extra_env = {}
163 161
164 return self._run_conf('--{}config'.format(mode), extra_env=extra_env)162 return self._run_conf('--{}config'.format(mode), extra_env=extra_env)
165 163
@@ -195,13 +193,19 @@ class Conf: · 29 unmodified lines
195 """193 """
196 return self._allconfig('alldef', all_config)194 return self._allconfig('alldef', all_config)
197 195
198 def randconfig(self, all_config=None):196 def randconfig(self, all_config=None, seed=None):
199 """Run randconfig.197 """Run randconfig.
200 198
201 all_config: fragment config file for KCONFIG_ALLCONFIG (optional)199 all_config: fragment config file for KCONFIG_ALLCONFIG (optional)
200 seed: the seed for randconfig (optional)
202 returncode: exit status of the Kconfig executable201 returncode: exit status of the Kconfig executable
203 """202 """
204 return self._allconfig('rand', all_config)203 if seed is not None:
204 extra_env = {'KCONFIG_SEED': hex(seed)}
205 else:
206 extra_env = {}
207
208 return self._allconfig('rand', all_config, extra_env=extra_env)
205 209
206 def savedefconfig(self, dot_config):210 def savedefconfig(self, dot_config):
207 """Run savedefconfig.211 """Run savedefconfig.
scripts/kconfig/tests/err_recursive_dep/expected_stderr+11−11
@@ -1,10 +1,10 @@
1Kconfig:11:error: recursive dependency detected!1Kconfig:5:error: recursive dependency detected!
2Kconfig:11: symbol B is selected by B2Kconfig:5: symbol A depends on A
3For a resolution refer to Documentation/kbuild/kconfig-language.rst3For a resolution refer to Documentation/kbuild/kconfig-language.rst
4subsection "Kconfig recursive dependency limitations"4subsection "Kconfig recursive dependency limitations"
5 5
6Kconfig:5:error: recursive dependency detected!6Kconfig:11:error: recursive dependency detected!
7Kconfig:5: symbol A depends on A7Kconfig:11: symbol B is selected by B
8For a resolution refer to Documentation/kbuild/kconfig-language.rst8For a resolution refer to Documentation/kbuild/kconfig-language.rst
9subsection "Kconfig recursive dependency limitations"9subsection "Kconfig recursive dependency limitations"
10 10
@@ -14,9 +14,9 @@ Kconfig:21: symbol C2 depends on C1 · 3 unmodified lines
14For a resolution refer to Documentation/kbuild/kconfig-language.rst14For a resolution refer to Documentation/kbuild/kconfig-language.rst
15subsection "Kconfig recursive dependency limitations"15subsection "Kconfig recursive dependency limitations"
16 16
17Kconfig:32:error: recursive dependency detected!17Kconfig:27:error: recursive dependency detected!
18Kconfig:32: symbol D2 is selected by D1
19Kconfig:27: symbol D1 depends on D218Kconfig:27: symbol D1 depends on D2
19Kconfig:32: symbol D2 is selected by D1
20For a resolution refer to Documentation/kbuild/kconfig-language.rst20For a resolution refer to Documentation/kbuild/kconfig-language.rst
21subsection "Kconfig recursive dependency limitations"21subsection "Kconfig recursive dependency limitations"
22 22
@@ -26,13 +26,13 @@ Kconfig:42: symbol E2 is implied by E1 · 3 unmodified lines
26For a resolution refer to Documentation/kbuild/kconfig-language.rst26For a resolution refer to Documentation/kbuild/kconfig-language.rst
27subsection "Kconfig recursive dependency limitations"27subsection "Kconfig recursive dependency limitations"
28 28
29Kconfig:60:error: recursive dependency detected!29Kconfig:49:error: recursive dependency detected!
30Kconfig:60: symbol G depends on G30Kconfig:49: symbol F1 default value contains F2
31Kconfig:51: symbol F2 depends on F1
31For a resolution refer to Documentation/kbuild/kconfig-language.rst32For a resolution refer to Documentation/kbuild/kconfig-language.rst
32subsection "Kconfig recursive dependency limitations"33subsection "Kconfig recursive dependency limitations"
33 34
34Kconfig:51:error: recursive dependency detected!35Kconfig:60:error: recursive dependency detected!
35Kconfig:51: symbol F2 depends on F136Kconfig:60: symbol G depends on G
36Kconfig:49: symbol F1 default value contains F2
37For a resolution refer to Documentation/kbuild/kconfig-language.rst37For a resolution refer to Documentation/kbuild/kconfig-language.rst
38subsection "Kconfig recursive dependency limitations"38subsection "Kconfig recursive dependency limitations"
scripts/kconfig/util.c+36−11
@@ -7,25 +7,50 @@ · 6 unmodified lines
7#include <stdarg.h>7#include <stdarg.h>
8#include <stdlib.h>8#include <stdlib.h>
9#include <string.h>9#include <string.h>
10
11#include "hashtable.h"
10#include "lkc.h"12#include "lkc.h"
11 13
14unsigned int strhash(const char *s)
15{
16 /* fnv32 hash */
17 unsigned int hash = 2166136261U;
18
19 for (; *s; s++)
20 hash = (hash ^ *s) * 0x01000193;
21 return hash;
22}
23
24/* hash table of all parsed Kconfig files */
25static HASHTABLE_DEFINE(file_hashtable, 1U << 11);
26
27struct file {
28 struct hlist_node node;
29 char name[];
30};
31
12/* file already present in list? If not add it */32/* file already present in list? If not add it */
13struct file *file_lookup(const char *name)33const char *file_lookup(const char *name)
14{34{
15 struct file *file;35 struct file *file;
36 size_t len;
37 int hash = strhash(name);
16 38
17 for (file = file_list; file; file = file->next) {39 hash_for_each_possible(file_hashtable, file, node, hash)
18 if (!strcmp(name, file->name)) {40 if (!strcmp(name, file->name))
19 return file;41 return file->name;
20 }
21 }
22 42
23 file = xmalloc(sizeof(*file));43 len = strlen(name);
44 file = xmalloc(sizeof(*file) + len + 1);
24 memset(file, 0, sizeof(*file));45 memset(file, 0, sizeof(*file));
25 file->name = xstrdup(name);46 memcpy(file->name, name, len);
26 file->next = file_list;47 file->name[len] = '\0';
27 file_list = file;48
28 return file;49 hash_add(file_hashtable, &file->node, hash);
50
51 str_printf(&autoconf_cmd, "\t%s \\\n", name);
52
53 return file->name;
29}54}
30 55
31/* Allocate initial growable string */56/* Allocate initial growable string */
scripts/mod/modpost.c+3−1
@@ -1050,7 +1050,9 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf, · 1049 unmodified lines
1050 sec_mismatch_count++;1050 sec_mismatch_count++;
1051 1051
1052 warn("%s: section mismatch in reference: %s+0x%x (section: %s) -> %s (section: %s)\n",1052 warn("%s: section mismatch in reference: %s+0x%x (section: %s) -> %s (section: %s)\n",
1053 modname, fromsym, (unsigned int)(faddr - from->st_value), fromsec, tosym, tosec);1053 modname, fromsym,
1054 (unsigned int)(faddr - (from ? from->st_value : 0)),
1055 fromsec, tosym, tosec);
1054 1056
1055 if (mismatch->mismatch == EXTABLE_TO_NON_TEXT) {1057 if (mismatch->mismatch == EXTABLE_TO_NON_TEXT) {
1056 if (match(tosec, mismatch->bad_tosec))1058 if (match(tosec, mismatch->bad_tosec))
scripts/package/builddeb+12−38
@@ -24,24 +24,10 @@ if_enabled_echo() { · 23 unmodified lines
24 fi24 fi
25}25}
26 26
27create_package() {
28 export DH_OPTIONS="-p${1}"
29
30 dh_installdocs
31 dh_installchangelogs
32 dh_compress
33 dh_fixperms
34 dh_gencontrol
35 dh_md5sums
36 dh_builddeb -- ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS}
37}
38
39install_linux_image () {27install_linux_image () {
40 pname=$128 pname=$1
41 pdir=debian/$129 pdir=debian/$1
42 30
43 rm -rf ${pdir}
44
45 # Only some architectures with OF support have this target31 # Only some architectures with OF support have this target
46 if is_enabled CONFIG_OF_EARLY_FLATTREE && [ -d "${srctree}/arch/${SRCARCH}/boot/dts" ]; then32 if is_enabled CONFIG_OF_EARLY_FLATTREE && [ -d "${srctree}/arch/${SRCARCH}/boot/dts" ]; then
47 ${MAKE} -f ${srctree}/Makefile INSTALL_DTBS_PATH="${pdir}/usr/lib/linux-image-${KERNELRELEASE}" dtbs_install33 ${MAKE} -f ${srctree}/Makefile INSTALL_DTBS_PATH="${pdir}/usr/lib/linux-image-${KERNELRELEASE}" dtbs_install
@@ -109,8 +95,6 @@ install_linux_image () { · 61 unmodified lines
109install_linux_image_dbg () {95install_linux_image_dbg () {
110 pdir=debian/$196 pdir=debian/$1
111 97
112 rm -rf ${pdir}
113
114 # Parse modules.order directly because 'make modules_install' may sign,98 # Parse modules.order directly because 'make modules_install' may sign,
115 # compress modules, and then run unneeded depmod.99 # compress modules, and then run unneeded depmod.
116 while read -r mod; do100 while read -r mod; do
@@ -140,8 +124,6 @@ install_kernel_headers () { · 23 unmodified lines
140 pdir=debian/$1124 pdir=debian/$1
141 version=${1#linux-headers-}125 version=${1#linux-headers-}
142 126
143 rm -rf $pdir
144
145 "${srctree}/scripts/package/install-extmod-build" "${pdir}/usr/src/linux-headers-${version}"127 "${srctree}/scripts/package/install-extmod-build" "${pdir}/usr/src/linux-headers-${version}"
146 128
147 mkdir -p $pdir/lib/modules/$version/129 mkdir -p $pdir/lib/modules/$version/
@@ -151,8 +133,6 @@ install_kernel_headers () { · 3 unmodified lines
151install_libc_headers () {133install_libc_headers () {
152 pdir=debian/$1134 pdir=debian/$1
153 135
154 rm -rf $pdir
155
156 $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH=$pdir/usr136 $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH=$pdir/usr
157 137
158 # move asm headers to /usr/include/<libc-machine>/asm to match the structure138 # move asm headers to /usr/include/<libc-machine>/asm to match the structure
@@ -161,21 +141,15 @@ install_libc_headers () { · 2 unmodified lines
161 mv "$pdir/usr/include/asm" "$pdir/usr/include/${DEB_HOST_MULTIARCH}"141 mv "$pdir/usr/include/asm" "$pdir/usr/include/${DEB_HOST_MULTIARCH}"
162}142}
163 143
164rm -f debian/files144package=$1
165 145
166packages_enabled=$(dh_listpackages)146case "${package}" in
167 147*-dbg)
168for package in ${packages_enabled}148 install_linux_image_dbg "${package}";;
169do149linux-image-*|user-mode-linux-*)
170 case ${package} in150 install_linux_image "${package}";;
171 *-dbg)151linux-libc-dev)
172 install_linux_image_dbg "${package}";;152 install_libc_headers "${package}";;
173 linux-image-*|user-mode-linux-*)153linux-headers-*)
174 install_linux_image "${package}";;154 install_kernel_headers "${package}";;
175 linux-libc-dev)155esac
176 install_libc_headers "${package}";;
177 linux-headers-*)
178 install_kernel_headers "${package}";;
179 esac
180 create_package "${package}"
181done
scripts/package/debian/rules+54−9
@@ -11,28 +11,73 @@ ifneq (,$(filter-out parallel=1,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))) · 10 unmodified lines
11 MAKEFLAGS += -j$(NUMJOBS)11 MAKEFLAGS += -j$(NUMJOBS)
12endif12endif
13 13
14# When KBUILD_VERBOSE is undefined (presumably you are directly working with
15# the debianized tree), show verbose logs unless DEB_BUILD_OPTION=terse is set.
16ifeq ($(origin KBUILD_VERBOSE),undefined)
17 ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS)))
18 export KBUILD_VERBOSE := 1
19 else
20 Q := @
21 endif
22endif
23
14revision = $(lastword $(subst -, ,$(shell dpkg-parsechangelog -S Version)))24revision = $(lastword $(subst -, ,$(shell dpkg-parsechangelog -S Version)))
15CROSS_COMPILE ?= $(filter-out $(DEB_BUILD_GNU_TYPE)-, $(DEB_HOST_GNU_TYPE)-)25CROSS_COMPILE ?= $(filter-out $(DEB_BUILD_GNU_TYPE)-, $(DEB_HOST_GNU_TYPE)-)
16make-opts = ARCH=$(ARCH) KERNELRELEASE=$(KERNELRELEASE) KBUILD_BUILD_VERSION=$(revision) $(addprefix CROSS_COMPILE=,$(CROSS_COMPILE))26make-opts = ARCH=$(ARCH) KERNELRELEASE=$(KERNELRELEASE) KBUILD_BUILD_VERSION=$(revision) $(addprefix CROSS_COMPILE=,$(CROSS_COMPILE))
17 27
28binary-targets := $(addprefix binary-, image image-dbg headers libc-dev)
29
30all-packages = $(shell dh_listpackages)
31image-package = $(filter linux-image-% user-%, $(filter-out %-dbg, $(all-packages)))
32image-dbg-package = $(filter %-dbg, $(all-packages))
33libc-dev-package = $(filter linux-libc-dev, $(all-packages))
34headers-package = $(filter linux-headers-%, $(all-packages))
35
36mk-files = $(patsubst binary-%,debian/%.files,$1)
37package = $($(@:binary-%=%-package))
38
39# DH_OPTION is an environment variable common for all debhelper commands.
40# We could 'export' it, but here it is passed from the command line to clarify
41# which package is being processed in the build log.
42DH_OPTIONS = -p$(package)
43
44define binary
45 $(Q)dh_testdir $(DH_OPTIONS)
46 $(Q)dh_testroot $(DH_OPTIONS)
47 $(Q)dh_prep $(DH_OPTIONS)
48 $(Q)+$(MAKE) $(make-opts) run-command KBUILD_RUN_COMMAND='+$$(srctree)/scripts/package/builddeb $(package)'
49 $(Q)dh_installdocs $(DH_OPTIONS)
50 $(Q)dh_installchangelogs $(DH_OPTIONS)
51 $(Q)dh_compress $(DH_OPTIONS)
52 $(Q)dh_fixperms $(DH_OPTIONS)
53 $(Q)dh_gencontrol $(DH_OPTIONS) -- -f$(call mk-files,$@)
54 $(Q)dh_md5sums $(DH_OPTIONS)
55 $(Q)dh_builddeb $(DH_OPTIONS) -- $(addprefix -Z,$(KDEB_COMPRESS))
56endef
57
58.PHONY: $(binary-targets)
59$(binary-targets): build-arch
60 $(Q)truncate -s0 $(call mk-files,$@)
61 $(if $(package),$(binary))
62
18.PHONY: binary binary-indep binary-arch63.PHONY: binary binary-indep binary-arch
19binary: binary-arch binary-indep64binary: binary-arch binary-indep
20binary-indep: build-indep65binary-indep: build-indep
21binary-arch: build-arch66binary-arch: $(binary-targets)
22 $(MAKE) $(make-opts) \67 $(Q)cat $(call mk-files,$^) > debian/files
23 run-command KBUILD_RUN_COMMAND='+$$(srctree)/scripts/package/builddeb'
24 68
25.PHONY: build build-indep build-arch69.PHONY: build build-indep build-arch
26build: build-arch build-indep70build: build-arch build-indep
27build-indep:71build-indep:
28build-arch:72build-arch:
29 $(MAKE) $(make-opts) olddefconfig73 $(Q)$(MAKE) $(make-opts) olddefconfig
30 $(MAKE) $(make-opts) $(if $(filter um,$(ARCH)),,headers) all74 $(Q)$(MAKE) $(make-opts) $(if $(filter um,$(ARCH)),,headers) all
31 75
32.PHONY: clean76.PHONY: clean
33clean:77clean:
34 rm -rf debian/files debian/linux-* debian/deb-env.vars*78 $(Q)dh_clean
35 $(MAKE) ARCH=$(ARCH) clean79 $(Q)rm -rf debian/deb-env.vars* debian/*.files
80 $(Q)$(MAKE) ARCH=$(ARCH) clean
36 81
37# If DEB_HOST_ARCH is empty, it is likely that debian/rules was executed82# If DEB_HOST_ARCH is empty, it is likely that debian/rules was executed
38# directly. Run 'dpkg-architecture --print-set --print-format=make' to83# directly. Run 'dpkg-architecture --print-set --print-format=make' to
@@ -41,6 +86,6 @@ ifndef DEB_HOST_ARCH · 2 unmodified lines
41include debian/deb-env.vars86include debian/deb-env.vars
42 87
43debian/deb-env.vars:88debian/deb-env.vars:
44 dpkg-architecture -a$$(cat debian/arch) --print-set --print-format=make > $@.tmp89 $(Q)dpkg-architecture -a$$(cat debian/arch) --print-set --print-format=make > $@.tmp
45 mv $@.tmp $@90 $(Q)mv $@.tmp $@
46endif91endif
scripts/package/kernel.spec+37−11
@@ -61,11 +61,37 @@ cp $(%{make} %{makeflags} -s image_name) %{buildroot}/lib/modules/%{KERNELRELEAS · 60 unmodified lines
61%{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install61%{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
62cp System.map %{buildroot}/lib/modules/%{KERNELRELEASE}62cp System.map %{buildroot}/lib/modules/%{KERNELRELEASE}
63cp .config %{buildroot}/lib/modules/%{KERNELRELEASE}/config63cp .config %{buildroot}/lib/modules/%{KERNELRELEASE}/config
64if %{make} %{makeflags} run-command KBUILD_RUN_COMMAND='test -d ${srctree}/arch/${SRCARCH}/boot/dts' 2>/dev/null; then
65 %{make} %{makeflags} INSTALL_DTBS_PATH=%{buildroot}/lib/modules/%{KERNELRELEASE}/dtb dtbs_install
66fi
64ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/build67ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/build
65%if %{with_devel}68%if %{with_devel}
66%{make} %{makeflags} run-command KBUILD_RUN_COMMAND='${srctree}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}'69%{make} %{makeflags} run-command KBUILD_RUN_COMMAND='${srctree}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}'
67%endif70%endif
68 71
72{
73 for x in System.map config kernel modules.builtin \
74 modules.builtin.modinfo modules.order vmlinuz; do
75 echo "/lib/modules/%{KERNELRELEASE}/${x}"
76 done
77
78 for x in alias alias.bin builtin.alias.bin builtin.bin dep dep.bin \
79 devname softdep symbols symbols.bin; do
80 echo "%ghost /lib/modules/%{KERNELRELEASE}/modules.${x}"
81 done
82
83 for x in System.map config vmlinuz; do
84 echo "%ghost /boot/${x}-%{KERNELRELEASE}"
85 done
86
87 if [ -d "%{buildroot}/lib/modules/%{KERNELRELEASE}/dtb" ];then
88 echo "/lib/modules/%{KERNELRELEASE}/dtb"
89 find "%{buildroot}/lib/modules/%{KERNELRELEASE}/dtb" -printf "%%%ghost /boot/dtb-%{KERNELRELEASE}/%%P\n"
90 fi
91
92 echo "%exclude /lib/modules/%{KERNELRELEASE}/build"
93} > %{buildroot}/kernel.list
94
69%clean95%clean
70rm -rf %{buildroot}96rm -rf %{buildroot}
71 97
@@ -78,23 +104,23 @@ for file in vmlinuz System.map config; do · 6 unmodified lines
78 cp "/lib/modules/%{KERNELRELEASE}/${file}" "/boot/${file}-%{KERNELRELEASE}"104 cp "/lib/modules/%{KERNELRELEASE}/${file}" "/boot/${file}-%{KERNELRELEASE}"
79 fi105 fi
80done106done
107if [ -d "/lib/modules/%{KERNELRELEASE}/dtb" ] && \
108 ! diff -rq "/lib/modules/%{KERNELRELEASE}/dtb" "/boot/dtb-%{KERNELRELEASE}" >/dev/null 2>&1; then
109 rm -rf "/boot/dtb-%{KERNELRELEASE}"
110 cp -r "/lib/modules/%{KERNELRELEASE}/dtb" "/boot/dtb-%{KERNELRELEASE}"
111fi
112if [ ! -e "/lib/modules/%{KERNELRELEASE}/modules.dep" ]; then
113 /usr/sbin/depmod %{KERNELRELEASE}
114fi
81 115
82%preun116%preun
83if [ -x /sbin/new-kernel-pkg ]; then117if [ -x /usr/bin/kernel-install ]; then
84new-kernel-pkg --remove %{KERNELRELEASE} --rminitrd --initrdfile=/boot/initramfs-%{KERNELRELEASE}.img
85elif [ -x /usr/bin/kernel-install ]; then
86kernel-install remove %{KERNELRELEASE}118kernel-install remove %{KERNELRELEASE}
87fi119fi
88 120
89%postun121%files -f %{buildroot}/kernel.list
90if [ -x /sbin/update-bootloader ]; then
91/sbin/update-bootloader --remove %{KERNELRELEASE}
92fi
93
94%files
95%defattr (-, root, root)122%defattr (-, root, root)
96/lib/modules/%{KERNELRELEASE}123%exclude /kernel.list
97%exclude /lib/modules/%{KERNELRELEASE}/build
98 124
99%files headers125%files headers
100%defattr (-, root, root)126%defattr (-, root, root)
tools/lib/bpf/Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
2# Most of this file is copied from tools/lib/traceevent/Makefile2# Most of this file is copied from tools/lib/traceevent/Makefile
3 3
4RM ?= rm4RM ?= rm
5srctree = $(abs_srctree)5srctree := $(realpath $(srctree))
6 6
7VERSION_SCRIPT := libbpf.map7VERSION_SCRIPT := libbpf.map
8LIBBPF_VERSION := $(shell \8LIBBPF_VERSION := $(shell \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t