Commit f4d2ef48 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull Kbuild updates from Masahiro Yamada:

 - Improve performance in gendwarfksyms

 - Remove deprecated EXTRA_*FLAGS and KBUILD_ENABLE_EXTRA_GCC_CHECKS

 - Support CONFIG_HEADERS_INSTALL for ARCH=um

 - Use more relative paths to sources files for better reproducibility

 - Support the loong64 Debian architecture

 - Add Kbuild bash completion

 - Introduce intermediate vmlinux.unstripped for architectures that need
   static relocations to be stripped from the final vmlinux

 - Fix versioning in Debian packages for -rc releases

 - Treat missing MODULE_DESCRIPTION() as an error

 - Convert Nios2 Makefiles to use the generic rule for built-in DTB

 - Add debuginfo support to the RPM package

* tag 'kbuild-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (40 commits)
  kbuild: rpm-pkg: build a debuginfo RPM
  kconfig: merge_config: use an empty file as initfile
  nios2: migrate to the generic rule for built-in DTB
  rust: kbuild: skip `--remap-path-prefix` for `rustdoc`
  kbuild: pacman-pkg: hardcode module installation path
  kbuild: deb-pkg: don't set KBUILD_BUILD_VERSION unconditionally
  modpost: require a MODULE_DESCRIPTION()
  kbuild: make all file references relative to source root
  x86: drop unnecessary prefix map configuration
  kbuild: deb-pkg: add comment about future removal of KDEB_COMPRESS
  kbuild: Add a help message for "headers"
  kbuild: deb-pkg: remove "version" variable in mkdebian
  kbuild: deb-pkg: fix versioning for -rc releases
  Documentation/kbuild: Fix indentation in modules.rst example
  x86: Get rid of Makefile.postlink
  kbuild: Create intermediate vmlinux build with relocations preserved
  kbuild: Introduce Kconfig symbol for linking vmlinux with relocations
  kbuild: link-vmlinux.sh: Make output file name configurable
  kbuild: do not generate .tmp_vmlinux*.map when CONFIG_VMLINUX_MAP=y
  Revert "kheaders: Ignore silly-rename files"
  ...
parents 758e4c86 a7c699d0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ modules.order
/vmlinux.32
/vmlinux.map
/vmlinux.symvers
/vmlinux.unstripped
/vmlinux-gdb.py
/vmlinuz
/System.map
+0 −18
Original line number Diff line number Diff line
@@ -342,24 +342,6 @@ API usage

    See: https://www.kernel.org/doc/html/latest/RCU/whatisRCU.html#full-list-of-rcu-apis

  **DEPRECATED_VARIABLE**
    EXTRA_{A,C,CPP,LD}FLAGS are deprecated and should be replaced by the new
    flags added via commit f77bf01425b1 ("kbuild: introduce ccflags-y,
    asflags-y and ldflags-y").

    The following conversion scheme maybe used::

      EXTRA_AFLAGS    ->  asflags-y
      EXTRA_CFLAGS    ->  ccflags-y
      EXTRA_CPPFLAGS  ->  cppflags-y
      EXTRA_LDFLAGS   ->  ldflags-y

    See:

      1. https://lore.kernel.org/lkml/20070930191054.GA15876@uranus.ravnborg.org/
      2. https://lore.kernel.org/lkml/1313384834-24433-12-git-send-email-lacombar@gmail.com/
      3. https://www.kernel.org/doc/html/latest/kbuild/makefiles.html#compilation-flags

  **DEVICE_ATTR_FUNCTIONS**
    The function names used in DEVICE_ATTR is unusual.
    Typically, the store and show functions are used with <attr>_store and
+65 −0
Original line number Diff line number Diff line
.. SPDX-License-Identifier: GPL-2.0-only

==========================
Bash completion for Kbuild
==========================

The kernel build system is written using Makefiles, and Bash completion
for the `make` command is available through the `bash-completion`_ project.

However, the Makefiles for the kernel build are complex. The generic completion
rules for the `make` command do not provide meaningful suggestions for the
kernel build system, except for the options of the `make` command itself.

To enhance completion for various variables and targets, the kernel source
includes its own completion script at `scripts/bash-completion/make`.

This script provides additional completions when working within the kernel tree.
Outside the kernel tree, it defaults to the generic completion rules for the
`make` command.

Prerequisites
=============

The script relies on helper functions provided by `bash-completion`_ project.
Please ensure it is installed on your system. On most distributions, you can
install the `bash-completion` package through the standard package manager.

How to use
==========

You can source the script directly::

  $ source scripts/bash-completion/make

Or, you can copy it into the search path for Bash completion scripts.
For example::

  $ mkdir -p ~/.local/share/bash-completion/completions
  $ cp scripts/bash-completion/make ~/.local/share/bash-completion/completions/

Details
=======

The additional completion for Kbuild is enabled in the following cases:

 - You are in the root directory of the kernel source.
 - You are in the top-level build directory created by the O= option
   (checked via the `source` symlink pointing to the kernel source).
 - The -C make option specifies the kernel source or build directory.
 - The -f make option specifies a file in the kernel source or build directory.

If none of the above are met, it falls back to the generic completion rules.

The completion supports:

  - Commonly used targets, such as `all`, `menuconfig`, `dtbs`, etc.
  - Make (or environment) variables, such as `ARCH`, `LLVM`, etc.
  - Single-target builds (`foo/bar/baz.o`)
  - Configuration files (`*_defconfig` and `*.config`)

Some variables offer intelligent behavior. For instance, `CROSS_COMPILE=`
followed by a TAB displays installed toolchains. The list of defconfig files
shown depends on the value of the `ARCH=` variable.

.. _bash-completion: https://github.com/scop/bash-completion/
+2 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ Kernel Build System
    llvm
    gendwarfksyms

    bash-completion

.. only::  subproject and html

   Indices
+18 −11
Original line number Diff line number Diff line
@@ -194,16 +194,6 @@ applicable everywhere (see syntax).
  ability to hook into a secondary subsystem while allowing the user to
  configure that subsystem out without also having to unset these drivers.

  Note: If the combination of FOO=y and BAZ=m causes a link error,
  you can guard the function call with IS_REACHABLE()::

	foo_init()
	{
		if (IS_REACHABLE(CONFIG_BAZ))
			baz_register(&foo);
		...
	}

  Note: If the feature provided by BAZ is highly desirable for FOO,
  FOO should imply not only BAZ, but also its dependency BAR::

@@ -588,7 +578,9 @@ uses the slightly counterintuitive::
	depends on BAR || !BAR

This means that there is either a dependency on BAR that disallows
the combination of FOO=y with BAR=m, or BAR is completely disabled.
the combination of FOO=y with BAR=m, or BAR is completely disabled. The BAR
module must provide all the stubs for !BAR case.

For a more formalized approach if there are multiple drivers that have
the same dependency, a helper symbol can be used, like::

@@ -599,6 +591,21 @@ the same dependency, a helper symbol can be used, like::
  config BAR_OPTIONAL
	def_tristate BAR || !BAR

Much less favorable way to express optional dependency is IS_REACHABLE() within
the module code, useful for example when the module BAR does not provide
!BAR stubs::

	foo_init()
	{
		if (IS_REACHABLE(CONFIG_BAR))
			bar_register(&foo);
		...
	}

IS_REACHABLE() is generally discouraged, because the code will be silently
discarded, when CONFIG_BAR=m and this code is built-in. This is not what users
usually expect when enabling BAR as module.

Kconfig recursive dependency limitations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Loading