path: root/Documentation/kbuild
diff options
authorLukas Bulwahn <>2020-10-13 16:48:05 -0700
committerLinus Torvalds <>2020-10-13 18:38:26 -0700
commiteb38f37c3cee08a0197bdc7bbb9b4e02e40e2300 (patch)
treeaaf7fb2de8e4d13483f8213306ae2b7d7da18538 /Documentation/kbuild
parent4d6fb34acb5d0bfc579ccd29df9cc6f653e51ab2 (diff)
kbuild: doc: describe proper script invocation
During an investigation to fix up the execute bits of scripts in the kernel repository, Andrew Morton and Kees Cook pointed out that the execute bit should not matter, and that build scripts cannot rely on that. Kees could not point to any documentation, though. Masahiro Yamada explained the convention of setting execute bits to make it easier for manual script invocation. Provide some basic documentation how the build shall invoke scripts, such that the execute bits do not matter, and acknowledge that execute bits are useful nonetheless. This serves as reference for further clean-up patches in the future. Suggested-by: Andrew Morton <> Suggested-by: Kees Cook <> Signed-off-by: Lukas Bulwahn <> Signed-off-by: Andrew Morton <> Cc: Masahiro Yamada <> Cc: Michal Marek <> Cc: Jonathan Corbet <> Cc: Ujjwal Kumar <> Cc: Lukas Bulwahn <> Link: Link: Link: Link: Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'Documentation/kbuild')
1 files changed, 20 insertions, 0 deletions
diff --git a/Documentation/kbuild/makefiles.rst b/Documentation/kbuild/makefiles.rst
index 58d513a0fa95..0d5dd5413af0 100644
--- a/Documentation/kbuild/makefiles.rst
+++ b/Documentation/kbuild/makefiles.rst
@@ -21,6 +21,7 @@ This document describes the Linux kernel Makefiles.
--- 3.10 Special Rules
--- 3.11 $(CC) support functions
--- 3.12 $(LD) support functions
+ --- 3.13 Script Invocation
=== 4 Host Program support
--- 4.1 Simple Host Program
@@ -605,6 +606,25 @@ more details, with real examples.
LDFLAGS_vmlinux += $(call ld-option, -X)
+3.13 Script invocation
+ Make rules may invoke scripts to build the kernel. The rules shall
+ always provide the appropriate interpreter to execute the script. They
+ shall not rely on the execute bits being set, and shall not invoke the
+ script directly. For the convenience of manual script invocation, such
+ as invoking ./scripts/, it is recommended to set execute
+ bits on the scripts nonetheless.
+ Kbuild provides variables $(CONFIG_SHELL), $(AWK), $(PERL),
+ $(PYTHON) and $(PYTHON3) to refer to interpreters for the respective
+ scripts.
+ Example::
+ #Makefile
+ cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/ $(DEPMOD) \
4 Host Program support