aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-11-02kconfig: fix segmentation fault in menuconfig searchMasahiro Yamada1-19/+4
Since commit d05377e184fc ("kconfig: Create links to main menu items in search"), menuconfig shows a jump key next to "Main menu" if the nearest visible parent is the rootmenu. If you press that jump key, menuconfig crashes with a segmentation fault. For example, do this: $ make ARCH=arm64 allnoconfig menuconfig Press '/' to search for the string "ACPI". Press '1' to choose "(1) Main menu". Then, menuconfig crashed with a segmentation fault. The following code in search_conf() conf(targets[i]->parent, targets[i]); results in NULL pointer dereference because targets[i] is the rootmenu, which does not have a parent. Commit d05377e184fc tried to fix the issue of top-level items not having a jump key, but adding the "Main menu" was not the right fix. The correct fix is to show the searched item itself. This fixes another weird behavior described in the comment block. Fixes: d05377e184fc ("kconfig: Create links to main menu items in search") Reported-by: Johannes Zink <j.zink@pengutronix.de> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Tested-by: Bagas Sanjaya <bagasdotme@gmail.com> Tested-by: Johannes Zink <j.zink@pengutronix.de>
2022-10-10Merge tag 'kbuild-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuildLinus Torvalds2-6/+1
Pull Kbuild updates from Masahiro Yamada: - Remove potentially incomplete targets when Kbuid is interrupted by SIGINT etc in case GNU Make may miss to do that when stderr is piped to another program. - Rewrite the single target build so it works more correctly. - Fix rpm-pkg builds with V=1. - List top-level subdirectories in ./Kbuild. - Ignore auto-generated __kstrtab_* and __kstrtabns_* symbols in kallsyms. - Avoid two different modules in lib/zstd/ having shared code, which potentially causes building the common code as build-in and modular back-and-forth. - Unify two modpost invocations to optimize the build process. - Remove head-y syntax in favor of linker scripts for placing particular sections in the head of vmlinux. - Bump the minimal GNU Make version to 3.82. - Clean up misc Makefiles and scripts. * tag 'kbuild-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (41 commits) docs: bump minimal GNU Make version to 3.82 ia64: simplify esi object addition in Makefile Revert "kbuild: Check if linker supports the -X option" kbuild: rebuild .vmlinux.export.o when its prerequisite is updated kbuild: move modules.builtin(.modinfo) rules to Makefile.vmlinux_o zstd: Fixing mixed module-builtin objects kallsyms: ignore __kstrtab_* and __kstrtabns_* symbols kallsyms: take the input file instead of reading stdin kallsyms: drop duplicated ignore patterns from kallsyms.c kbuild: reuse mksysmap output for kallsyms mksysmap: update comment about __crc_* kbuild: remove head-y syntax kbuild: use obj-y instead extra-y for objects placed at the head kbuild: hide error checker logs for V=1 builds kbuild: re-run modpost when it is updated kbuild: unify two modpost invocations kbuild: move vmlinux.o rule to the top Makefile kbuild: move .vmlinux.objs rule to Makefile.modpost kbuild: list sub-directories in ./Kbuild Makefile.compiler: replace cc-ifversion with compiler-specific macros ...
2022-09-29Kconfig: remove sym_set_choice_valueZeng Heng2-6/+1
sym_set_choice_value could be removed and directly call sym_set_tristate_value instead. Signed-off-by: Zeng Heng <zengheng4@huawei.com> Suggested-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2022-09-28Kbuild: add Rust supportMiguel Ojeda1-0/+75
Having most of the new files in place, we now enable Rust support in the build system, including `Kconfig` entries related to Rust, the Rust configuration printer and a few other bits. Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Tested-by: Nick Desaulniers <ndesaulniers@google.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Co-developed-by: Alex Gaynor <alex.gaynor@gmail.com> Signed-off-by: Alex Gaynor <alex.gaynor@gmail.com> Co-developed-by: Finn Behrens <me@kloenk.de> Signed-off-by: Finn Behrens <me@kloenk.de> Co-developed-by: Adam Bratschi-Kaye <ark.email@gmail.com> Signed-off-by: Adam Bratschi-Kaye <ark.email@gmail.com> Co-developed-by: Wedson Almeida Filho <wedsonaf@google.com> Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com> Co-developed-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Co-developed-by: Sven Van Asbroeck <thesven73@gmail.com> Signed-off-by: Sven Van Asbroeck <thesven73@gmail.com> Co-developed-by: Gary Guo <gary@garyguo.net> Signed-off-by: Gary Guo <gary@garyguo.net> Co-developed-by: Boris-Chengbiao Zhou <bobo1239@web.de> Signed-off-by: Boris-Chengbiao Zhou <bobo1239@web.de> Co-developed-by: Boqun Feng <boqun.feng@gmail.com> Signed-off-by: Boqun Feng <boqun.feng@gmail.com> Co-developed-by: Douglas Su <d0u9.su@outlook.com> Signed-off-by: Douglas Su <d0u9.su@outlook.com> Co-developed-by: Dariusz Sosnowski <dsosnowski@dsosnowski.pl> Signed-off-by: Dariusz Sosnowski <dsosnowski@dsosnowski.pl> Co-developed-by: Antonio Terceiro <antonio.terceiro@linaro.org> Signed-off-by: Antonio Terceiro <antonio.terceiro@linaro.org> Co-developed-by: Daniel Xu <dxu@dxuuu.xyz> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz> Co-developed-by: Björn Roy Baron <bjorn3_gh@protonmail.com> Signed-off-by: Björn Roy Baron <bjorn3_gh@protonmail.com> Co-developed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-09-24Kconfig: remove unused function 'menu_get_root_menu'Zeng Heng2-6/+0
There is nowhere calling `menu_get_root_menu` function, so remove it. Signed-off-by: Zeng Heng <zengheng4@huawei.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2022-07-27kconfig: Qt5: tell the user which packages are requiredRandy Dunlap1-0/+1
Along with saying "Please install Qt5 ...", tell exactly which parts of Qt5 are needed. This is useful when parts of Qt5 are installed but some of the required pieces are missing, and it eliminates the need for the user to find the shell script and the line in it that provide that information. Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2022-06-05scripts: kconfig: nconf: make nconfig accept jk keybindingsIsak Ellmer1-2/+6
Make nconfig accept jk keybindings for movement in addition to arrow keys. Signed-off-by: Isak Ellmer <isak01@gmail.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2022-04-05kbuild: Allow kernel installation packaging to override pkg-configChun-Tse Shao4-29/+29
Add HOSTPKG_CONFIG to allow tooling that builds the kernel to override what pkg-config and parameters are used. Signed-off-by: Chun-Tse Shao <ctshao@google.com> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2022-04-02kconfig: remove stale comment about removed kconfig_print_symbol()Masahiro Yamada1-7/+0
This comment is about kconfig_print_symbol(), which was removed by commit 6ce45a91a982 ("kconfig: refactor conf_write_symbol()"). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2022-02-18kconfig: fix missing '# end of' for empty menuMasahiro Yamada1-12/+13
Currently, "# end of ..." is inserted when the menu goes back to its parent. Hence, an empty menu: menu "Foo" endmenu ... ends up with unbalanced menu comments, like this: # # Foo # Let's close the menu comments properly: # # Foo # # end of Foo Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2022-02-18kconfig: add fflush() before ferror() checkMasahiro Yamada1-0/+2
As David Laight pointed out, there is not much point in calling ferror() unless you call fflush() first. Reported-by: David Laight <David.Laight@ACULAB.COM> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2022-02-12kconfig: fix failing to generate auto.confJing Leng1-4/+9
When the KCONFIG_AUTOCONFIG is specified (e.g. export \ KCONFIG_AUTOCONFIG=output/config/auto.conf), the directory of include/config/ will not be created, so kconfig can't create deps files in it and auto.conf can't be generated. Signed-off-by: Jing Leng <jleng@ambarella.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2022-02-10kconfig: fix missing fclose() on error pathsMasahiro Yamada1-6/+6
The file is not closed when ferror() fails. Fixes: 00d674cb3536 ("kconfig: refactor conf_write_dep()") Fixes: 57ddd07c4560 ("kconfig: refactor conf_write_autoconf()") Reported-by: Ryan Cai <ycaibb@gmail.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2022-02-08kconfig: let 'shell' return enough output for deep path namesBrenda Streiff1-1/+1
The 'shell' built-in only returns the first 256 bytes of the command's output. In some cases, 'shell' is used to return a path; by bumping up the buffer size to 4096 this lets us capture up to PATH_MAX. The specific case where I ran into this was due to commit 1e860048c53e ("gcc-plugins: simplify GCC plugin-dev capability test"). After this change, we now use `$(shell,$(CC) -print-file-name=plugin)` to return a path; if the gcc path is particularly long, then the path ends up truncated at the 256 byte mark, which makes the HAVE_GCC_PLUGINS depends test always fail. Signed-off-by: Brenda Streiff <brenda.streiff@ni.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2022-01-08kbuild: do not quote string values in include/config/auto.confMasahiro Yamada1-11/+13
The previous commit fixed up all shell scripts to not include include/config/auto.conf. Now that include/config/auto.conf is only included by Makefiles, we can change it into a more Make-friendly form. Previously, Kconfig output string values enclosed with double-quotes (both in the .config and include/config/auto.conf): CONFIG_X="foo bar" Unlike shell, Make handles double-quotes (and single-quotes as well) verbatim. We must rip them off when used. There are some patterns: [1] $(patsubst "%",%,$(CONFIG_X)) [2] $(CONFIG_X:"%"=%) [3] $(subst ",,$(CONFIG_X)) [4] $(shell echo $(CONFIG_X)) These are not only ugly, but also fragile. [1] and [2] do not work if the value contains spaces, like CONFIG_X=" foo bar " [3] does not work correctly if the value contains double-quotes like CONFIG_X="foo\"bar" [4] seems to work better, but has a cost of forking a process. Anyway, quoted strings were always PITA for our Makefiles. This commit changes Kconfig to stop quoting in include/config/auto.conf. These are the string type symbols referenced in Makefiles or scripts: ACPI_CUSTOM_DSDT_FILE ARC_BUILTIN_DTB_NAME ARC_TUNE_MCPU BUILTIN_DTB_SOURCE CC_IMPLICIT_FALLTHROUGH CC_VERSION_TEXT CFG80211_EXTRA_REGDB_KEYDIR EXTRA_FIRMWARE EXTRA_FIRMWARE_DIR EXTRA_TARGETS H8300_BUILTIN_DTB INITRAMFS_SOURCE LOCALVERSION MODULE_SIG_HASH MODULE_SIG_KEY NDS32_BUILTIN_DTB NIOS2_DTB_SOURCE OPENRISC_BUILTIN_DTB SOC_CANAAN_K210_DTB_SOURCE SYSTEM_BLACKLIST_HASH_LIST SYSTEM_REVOCATION_KEYS SYSTEM_TRUSTED_KEYS TARGET_CPU UNUSED_KSYMS_WHITELIST XILINX_MICROBLAZE0_FAMILY XILINX_MICROBLAZE0_HW_VER XTENSA_VARIANT_NAME I checked them one by one, and fixed up the code where necessary. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-12-02streamline_config.pl: show the full Kconfig nameŁukasz Stelmach1-1/+1
Show the very same file name that was passed to open() in case the operation failed. Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
2021-12-02kconfig: Add `make mod2noconfig` to disable module optionsJosh Triplett2-8/+12
When converting a modular kernel to a monolithic kernel, once the kernel works without loading any modules, this helps to quickly disable all the modules before turning off module support entirely. Refactor conf_rewrite_mod_or_yes to a more general conf_rewrite_tristates that accepts an old and new state. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Tested-by: Björn Töpel <bjorn@kernel.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-10-11kconfig: refactor conf_touch_dep()Masahiro Yamada1-18/+4
If this function fails to touch a dummy header due to missing parent directory, then it creates it and touches the file again. This was needed because CONFIG_FOO_BAR was previously tracked by include/config/foo/bar.h. (include/config/foo/ may not exist here) This is no longer the case since commit 0e0345b77ac4 ("kbuild: redo fake deps at include/config/*.h"); now all the fake headers are placed right under include/config/, like include/config/FOO_BAR. Do not try to create parent directory, include/config/, which already exists. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-10-11kconfig: refactor conf_write_dep()Masahiro Yamada1-17/+37
The if ... else inside the for-loop is unneeded because one empty line is placed after printing the last element of deps_config. Currently, all errors in conf_write_dep() are ignored. Add proper error checks. Rename it to conf_write_autoconf_cmd(), which is more intuitive. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-10-11kconfig: refactor conf_write_autoconf()Masahiro Yamada1-37/+57
This function does similar for auto.conf and autoconf.h Create __conf_write_autoconf() helper to factor out the common code. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-10-11kconfig: add conf_get_autoheader_name()Masahiro Yamada1-3/+8
For consistency with conf_get_autoconfig_name() Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-10-11kconfig: move sym_escape_string_value() to confdata.cMasahiro Yamada3-47/+45
Now that sym_escape_string_value() is only used in confdata.c it can be a 'static' function. Rename it escape_string_value() because it is agnostic about (struct sym *). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-10-11kconfig: refactor listnewconfig codeMasahiro Yamada3-12/+8
We can reuse __print_symbol() helper to print symbols for listnewconfig. Only the difference is the format for "n" symbols. This prints "CONFIG_FOO=n" instead of "# CONFIG_FOO is not set". Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-10-11kconfig: refactor conf_write_symbol()Masahiro Yamada1-79/+57
I do not think 'struct conf_printer' is so useful. Add simple functions, print_symbol_for_*() to write out one symbol. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-10-11kconfig: refactor conf_write_heading()Masahiro Yamada1-62/+33
All the call sites of conf_write_heading() pass NULL to the third argument, and it is not used in the function. Also, the print_comment hooks are doing much more complex than needed. Rewrite the code. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-10-01kconfig: remove 'const' from the return type of sym_escape_string_value()Masahiro Yamada4-23/+24
sym_escape_string_value() returns a malloc'ed memory, but as (const char *). So, it must be casted to (void *) when it is free'd. This is odd. The return type of sym_escape_string_value() should be (char *). I exploited that free(NULL) has no effect. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-09-30kconfig: rename a variable in the lexer to a clearer nameMasahiro Yamada1-3/+3
In Kconfig, like Python, you can enclose a string by double-quotes or single-quotes. So, both "foo" and 'foo' are allowed. The variable, "str", is used to remember whether the string started with a double-quote or a single-quote because open/closing quotation marks must match. The name "str" is too generic to understand the intent. Rename it to "open_quote", which is easier to understand. The type should be 'char'. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Boris Kolpackov <boris@codesynthesis.com>
2021-09-30kconfig: narrow the scope of variables in the lexerMasahiro Yamada1-1/+2
The variables, "ts" and "i", are used locally in the action of the [ \t]+ pattern in the <HELP> start state. Define them where they are used. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-09-25kconfig: Create links to main menu items in searchAriel Marcovitch1-15/+18
When one searches for a main menu item, links aren't created for it like with the rest of the symbols. This happens because we trace the item until we get to the rootmenu, but we don't include it in the path of the item. The rationale was probably that we don't want to show the main menu in the path of all items, because it is redundant. However, when an item has only the rootmenu in its path it should be included, because this way the user can jump to its location. Add a 'Main menu' entry in the 'Location:' section for the kconfig items. This makes the 'if (i > 0)' superfluous because each item with prompt will have at least one menu in its path. Signed-off-by: Ariel Marcovitch <arielmarcovitch@gmail.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-08-10scripts: merge_config: add strict mode to fail upon any redefinitionMatthias Maennich1-0/+15
When merging configuration fragments, it might be of interest to identify mismatches (redefinitions) programmatically. Hence add the option -s (strict mode) to instruct merge_config.sh to bail out in case any redefinition has been detected. With strict mode, warnings are emitted as before, but the script terminates with rc=1. If -y is set to define "builtin having precedence over modules", fragments are still allowed to set =m (while the base config has =y). Strict mode will tolerate that as demotions from =y to =m are ignored when setting -y. Signed-off-by: Matthias Maennich <maennich@google.com> Reviewed-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-07-10Merge tag 'kbuild-v5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuildLinus Torvalds1-1/+1
Pull Kbuild updates from Masahiro Yamada: - Increase the -falign-functions alignment for the debug option. - Remove ugly libelf checks from the top Makefile. - Make the silent build (-s) more silent. - Re-compile the kernel if KBUILD_BUILD_TIMESTAMP is specified. - Various script cleanups * tag 'kbuild-v5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (27 commits) scripts: add generic syscallnr.sh scripts: check duplicated syscall number in syscall table sparc: syscalls: use pattern rules to generate syscall headers parisc: syscalls: use pattern rules to generate syscall headers nds32: add arch/nds32/boot/.gitignore kbuild: mkcompile_h: consider timestamp if KBUILD_BUILD_TIMESTAMP is set kbuild: modpost: Explicitly warn about unprototyped symbols kbuild: remove trailing slashes from $(KBUILD_EXTMOD) kconfig.h: explain IS_MODULE(), IS_ENABLED() kconfig: constify long_opts scripts/setlocalversion: simplify the short version part scripts/setlocalversion: factor out 12-chars hash construction scripts/setlocalversion: add more comments to -dirty flag detection scripts/setlocalversion: remove workaround for old make-kpkg scripts/setlocalversion: remove mercurial, svn and git-svn supports kbuild: clean up ${quiet} checks in shell scripts kbuild: sink stdout from cmd for silent build init: use $(call cmd,) for generating include/generated/compile.h kbuild: merge scripts/mkmakefile to top Makefile sh: move core-y in arch/sh/Makefile to arch/sh/Kbuild ...
2021-06-29streamline_config.pl: add softtabstop=4 for vim usersSteven Rostedt (VMware)1-0/+2
The tab stop for Perl files is by default (at least in emacs) to be 4 spaces, where a tab is used for all 8 spaces. Add a local variable comment to make vim do the same by default, and this will help keep the file consistent in the future when others edit it via vim and not emacs. Link: https://lkml.kernel.org/r/20210322214032.293992979@goodmis.org Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Cc: Masahiro Yamada <masahiroy@kernel.org> Cc: "John (Warthog9) Hawley" <warthog9@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-06-29streamline_config.pl: make spacing consistentSteven Rostedt (VMware)1-39/+39
Patch series "streamline_config.pl: Fix Perl spacing". Talking with John Hawley about how vim and emacs deal with Perl files with respect to tabs and spaces, I found that some of my Perl code in the kernel had inconsistent spacing. The way emacs handles Perl by default is to use 4 spaces per indent, but make all 8 spaces into a single tab. Vim does not do this by default. But if you add the vim variable control: # vim: softtabstop=4 to a perl file, it makes vim behave the same way as emacs. The first patch is to change all 8 spaces into a single tab (mostly from people editing the file with vim). The next patch adds the softtabstop variable to make vim act like emacs by default. This patch (of 2): As Perl code tends to have 4 space indentation, but uses tabs for every 8 spaces, make that consistent in the streamline_config.pl code. Replace all 8 spaces with a single tab. Link: https://lkml.kernel.org/r/20210322214032.133596267@goodmis.org Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Cc: "John (Warthog9) Hawley" <warthog9@kernel.org> Cc: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-06-05kconfig: constify long_optsMasahiro Yamada1-1/+1
getopt_long() does not modify the long_opts structure. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-04-29Merge tag 'kconfig-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuildLinus Torvalds24-635/+559
Pull Kconfig updates from Masahiro Yamada: - Change 'option defconfig' to the environment variable KCONFIG_DEFCONFIG_LIST - Refactor tinyconfig without using allnoconfig_y - Remove 'option allnoconfig_y' syntax - Change 'option modules' to 'modules' - Do not use /boot/config-* etc. as base config for cross-compilation - Fix a search bug in nconf - Various code cleanups * tag 'kconfig-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (34 commits) kconfig: refactor .gitignore kconfig: highlight xconfig 'comment' lines with '***' kconfig: highlight gconfig 'comment' lines with '***' kconfig: gconf: remove unused code kconfig: remove unused PACKAGE definition kconfig: nconf: stop endless search loops kconfig: split menu.c out of parser.y kconfig: nconf: refactor in print_in_middle() kconfig: nconf: remove meaningless wattrset() call from show_menu() kconfig: nconf: change set_config_filename() to void function kconfig: nconf: refactor attributes setup code kconfig: nconf: remove unneeded default for menu prompt kconfig: nconf: get rid of (void) casts from wattrset() calls kconfig: nconf: fix NORMAL attributes kconfig: mconf,nconf: remove unneeded '\0' termination after snprintf() kconfig: use /boot/config-* etc. as DEFCONFIG_LIST only for native build kconfig: change sym_change_count to a boolean flag kconfig: nconf: fix core dump when searching in empty menu kconfig: lxdialog: A spello fix and a punctuation added kconfig: streamline_config.pl: Couple of typo fixes ...
2021-04-26kconfig: refactor .gitignoreMasahiro Yamada1-10/+3
Add '/' prefix to clarify that the generated files exist right under scripts/kconfig/, but not in any sub-directory. Replace '*conf-cfg' with '[gmnq]conf-cfg' to make it explicit, and still short enough. Use '[gmnq]conf' to combine gconf, mconf, nconf, and qconf. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-04-25kbuild: redo fake deps at include/config/*.hAlexey Dobriyan1-10/+5
Make include/config/foo/bar.h fake deps files generation simpler. * delete .h suffix those aren't header files, shorten filenames, * delete tolower() Linux filesystems can deal with both upper and lowercase filenames very well, * put everything in 1 directory Presumably 'mkdir -p' split is from dark times when filesystems handled huge directories badly, disks were round adding to seek times. x86_64 allmodconfig lists 12364 files in include/config. ../obj/include/config/ ├── 104_QUAD_8 ├── 60XX_WDT ├── 64BIT ... ├── ZSWAP_DEFAULT_ON ├── ZSWAP_ZPOOL_DEFAULT └── ZSWAP_ZPOOL_DEFAULT_ZBUD 0 directories, 12364 files Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-04-19kconfig: highlight xconfig 'comment' lines with '***'Randy Dunlap1-0/+1
Mark Kconfig "comment" lines with "*** <commentstring> ***" so that it is clear that these lines are comments and not some kconfig item that cannot be modified. This is helpful in some menus to be able to provide a menu "sub-heading" for groups of similar config items. This also makes the comments be presented in a way that is similar to menuconfig and nconfig. Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-04-19kconfig: highlight gconfig 'comment' lines with '***'Randy Dunlap1-2/+6
Mark Kconfig "comment" lines with "*** <commentstring> ***" so that it is clear that these lines are comments and not some kconfig item that cannot be modified. This is helpful in some menus to be able to provide a menu "sub-heading" for groups of similar config items. This also makes the comments be presented in a way that is similar to menuconfig and nconfig. Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-04-19kconfig: gconf: remove unused codeMasahiro Yamada1-7/+0
Remove the unused <config.h> inclusion, and commented out lines. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-04-19kconfig: remove unused PACKAGE definitionMasahiro Yamada1-4/+0
Commit 3b9fa0931dd8 ("[PATCH] Kconfig i18n support") added this code, and then commit ("kconfig: drop localization support") removed the i18n support entirely. Remove the left-over. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-04-16kconfig: nconf: stop endless search loopsMihai Moldovan1-1/+1
If the user selects the very first entry in a page and performs a search-up operation, or selects the very last entry in a page and performs a search-down operation that will not succeed (e.g., via [/]asdfzzz[Up Arrow]), nconf will never terminate searching the page. The reason is that in this case, the starting point will be set to -1 or n, which is then translated into (n - 1) (i.e., the last entry of the page) or 0 (i.e., the first entry of the page) and finally the search begins. This continues to work fine until the index reaches 0 or (n - 1), at which point it will be decremented to -1 or incremented to n, but not checked against the starting point right away. Instead, it's wrapped around to the bottom or top again, after which the starting point check occurs... and naturally fails. My original implementation added another check for -1 before wrapping the running index variable around, but Masahiro Yamada pointed out that the actual issue is that the comparison point (starting point) exceeds bounds (i.e., the [0,n-1] interval) in the first place and that, instead, the starting point should be fixed. This has the welcome side-effect of also fixing the case where the starting point was n while searching down, which also lead to an infinite loop. OTOH, this code is now essentially all his work. Amazingly, nobody seems to have been hit by this for 11 years - or at the very least nobody bothered to debug and fix this. Signed-off-by: Mihai Moldovan <ionic@ionic.de> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-04-14kconfig: split menu.c out of parser.yMasahiro Yamada4-5/+14
Compile menu.c as an independent compilation unit. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-04-14kconfig: nconf: refactor in print_in_middle()Masahiro Yamada3-34/+6
This helper is the same as the sample code in the NCURSES HOWTO [1], but it is over-engineering to be used for nconf. I do not see any good reason to use the 'float' type just for the division by 2. All the call-sites pass a non-NULL pointer to the first argument, so 'if (win == NULL) win = stdscr;' is dead code. 'if (startx != 0) x = startx;' is dead code because 'x' will be overridden some lines below, by 'x = startx + (int)temp;'. All the call-sites pass a non-zero value to the second argument, so 'if (starty != 0)' is always true. getyx(win, y, x) is also dead-code because both 'y' and 'x' are overridden. All the call-sites pass 0 to the third parameter, so 'startx' can be removed. All the call-sites pass a non-zero value to the fourth parameter, so 'if (width == 0) width = 80;' is dead code. The window will be refreshed later, so there is no need to call refresh() in this function. Change the type of the last parameter from 'chtype' to 'int' to be aligned with the prototype, 'int wattrset(WINDOW *win, int attrs);' I also slightly cleaned up the indentation style. [1]: https://tldp.org/HOWTO/NCURSES-Programming-HOWTO/color.html Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-04-14kconfig: nconf: remove meaningless wattrset() call from show_menu()Masahiro Yamada1-1/+0
This attribute is not used because it will be overridden some lines below: wattrset(main_window, attr_main_menu_box); Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-04-14kconfig: nconf: change set_config_filename() to void functionMasahiro Yamada1-2/+1
No one uses the return value of this function. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-04-14kconfig: nconf: refactor attributes setup codeMasahiro Yamada3-175/+144
The current attributes setup code is strange; the array attribute[] is set to values outside the range of the attribute_t enum. At least, attributes_t attributes[ATTR_MAX+1] = {0}; ... should be int attribute[ATTR_MAX+1] = {0}; Also, there is no need to hard-code the color-pair numbers in attributes_t. The current code is messy. Rewrite it. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-04-14kconfig: nconf: remove unneeded default for menu promptMasahiro Yamada1-4/+2
The rootmenu always has a prompt even if the 'mainmenu' statement is missing in the top Kconfig file. conf_parse() calls menu_add_prompt(P_MENU, "Main menu", NULL) in this case. So, every 'menu' has a prompt. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-04-14kconfig: nconf: get rid of (void) casts from wattrset() callsMasahiro Yamada2-17/+17
This reverts commit 10175ba65fde ("nconfig: Silence unused return values from wattrset"). With this patch applied, recent GCC versions can cleanly build nconf without "value computed is not used" warnings. The wattrset() used to be implemented as a macro, like this: #define wattrset(win,at) \ (NCURSES_OK_ADDR(win) \ ? ((win)->_attrs = NCURSES_CAST(attr_t, at), \ OK) \ : ERR) The GCC bugzilla [1] reported a false-positive -Wunused-value warning in a similar test case. It was fixed by GCC 4.4.1. Let's revert that commit, and see if somebody will claim the issue. [1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39889 Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-04-14kconfig: nconf: fix NORMAL attributesMasahiro Yamada1-2/+2
The lower 8-bit of attributes should be 0, but this code wrongly sets it to NORMAL (=1). The correct one is A_NORMAL. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>