archive mirror
 help / color / mirror / Atom feed
* [Linux-kernel-mentees] [PATCH RFC] kbuild: doc: describe proper script invocation
@ 2020-09-28  6:42 Lukas Bulwahn
  2020-09-28 11:28 ` Masahiro Yamada
  0 siblings, 1 reply; 2+ messages in thread
From: Lukas Bulwahn @ 2020-09-28  6:42 UTC (permalink / raw)
  To: Andrew Morton, Kees Cook, Masahiro Yamada, Michal Marek, linux-kbuild
  Cc: linux-doc, Jonathan Corbet, linux-kernel, Ujjwal Kumar,

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.

Provide some basic documentation how the build shall invoke scripts, such
that the execute bits do not matter.

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 <>
applies cleanly on next-20200925 and v5.9-rc7

Kees, Andrew, please ack.

Masahiro-san, please pick this small documentation update into your kbuild tree.

Ujjwal Kumar, a potential future mentee, will follow up with further fixes to
the build scripts.

 Documentation/kbuild/makefiles.rst | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/Documentation/kbuild/makefiles.rst b/Documentation/kbuild/makefiles.rst
index 58d513a0fa95..9d0d198adb7e 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,23 @@ 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.
+	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

Linux-kernel-mentees mailing list

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-28 11:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-28  6:42 [Linux-kernel-mentees] [PATCH RFC] kbuild: doc: describe proper script invocation Lukas Bulwahn
2020-09-28 11:28 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).