summaryrefslogtreecommitdiffstats
path: root/scripts
Commit message (Collapse)AuthorAgeFilesLines
* kconfig: do not imply the type of choice valueMasahiro Yamada2024-02-201-6/+0
| | | | | | | | | | Do not feed back the choice type to choice values. Each choice value should explicitly specify 'bool' or 'tristate', as all the Kconfig files already do. If the type were missing, "config symbol defined without type" would be shown. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: convert linked list of files to hash tableMasahiro Yamada2024-02-201-9/+11
| | | | | | | | | | | | | | | | | | | Currently, a linked list is used to keep track of all the Kconfig files that have ever been parsed. Every time the "source" statement is encountered, the linked list is traversed to check if the file has been opened before. This prevents the same file from being recorded in include/config/auto.conf.cmd again. Given 1500+ Kconfig files parsed, a hashtable is now a more optimal data structure. By the way, you may wonder why we check this in the first place. It matters only when the same file is included multiple times. In old days, such a use case was forbidden, but commit f094f8a1b273 ("kconfig: allow multiple inclusion of the same file") provided a bit more flexibility. Of course, it is almost hypothetical... Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: move strhash() to util.c as a global functionMasahiro Yamada2024-02-203-9/+11
| | | | | | | Remove the 'static' qualifier from strhash() so that it can be accessed from other files. Move it to util.c, which is a more appropriate location. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: move ARRAY_SIZE to a headerMasahiro Yamada2024-02-192-2/+12
| | | | | | | To use ARRAY_SIZE from other files, move it to its own header, just like include/linux/array_size.h. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: add macros useful for hashtableMasahiro Yamada2024-02-191-0/+48
| | | | | | | This is similar to include/linux/hashtable.h, but the implementation has been simplified. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: import more list macros and inline functionsMasahiro Yamada2024-02-192-0/+77
| | | | | | | Import more macros and inline functions from include/linux/list.h and include/linux/types.h. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: resync list.hMasahiro Yamada2024-02-191-62/+121
| | | | | | | | | | Update the existing macros and inline functions based on include/linux/list.h. The variable name '_new' can be reverted to 'new' because this header is no longer included from the C++ file, scripts/kconfig/qconf.cc. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: split list_head into a separate headerMasahiro Yamada2024-02-196-7/+15
| | | | | | | | | | | | | The struct list_head is often embedded in other structures, while other code is used in C functions. By separating struct list_head into its own header, other headers are no longer required to include the entire list.h. This is similar to the kernel space, where struct list_head is defined in <linux/types.h> instead of <linux/list.h>. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: change file_lookup() to return the file nameMasahiro Yamada2024-02-195-16/+13
| | | | | | | | | | | | Currently, file_lookup() returns a pointer to (struct file), but the callers use only file->name. Make it return the ->name member directly. This adjustment encapsulates struct file and file_list as internal implementation. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: make file::name a flexible array memberMasahiro Yamada2024-02-192-3/+6
| | | | | | Call malloc() just once to allocate needed memory. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: move the file and lineno in struct file to struct bufferMasahiro Yamada2024-02-193-33/+23
| | | | | | | | | | | | | | struct file has two link nodes, 'next' and 'parent'. The former is used to link files in the 'file_list' linked list, which manages the list of Kconfig files seen so far. The latter is used to link files in the 'current_file' linked list, which manages the inclusion ("source") tree. The latter should be tracked together with the lexer state. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: replace remaining current_file->name with cur_filenameMasahiro Yamada2024-02-192-6/+6
| | | | | | Replace the remaining current_file->name in the lexer context. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: do not delay the cur_filename updateMasahiro Yamada2024-02-192-10/+15
| | | | | | | | Currently, cur_filename is updated at the first token of each statement. However, this seems unnecessary based on my understanding; the parser can use the same variable as the lexer tracks. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: replace file->name with name in zconf_nextfile()Masahiro Yamada2024-02-191-5/+5
| | | | | | The 'file->name' and 'name' are the same in this function. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: associate struct property with file name directlyMasahiro Yamada2024-02-193-9/+9
| | | | | | | | | struct property is linked to struct file for diagnostic purposes. It is always used to retrieve the file name through prop->file->name. Associate struct property with the file name directly. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: associate struct menu with file name directlyMasahiro Yamada2024-02-195-10/+10
| | | | | | | | | struct menu is linked to struct file for diagnostic purposes. It is always used to retrieve the file name through menu->file->name. Associate struct menu with the file name directly. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: remove zconf_curname() and zconf_lineno()Masahiro Yamada2024-02-195-51/+37
| | | | | | | | | | Now zconf_curname() and zconf_lineno() are so simple that they just return cur_filename, cur_lineno, respectively. Remove these functions, and then use cur_filename and cur_lineno directly. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: replace current_pos with separate cur_{filename,lineno}Masahiro Yamada2024-02-191-8/+17
| | | | | | | | | | | | | | | | Replace current_pos with separate variables representing the file name and the line number, respectively. No functional change is intended. By the way, you might wonder why the "<none>" fallback exists in zconf_curname(). menu_add_symbol() saves the current file and the line number. It is intended to be called only during the yyparse() time. However, menu_finalize() calls it, where there is no file being parsed. This is a long-standing hack that should be fixed later. I left a FIXME comment. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: split preprocessor prototypes into preprocess.hMasahiro Yamada2024-02-195-13/+23
| | | | | | | These are needed only for the parse stage. Move the prototypes into a separate header to make sure they are not used after that. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: call env_write_dep() right after yyparse()Masahiro Yamada2024-02-194-12/+18
| | | | | | | | This allows preprocess.c to free up all of its resources when the parse stage is finished. It also ensures conf_write_autoconf_cmd() produces consistent results even if called multiple times for any reason. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: write Kconfig files to autoconf.cmd in orderMasahiro Yamada2024-02-194-4/+11
| | | | | | | | | | Currently, include/config/autoconf.cmd saves included Kconfig files in reverse order. While this is not a big deal, it is inconsistent with other *.cmd files generated by fixdep. Output the included Kconfig files in the included order. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: remove unneeded sym_find() call in conf_parse()Masahiro Yamada2024-02-191-1/+1
| | | | | | sym_find("n") is equivalent to &symbol_no. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: remove compat_getline()Masahiro Yamada2024-02-191-52/+1
| | | | | | | | | | | | | | Commit 1a7a8c6fd8ca ("kconfig: allow long lines in config file") added a self-implemented getline() for better portability. However, getline() is standardized [1] and already used in other programs such as scripts/kallsyms.c. Use getline() provided by libc. [1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getdelim.html Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: remove orphan lookup_file() declarationMasahiro Yamada2024-02-191-1/+0
| | | | | | There is no definition, no caller for lookup_file(). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: fix off-by-one in zconf_error()Masahiro Yamada2024-02-191-1/+1
| | | | | | | | | | | | | | yyerror() reports the line number of the next line. This +1 adjustment was introduced more than 20 years ago [1]. At that time, the line number was decremented then incremented back and forth. The line number management was refactored in a more maintainable way. Such compensation is no longer needed. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/history/history.git/commit/?id=d4f8a4530eb07a1385fd17b0e62a7dce97486f49 Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: fix infinite loop when expanding a macro at the end of fileMasahiro Yamada2024-02-191-2/+5
| | | | | | | | | | | | | | | A macro placed at the end of a file with no newline causes an infinite loop. [Test Kconfig] $(info,hello) \ No newline at end of file I realized that flex-provided input() returns 0 instead of EOF when it reaches the end of a file. Fixes: 104daea149c4 ("kconfig: reference environment variables directly and remove 'option env='") Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* Revert "kbuild/mkspec: clean boot loader configuration on rpm removal"Masahiro Yamada2024-02-191-3/+1
| | | | | | | | | | | | This reverts commit 6ef41e22a320d95a246d45b673aa7247cc1bbf7b. If this is still needed, we can bring it back. However, I'd like to understand why 'new-kernel-pkg --remove' is needed for uninstallation, while 'new-kernel-pkg --install' was not called during the installation. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* Revert "kbuild/mkspec: support 'update-bootloader'-based systems"Masahiro Yamada2024-02-191-5/+0
| | | | | | | | | | | | This reverts commit 27c3bffd230abd0a598586aed0fe0ba7b61e0e2e. If this is still needed, we can bring it back. However, I'd like to understand why 'update-bootloader --remove' is needed for uninstallation, while 'update-bootloader --add' was not called during the installation. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kbuild: rpm-pkg: mark installed files in /boot as %ghostMasahiro Yamada2024-02-191-0/+4
| | | | | | | | Mark the files installed to /boot as %ghost to make sure they will be removed when the package is uninstalled. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Tested-by: Nathan Chancellor <nathan@kernel.org>
* kbuild: rpm-pkg: do not include depmod-generated filesMasahiro Yamada2024-02-191-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | Installing the kernel package is fine, but when uninstalling it, the following warnings are shown: warning: file modules.symbols.bin: remove failed: No such file or directory warning: file modules.symbols: remove failed: No such file or directory warning: file modules.softdep: remove failed: No such file or directory warning: file modules.devname: remove failed: No such file or directory warning: file modules.dep.bin: remove failed: No such file or directory warning: file modules.dep: remove failed: No such file or directory warning: file modules.builtin.bin: remove failed: No such file or directory warning: file modules.builtin.alias.bin: remove failed: No such file or directory warning: file modules.alias.bin: remove failed: No such file or directory warning: file modules.alias: remove failed: No such file or directory The %preun scriptlet runs 'kernel-install remove', which in turn invokes /usr/lib/kernel/install.d/50-depmod.install to remove those files before the actual package removal. RPM-based distributions do not ship files generated by depmod. Mark them as %ghost in order to exclude them from the package, but still claim the ownership on them. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Tested-by: Nathan Chancellor <nathan@kernel.org>
* kbuild: deb-pkg: call more misc debhelper commandsMasahiro Yamada2024-02-192-9/+5
| | | | | | | | | | | | Use dh_prep instead of removing old build directories manually. Use dh_clean instead of removing build directories and debian/files manually. Call dh_testdir and dh_testroot for preliminary checks. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <n.schier@avm.de>
* kbuild: deb-pkg: build binary-arch in parallelMasahiro Yamada2024-02-192-34/+47
| | | | | | | | | | | | | | 'make deb-pkg' builds build-arch in parallel, but binary-arch serially. Given that all binary packages are independent of one another, they can be built in parallel. I am uncertain whether debian/files is robust against a race condition. Just in case, make dh_gencontrol (dpkg-gencontrol) output to separate debian/*.files, which are then concatenated into debian/files. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <n.schier@avm.de>
* kbuild: deb-pkg: make debian/rules quiet for 'make deb-pkg'Masahiro Yamada2024-02-191-7/+9
| | | | | | | | | Add $(Q) to the commands in debian/rules to make them quiet when the package built is initiated by 'make deb-pkg' or when the 'terse' tag is set to DEB_BUILD_OPTIONS. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <n.schier@avm.de>
* kbuild: deb-pkg: show verbose log for direct package buildsMasahiro Yamada2024-02-191-0/+8
| | | | | | | | | | | | | | | | | | | When the Debian package build is initiated by Kbuild ('make deb-pkg' or 'make bindeb-pkg'), the log messages are displayed in the short form, which is the Kbuild default. Otherwise, let's show verbose messages (unless the 'terse' tag is set in DEB_BUILD_OPTION), as suggested by Debian Policy: "The package build should be as verbose as reasonably possible, except where the terse tag is included in DEB_BUILD_OPTIONS." [1] This is what the Debian kernel also does. [2] [1]: https://www.debian.org/doc/debian-policy/ch-source.html#main-building-script-debian-rules [2]: https://salsa.debian.org/kernel-team/linux/-/blob/debian/6.7-1_exp1/debian/rules.real#L36 Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <n.schier@avm.de>
* kbuild: simplify dtbs_install by reading the list of compiled DTBsMasahiro Yamada2024-02-192-20/+18
| | | | | | | | | | | | | Retrieve the list of *.dtb(o) files from arch/*/boot/dts/dtbs-list instead of traversing the directory tree again. Please note that 'make dtbs_install' installs *.dtb(o) files directly added to dtb-y because scripts/Makefile.dtbinst installs $(dtb-y) without expanding the -dtbs suffix. This commit preserves this behavior. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kbuild: create a list of all built DTB filesMasahiro Yamada2024-02-192-8/+18
| | | | | | | | | | | | | | | | | | | | | | | It is useful to have a list of all *.dtb and *.dtbo files generated from the current build. With this commit, 'make dtbs' creates arch/*/boot/dts/dtbs-list, which lists the dtb(o) files created in the current build. It maintains the order of the dtb-y additions in Makefiles although the order is not important for DTBs. It is a (good) side effect through the reuse of the modules.order rule. Please note this list only includes the files directly added to dtb-y. For example, consider this case: foo-dtbs := foo_base.dtb foo_overlay.dtbo dtb-y := foo.dtb In this example, the list will include foo.dtb, but not foo_base.dtb or foo_overlay.dtbo. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: fix line number in recursive inclusion detectionMasahiro Yamada2024-02-191-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | The error message shows a wrong line number if the 'source' directive is wrapped to the following line. [Test Code] source \ "Kconfig" This results in the following error message: Recursive inclusion detected. Inclusion path: current file : Kconfig included from: Kconfig:2 The correct message should be as follows: Recursive inclusion detected. Inclusion path: current file : Kconfig included from: Kconfig:1 Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kconfig: remove unneeded buffer allocation in zconf_initscan()Masahiro Yamada2024-02-191-16/+13
| | | | | | | | | | | In Kconfig, there is a stack to save the lexer state for each inclusion level. Currently, it operates as an empty stack, with the 'current_buf' always pointing to an empty buffer. There is no need to preallocate the buffer. Change it to a full stack. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kallsyms: ignore ARMv4 thunks along with othersArnd Bergmann2024-02-151-11/+2
| | | | | | | | | | | | | | | | | | | | lld is now able to build ARMv4 and ARMv4T kernels, which means it can generate thunks for those (__ARMv4PILongThunk_*, __ARMv4PILongBXThunk_*) that can interfere with kallsyms table generation since they do not get ignore like the corresponding ARMv5+ ones are: Inconsistent kallsyms data Try "make KALLSYMS_EXTRA_PASS=1" as a workaround Replace the hardcoded list of thunk symbols with a more general regex that covers this one along with future symbols that follow the same pattern. Fixes: 5eb6e280432d ("ARM: 9289/1: Allow pre-ARMv5 builds with ld.lld 16.0.0 and newer") Fixes: efe6e3068067 ("kallsyms: fix nonconverging kallsyms table with lld") Suggested-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* modpost: trim leading spaces when processing source files listRadek Krejci2024-02-151-1/+6
| | | | | | | | | | get_line() does not trim the leading spaces, but the parse_source_files() expects to get lines with source files paths where the first space occurs after the file path. Fixes: 70f30cfe5b89 ("modpost: use read_text_file() and get_line() for reading text files") Signed-off-by: Radek Krejci <radek.krejci@oracle.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* gen_compile_commands: fix invalid escape sequence warningAndrew Ballance2024-02-151-1/+1
| | | | | | | | | With python 3.12, '\#' results in this warning SyntaxWarning: invalid escape sequence '\#' Signed-off-by: Andrew Ballance <andrewjballance@gmail.com> Reviewed-by: Justin Stitt <justinstitt@google.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* kbuild: Fix changing ELF file type for output of gen_btf for big endianNathan Chancellor2024-02-151-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 90ceddcb4950 ("bpf: Support llvm-objcopy for vmlinux BTF") changed the ELF type of .btf.vmlinux.bin.o to ET_REL via dd, which works fine for little endian platforms: 00000000 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 |.ELF............| -00000010 03 00 b7 00 01 00 00 00 00 00 00 80 00 80 ff ff |................| +00000010 01 00 b7 00 01 00 00 00 00 00 00 80 00 80 ff ff |................| However, for big endian platforms, it changes the wrong byte, resulting in an invalid ELF file type, which ld.lld rejects: 00000000 7f 45 4c 46 02 02 01 00 00 00 00 00 00 00 00 00 |.ELF............| -00000010 00 03 00 16 00 00 00 01 00 00 00 00 00 10 00 00 |................| +00000010 01 03 00 16 00 00 00 01 00 00 00 00 00 10 00 00 |................| Type: <unknown>: 103 ld.lld: error: .btf.vmlinux.bin.o: unknown file type Fix this by updating the entire 16-bit e_type field rather than just a single byte, so that everything works correctly for all platforms and linkers. 00000000 7f 45 4c 46 02 02 01 00 00 00 00 00 00 00 00 00 |.ELF............| -00000010 00 03 00 16 00 00 00 01 00 00 00 00 00 10 00 00 |................| +00000010 00 01 00 16 00 00 00 01 00 00 00 00 00 10 00 00 |................| Type: REL (Relocatable file) While in the area, update the comment to mention that binutils 2.35+ matches LLD's behavior of rejecting an ET_EXEC input, which occurred after the comment was added. Cc: stable@vger.kernel.org Fixes: 90ceddcb4950 ("bpf: Support llvm-objcopy for vmlinux BTF") Link: https://github.com/llvm/llvm-project/pull/75643 Suggested-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Fangrui Song <maskray@google.com> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu> Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Justin Stitt <justinstitt@google.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* Merge tag 'kbuild-fixes-v6.8' of ↵Linus Torvalds2024-02-015-33/+22
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild Pull Kbuild fixes from Masahiro Yamada: - Fix UML build with clang-18 and newer - Avoid using the alias attribute in host programs - Replace tabs with spaces when followed by conditionals for future GNU Make versions - Fix rpm-pkg for the systemd-provided kernel-install tool - Fix the undefined behavior in Kconfig for a 'int' symbol used in a conditional * tag 'kbuild-fixes-v6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: kconfig: initialize sym->curr.tri to 'no' for all symbol types again kbuild: rpm-pkg: simplify installkernel %post kbuild: Replace tabs with spaces when followed by conditionals modpost: avoid using the alias attribute kbuild: fix W= flags in the help message modpost: Add '.ltext' and '.ltext.*' to TEXT_SECTIONS um: Fix adding '-no-pie' for clang kbuild: defconf: use SRCARCH to find merged configs
| * kconfig: initialize sym->curr.tri to 'no' for all symbol types againMasahiro Yamada2024-01-311-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Geert Uytterhoeven reported that commit 4e244c10eab3 ("kconfig: remove unneeded symbol_empty variable") changed the default value of CONFIG_LOG_CPU_MAX_BUF_SHIFT from 12 to 0. As it turned out, this is an undefined behavior because sym_calc_value() stopped setting the sym->curr.tri field for 'int', 'hex', and 'string' symbols. This commit restores the original behavior, where 'int', 'hex', 'string' symbols are interpreted as false if used in boolean contexts. CONFIG_LOG_CPU_MAX_BUF_SHIFT will default to 12 again, irrespective of CONFIG_BASE_SMALL. Presumably, this is not the intended behavior, as already reported [1], but this is another issue that should be addressed by a separate patch. [1]: https://lore.kernel.org/all/f6856be8-54b7-0fa0-1d17-39632bf29ada@oracle.com/ Fixes: 4e244c10eab3 ("kconfig: remove unneeded symbol_empty variable") Reported-by: Geert Uytterhoeven <geert+renesas@glider.be> Closes: https://lore.kernel.org/all/CAMuHMdWm6u1wX7efZQf=2XUAHascps76YQac6rdnQGhc8nop_Q@mail.gmail.com/ Tested-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
| * kbuild: rpm-pkg: simplify installkernel %postJose Ignacio Tornos Martinez2024-01-311-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new installkernel application that is now included in systemd-udev package allows installation although destination files are already present in the boot directory of the kernel package, but is failing with the implemented workaround for the old installkernel application from grubby package. For the new installkernel application, as Davide says: <<The %post currently does a shuffling dance before calling installkernel. This isn't actually necessary afaict, and the current implementation ends up triggering downstream issues such as https://github.com/systemd/systemd/issues/29568 This commit simplifies the logic to remove the shuffling. For reference, the original logic was added in commit 3c9c7a14b627("rpm-pkg: add %post section to create initramfs and grub hooks").>> But we need to keep the old behavior as well, because the old installkernel application from grubby package, does not allow this simplification and we need to be backward compatible to avoid issues with the different packages. Mimic Fedora shipping process and store vmlinuz, config amd System.map in the module directory instead of the boot directory. In this way, we will avoid the commented problem for all the cases, because the new destination files are not going to exist in the boot directory of the kernel package. Replace installkernel tool with kernel-install tool, because the latter is more complete. Besides, after installkernel tool execution, check to complete if the correct package files vmlinuz, System.map and config files are present in /boot directory, and if necessary, copy manually for install operation. In this way, take into account if files were not previously copied from /usr/lib/kernel/install.d/* scripts and if the suitable files for the requested package are present (it could be others if the rpm files were replace with a new pacakge with the same release and a different build). Tested with Fedora 38, Fedora 39, RHEL 9, Oracle Linux 9.3, openSUSE Tumbleweed and openMandrive ROME, using dnf/zypper and rpm tools. cc: stable@vger.kernel.org Co-Developed-by: Davide Cavalca <dcavalca@meta.com> Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
| * modpost: avoid using the alias attributeMasahiro Yamada2024-01-312-16/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Aiden Leong reported modpost fails to build on macOS since commit 16a473f60edc ("modpost: inform compilers that fatal() never returns"): scripts/mod/modpost.c:93:21: error: aliases are not supported on darwin Nathan's research indicates that Darwin seems to support weak aliases at least [1]. Although the situation might be improved in future Clang versions, we can achieve a similar outcome without relying on it. This commit makes fatal() a macro of error() + exit(1) in modpost.h, as compilers recognize that exit() never returns. [1]: https://github.com/llvm/llvm-project/issues/71001 Fixes: 16a473f60edc ("modpost: inform compilers that fatal() never returns") Reported-by: Aiden Leong <aiden.leong@aibsd.com> Closes: https://lore.kernel.org/all/d9ac2960-6644-4a87-b5e4-4bfb6e0364a8@aibsd.com/ Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
| * modpost: Add '.ltext' and '.ltext.*' to TEXT_SECTIONSNathan Chancellor2024-01-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After the linked LLVM change, building ARCH=um defconfig results in a segmentation fault in modpost. Prior to commit a23e7584ecf3 ("modpost: unify 'sym' and 'to' in default_mismatch_handler()"), there was a warning: WARNING: modpost: vmlinux.o(__ex_table+0x88): Section mismatch in reference to the .ltext:(unknown) WARNING: modpost: The relocation at __ex_table+0x88 references section ".ltext" which is not in the list of authorized sections. If you're adding a new section and/or if this reference is valid, add ".ltext" to the list of authorized sections to jump to on fault. This can be achieved by adding ".ltext" to OTHER_TEXT_SECTIONS in scripts/mod/modpost.c. The linked LLVM change moves global objects to the '.ltext' (and '.ltext.*' with '-ffunction-sections') sections with '-mcmodel=large', which ARCH=um uses. These sections should be handled just as '.text' and '.text.*' are, so add them to TEXT_SECTIONS. Cc: stable@vger.kernel.org Closes: https://github.com/ClangBuiltLinux/linux/issues/1981 Link: https://github.com/llvm/llvm-project/commit/4bf8a688956a759b7b6b8d94f42d25c13c7af130 Signed-off-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
| * kbuild: defconf: use SRCARCH to find merged configsZhang Bingwu2024-01-281-4/+4
| | | | | | | | | | | | | | | | For some ARCH values, SRCARCH, which should be used for finding arch/ subdirectory, is different from ARCH. Signed-off-by: Zhang Bingwu <xtexchooser@duck.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
* | Makefile: Enable -Wstringop-overflow globallyGustavo A. R. Silva2024-01-211-2/+0
|/ | | | | | | | It seems that we have finished addressing all the remaining issues regarding -Wstringop-overflow. So, we are now in good shape to enable this compiler option globally. Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
* Merge tag 'coccinelle-for-6.8' of ↵Linus Torvalds2024-01-201-9/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux Pull coccinelle updates from Julia Lawall: "Updates to the device_attr_show semantic patch to reflect the new guidelines of the Linux kernel documentation. The problem was identified by Li Zhijian <lizhijian@fujitsu.com>, who proposed an initial fix" * tag 'coccinelle-for-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux: coccinelle: device_attr_show: simplify patch case coccinelle: device_attr_show: Adapt to the latest Documentation/filesystems/sysfs.rst