archive mirror
 help / color / mirror / Atom feed
From: Lukas Bulwahn <>
To: Andrew Morton <>,
	Kees Cook <>,
	Masahiro Yamada <>,
	Michal Marek <>,
Cc:, Jonathan Corbet <>,,
	Ujjwal Kumar <>,
Subject: [Linux-kernel-mentees] [PATCH] kbuild: doc: describe proper script invocation
Date: Thu,  1 Oct 2020 09:57:23 +0200	[thread overview]
Message-ID: <> (raw)

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 <>
RFC v1 -> RFC v2:
explain why execute bits are still convenient.

Kees, Andrew, please ack.

Masahiro-san, I have taken your feedback into account. 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 | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/Documentation/kbuild/makefiles.rst b/Documentation/kbuild/makefiles.rst
index 58d513a0fa95..bd3e1baf58be 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

Linux-kernel-mentees mailing list

             reply	other threads:[~2020-10-01  7:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01  7:57 Lukas Bulwahn [this message]
2020-10-13 14:31 ` [Linux-kernel-mentees] [PATCH] kbuild: doc: describe proper script invocation Masahiro Yamada
2020-10-13 18:02   ` Masahiro Yamada
2020-10-14  4:43     ` Lukas Bulwahn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).