Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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)
...

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