Skip to contentSkip to conversation

kbuild: do not run depmod for 'make modules_sign'

PATCH In review Masahiro Yamada 2 participants 20 messages Aug 23, 2023 – Aug 29, 2023 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/8 kbuild: do not run depmod for 'make modules_sign'

Commit 961ab4a3cd66 ("kbuild: merge scripts/Makefile.modsign to scripts/Makefile.modinst") started to run depmod at the end of 'make modules_sign'.

Move the depmod rule to scripts/Makefile.modinst and run it only when $(modules_sign_only) is empty.

Fixes 961ab4a3cd66 ("kbuild: merge scripts/Makefile.modsign to scripts/Makefile.modinst")

---

 Makefile | 2 ++
 1 file changed, 2 insertions(+)
Makefile +2 -0
index e0d52539a0f1..7d54a0700c6e 100644
@@ -1877,7 +1877,9 @@ quiet_cmd_depmod = DEPMOD  $(MODLIB)
 
 modules_install:
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
+ifndef modules_sign_only
 	$(call cmd,depmod)
+endif
 
 else # CONFIG_MODULES
 
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/8 kbuild: add modules_sign to no-{compiler,sync-config}-targets

Like modules_install, modules_sign should avoid the syncconfig.

---

 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index 7d54a0700c6e..e2dfa3b994f7 100644
@@ -280,8 +280,8 @@ no-dot-config-targets := $(clean-targets) \
 # Installation targets should not require compiler. Unfortunately, vdso_install
 # is an exception where build artifacts may be updated. This must be fixed.
 no-compiler-targets := $(no-dot-config-targets) install dtbs_install \
-			headers_install modules_install kernelrelease image_name
-no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease \
+			headers_install modules_install modules_sign kernelrelease image_name
+no-sync-config-targets := $(no-dot-config-targets) %install modules_sign kernelrelease \
 			  image_name
 single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.rsi %.s %.symtypes %/
 
Signature · 1 line
2.39.2
Reviewed-by on v1 2/8
#2 lore raw

Re: [PATCH 2/8] kbuild: add modules_sign to no-{compiler,sync-config}-targets

Quoted 25 lines · Masahiro Yamada

Like modules_install, modules_sign should avoid the syncconfig.

---

 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index 7d54a0700c6e..e2dfa3b994f7 100644
@@ -280,8 +280,8 @@ no-dot-config-targets := $(clean-targets) \
 # Installation targets should not require compiler. Unfortunately, vdso_install
 # is an exception where build artifacts may be updated. This must be fixed.
 no-compiler-targets := $(no-dot-config-targets) install dtbs_install \
-			headers_install modules_install kernelrelease image_name
-no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease \
+			headers_install modules_install modules_sign kernelrelease image_name
+no-sync-config-targets := $(no-dot-config-targets) %install modules_sign kernelrelease \
 			  image_name
 single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.rsi %.s %.symtypes %/
 
Signature · 1 line
2.39.2
#3 lore raw

PATCH 3/8 kbuild: move depmod rule to scripts/Makefile.modinst

In reply to Masahiro Yamada

depmod is a part of the module installation.

scripts/Makefile.modinst is a better place to run it.

---

 Makefile                 |  8 --------
 scripts/Makefile.modinst |  9 +++++++++
 scripts/depmod.sh        | 10 ++++++----
 3 files changed, 15 insertions(+), 12 deletions(-)
Makefile +0 -8
index e2dfa3b994f7..c9c8019e4720 100644
@@ -509,7 +509,6 @@ LEX		= flex
 YACC		= bison
 AWK		= awk
 INSTALLKERNEL  := installkernel
-DEPMOD		= depmod
 PERL		= perl
 PYTHON3		= python3
 CHECK		= sparse
@@ -1871,15 +1870,8 @@ PHONY += modules_check
 modules_check: $(MODORDER)
 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
 
-quiet_cmd_depmod = DEPMOD  $(MODLIB)
-      cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
-                   $(KERNELRELEASE)
-
 modules_install:
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
-ifndef modules_sign_only
-	$(call cmd,depmod)
-endif
 
 else # CONFIG_MODULES
 
scripts/Makefile.modinst +9 -0
index ab0c5bd1a60f..7a64ece9b826 100644
@@ -86,6 +86,15 @@ $(dst)/%.ko: $(extmod_prefix)%.ko FORCE
 	$(call cmd,strip)
 	$(call cmd,sign)
 
+__modinst: depmod
+
+PHONY += depmod
+depmod: $(modules)
+	$(call cmd,depmod)
+
+quiet_cmd_depmod = DEPMOD  $(MODLIB)
+      cmd_depmod = $(srctree)/scripts/depmod.sh $(KERNELRELEASE)
+
 else
 
 $(dst)/%.ko: FORCE
scripts/depmod.sh +6 -4
index fca689ba4f21..ee771ccb1f9c 100755
@@ -3,12 +3,14 @@
 #
 # A depmod wrapper used by the toplevel Makefile
 
-if test $# -ne 2; then
-	echo "Usage: $0 /sbin/depmod <kernelrelease>" >&2
+if test $# -ne 1; then
+	echo "Usage: $0 <kernelrelease>" >&2
 	exit 1
 fi
-DEPMOD=$1
-KERNELRELEASE=$2
+
+KERNELRELEASE=$1
+
+: ${DEPMOD:=depmod}
 
 if ! test -r System.map ; then
 	echo "Warning: modules_install: missing 'System.map' file. Skipping depmod." >&2
Signature · 1 line
2.39.2
Reviewed-by on v1 3/8
#4 lore raw

Re: [PATCH 3/8] kbuild: move depmod rule to scripts/Makefile.modinst

Quoted 46 lines · Masahiro Yamada

depmod is a part of the module installation.

scripts/Makefile.modinst is a better place to run it.

---

 Makefile                 |  8 --------
 scripts/Makefile.modinst |  9 +++++++++
 scripts/depmod.sh        | 10 ++++++----
 3 files changed, 15 insertions(+), 12 deletions(-)
Makefile +0 -8
index e2dfa3b994f7..c9c8019e4720 100644
@@ -509,7 +509,6 @@ LEX		= flex
 YACC		= bison
 AWK		= awk
 INSTALLKERNEL  := installkernel
-DEPMOD		= depmod
 PERL		= perl
 PYTHON3		= python3
 CHECK		= sparse
@@ -1871,15 +1870,8 @@ PHONY += modules_check
 modules_check: $(MODORDER)
 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
 
-quiet_cmd_depmod = DEPMOD  $(MODLIB)
-      cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
-                   $(KERNELRELEASE)
-
 modules_install:
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
-ifndef modules_sign_only
-	$(call cmd,depmod)
-endif
 
 else # CONFIG_MODULES
 
scripts/Makefile.modinst +0 -0
index ab0c5bd1a60f..7a64ece9b826 100644
@@ -86,6 +86,15 @@ $(dst)/%.ko: $(extmod_prefix)%.ko FORCE
 	$(call cmd,strip)

scripts/Makefile.modinst $(dst)/%.ko: $(extmod_prefix)%.ko FORCE · line 96

Quoted 10 lines
scripts/Makefile.modinst +8 -0
 	$(call cmd,sign)
 
+__modinst: depmod
+
+PHONY += depmod
+depmod: $(modules)
+	$(call cmd,depmod)
+
+quiet_cmd_depmod = DEPMOD  $(MODLIB)
+      cmd_depmod = $(srctree)/scripts/depmod.sh $(KERNELRELEASE)

Did you remove the $(CONFIG_SHELL) by intention?

scripts/depmod.sh line 4

Quoted 11 lines
scripts/Makefile.modinst +1 -0
+
 else
 
 $(dst)/%.ko: FORCE
scripts/depmod.sh +0 -0
index fca689ba4f21..ee771ccb1f9c 100755
@@ -3,12 +3,14 @@
 #
 # A depmod wrapper used by the toplevel Makefile

toplevel Makefile -> scripts/Makefile.modinst

Quoted 18 lines
scripts/depmod.sh +6 -4
-if test $# -ne 2; then
-	echo "Usage: $0 /sbin/depmod <kernelrelease>" >&2
+if test $# -ne 1; then
+	echo "Usage: $0 <kernelrelease>" >&2
 	exit 1
 fi
-DEPMOD=$1
-KERNELRELEASE=$2
+
+KERNELRELEASE=$1
+
+: ${DEPMOD:=depmod}
 
 if ! test -r System.map ; then
 	echo "Warning: modules_install: missing 'System.map' file. Skipping depmod." >&2
Signature · 1 line
2.39.2

A minor observation: with this patch, the "quiet_cmd_*" examples in Makefile and in Documentation/kbuild/makefiles.rst become out-dated.

But technically, it looks good to me, thus:

#5 lore raw

Re: [PATCH 3/8] kbuild: move depmod rule to scripts/Makefile.modinst

Quoted 50 lines · Nicolas Schier
Quoted 48 lines · Masahiro Yamada

depmod is a part of the module installation.

scripts/Makefile.modinst is a better place to run it.

---

 Makefile                 |  8 --------
 scripts/Makefile.modinst |  9 +++++++++
 scripts/depmod.sh        | 10 ++++++----
 3 files changed, 15 insertions(+), 12 deletions(-)
Makefile +0 -8
index e2dfa3b994f7..c9c8019e4720 100644
@@ -509,7 +509,6 @@ LEX               = flex
 YACC         = bison
 AWK          = awk
 INSTALLKERNEL  := installkernel
-DEPMOD               = depmod
 PERL         = perl
 PYTHON3              = python3
 CHECK                = sparse
@@ -1871,15 +1870,8 @@ PHONY += modules_check
 modules_check: $(MODORDER)
      $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
 
-quiet_cmd_depmod = DEPMOD  $(MODLIB)
-      cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
-                   $(KERNELRELEASE)
-
 modules_install:
      $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
-ifndef modules_sign_only
-     $(call cmd,depmod)
-endif
 
 else # CONFIG_MODULES
 
scripts/Makefile.modinst +0 -0
index ab0c5bd1a60f..7a64ece9b826 100644
@@ -86,6 +86,15 @@ $(dst)/%.ko: $(extmod_prefix)%.ko FORCE
      $(call cmd,strip)
      $(call cmd,sign)
 
Quoted 10 lines

scripts/Makefile.modinst $(dst)/%.ko: $(extmod_prefix)%.ko FORCE · line 96

Quoted 8 lines
scripts/Makefile.modinst +8 -0
+__modinst: depmod
+
+PHONY += depmod
+depmod: $(modules)
+     $(call cmd,depmod)
+
+quiet_cmd_depmod = DEPMOD  $(MODLIB)
+      cmd_depmod = $(srctree)/scripts/depmod.sh $(KERNELRELEASE)

Did you remove the $(CONFIG_SHELL) by intention?

Yes.
I do not know why $(CONFIG_SHELL) is needed.

I remove $(CONFIG_SHELL) when I have a chance to touch the line.

Quoted 13 lines

scripts/depmod.sh line 4

Quoted 11 lines
scripts/Makefile.modinst +1 -0
+
 else
 
 $(dst)/%.ko: FORCE
scripts/depmod.sh +0 -0
index fca689ba4f21..ee771ccb1f9c 100755
@@ -3,12 +3,14 @@
 #
 # A depmod wrapper used by the toplevel Makefile

toplevel Makefile -> scripts/Makefile.modinst

Good catch.
I will fix it.

Quoted 14 lines
Quoted 14 lines
scripts/depmod.sh +6 -4
-if test $# -ne 2; then
-     echo "Usage: $0 /sbin/depmod <kernelrelease>" >&2
+if test $# -ne 1; then
+     echo "Usage: $0 <kernelrelease>" >&2
      exit 1
 fi
-DEPMOD=$1
-KERNELRELEASE=$2
+
+KERNELRELEASE=$1
+
+: ${DEPMOD:=depmod}
 
Quoted 7 lines
Quoted 4 lines
scripts/depmod.sh +0 -1
 if ! test -r System.map ; then
      echo "Warning: modules_install: missing 'System.map' file. Skipping depmod." >&2
--

2.39.2

A minor observation: with this patch, the "quiet_cmd_*" examples in Makefile and in Documentation/kbuild/makefiles.rst become out-dated.

I was opposed to eb38f37c3cee08a0197bdc7bbb9b4e02e40e2300

The section "Script invocation" is not what I ack'ed.

That is what Kees Cook and Andrew Morton did.

Quoted 3 lines

But technically, it looks good to me, thus:

--
Best Regards
Masahiro Yamada

#6 lore raw

PATCH 4/8 kbuild: remove $(MODLIB)/source symlink

In reply to Masahiro Yamada

This reverts the old commit "kbuild: Introduce source symlink in /lib/modules/.../". [1]

The current Kbuild does not require $(MODLIB)/source. If the kernel was built in a separate output directory, $(MODLIB)/build/Makefile wraps the Makefile in the source tree. It is enough for building external modules.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/history/history.git/commit/?id=e09e58867154b8aae0a3ac26a9b1c05962f5a355

---

 Makefile | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
Makefile +2 -6
index c9c8019e4720..7d9cab3d2186 100644
@@ -1486,14 +1486,10 @@ modules_install: $(modinst_pre)
 PHONY += __modinst_pre
 __modinst_pre:
 	@rm -rf $(MODLIB)/kernel
-	@rm -f $(MODLIB)/source
+	@rm -f $(MODLIB)/build
 	@mkdir -p $(MODLIB)
 ifdef CONFIG_MODULES
-	@ln -s $(abspath $(srctree)) $(MODLIB)/source
-	@if [ ! $(objtree) -ef  $(MODLIB)/build ]; then \
-		rm -f $(MODLIB)/build ; \
-		ln -s $(CURDIR) $(MODLIB)/build ; \
-	fi
+	@ln -s $(CURDIR) $(MODLIB)/build
 	@sed 's:^\(.*\)\.o$$:kernel/\1.ko:' modules.order > $(MODLIB)/modules.order
 endif
 	@cp -f modules.builtin $(MODLIB)/
Signature · 1 line
2.39.2
Reviewed-by on v1 4/8
#7 lore raw

Re: [PATCH 4/8] kbuild: remove $(MODLIB)/source symlink

Quoted 39 lines · On Wed, Aug 23, 2023 at 08:50:44PM +0900 Masahiro Yamada wrote:

This reverts the old commit "kbuild: Introduce source symlink in /lib/modules/.../". [1]

The current Kbuild does not require $(MODLIB)/source. If the kernel was built in a separate output directory, $(MODLIB)/build/Makefile wraps the Makefile in the source tree. It is enough for building external modules.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/history/history.git/commit/?id=e09e58867154b8aae0a3ac26a9b1c05962f5a355

---

 Makefile | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
Makefile +2 -6
index c9c8019e4720..7d9cab3d2186 100644
@@ -1486,14 +1486,10 @@ modules_install: $(modinst_pre)
 PHONY += __modinst_pre
 __modinst_pre:
 	@rm -rf $(MODLIB)/kernel
-	@rm -f $(MODLIB)/source
+	@rm -f $(MODLIB)/build
 	@mkdir -p $(MODLIB)
 ifdef CONFIG_MODULES
-	@ln -s $(abspath $(srctree)) $(MODLIB)/source
-	@if [ ! $(objtree) -ef  $(MODLIB)/build ]; then \
-		rm -f $(MODLIB)/build ; \
-		ln -s $(CURDIR) $(MODLIB)/build ; \
-	fi
+	@ln -s $(CURDIR) $(MODLIB)/build
 	@sed 's:^\(.*\)\.o$$:kernel/\1.ko:' modules.order > $(MODLIB)/modules.order
 endif
 	@cp -f modules.builtin $(MODLIB)/
Signature · 1 line
2.39.2
#8 lore raw

PATCH 5/8 kbuild: reduce the number of mkdir calls during modules_install

In reply to Masahiro Yamada

Calling 'mkdir' for every module results in redundant syscalls.

Use $(sort ...) to drop the duplicated directories.

---

 scripts/Makefile.modinst | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
scripts/Makefile.modinst +11 -1
index 7a64ece9b826..5d687a453d90 100644
@@ -9,6 +9,13 @@ __modinst:
 include include/config/auto.conf
 include $(srctree)/scripts/Kbuild.include
 
+install-y :=
+
+PHONY += prepare
+
+prepare:
+	$(Q)mkdir -p $(sort $(dir $(install-y)))
+
 modules := $(call read-file, $(MODORDER))
 
 ifeq ($(KBUILD_EXTMOD),)
@@ -27,6 +34,7 @@ suffix-$(CONFIG_MODULE_COMPRESS_XZ)	:= .xz
 suffix-$(CONFIG_MODULE_COMPRESS_ZSTD)	:= .zst
 
 modules := $(patsubst $(extmod_prefix)%.o, $(dst)/%.ko$(suffix-y), $(modules))
+install-y += $(modules)
 
 __modinst: $(modules)
 	@:
@@ -35,7 +43,7 @@ __modinst: $(modules)
 # Installation
 #
 quiet_cmd_install = INSTALL $@
-      cmd_install = mkdir -p $(dir $@); cp $< $@
+      cmd_install = cp $< $@
 
 # Strip
 #
@@ -95,6 +103,8 @@ depmod: $(modules)
 quiet_cmd_depmod = DEPMOD  $(MODLIB)
       cmd_depmod = $(srctree)/scripts/depmod.sh $(KERNELRELEASE)
 
+$(install-y): prepare
+
 else
 
 $(dst)/%.ko: FORCE
Signature · 1 line
2.39.2
Reviewed-by on v1 5/8
#9 lore raw

Re: [PATCH 5/8] kbuild: reduce the number of mkdir calls during modules_install

Quoted 56 lines · On Wed, Aug 23, 2023 at 08:50:45PM +0900 Masahiro Yamada wrote:

Calling 'mkdir' for every module results in redundant syscalls.

Use $(sort ...) to drop the duplicated directories.

---

 scripts/Makefile.modinst | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
scripts/Makefile.modinst +11 -1
index 7a64ece9b826..5d687a453d90 100644
@@ -9,6 +9,13 @@ __modinst:
 include include/config/auto.conf
 include $(srctree)/scripts/Kbuild.include
 
+install-y :=
+
+PHONY += prepare
+
+prepare:
+	$(Q)mkdir -p $(sort $(dir $(install-y)))
+
 modules := $(call read-file, $(MODORDER))
 
 ifeq ($(KBUILD_EXTMOD),)
@@ -27,6 +34,7 @@ suffix-$(CONFIG_MODULE_COMPRESS_XZ)	:= .xz
 suffix-$(CONFIG_MODULE_COMPRESS_ZSTD)	:= .zst
 
 modules := $(patsubst $(extmod_prefix)%.o, $(dst)/%.ko$(suffix-y), $(modules))
+install-y += $(modules)
 
 __modinst: $(modules)
 	@:
@@ -35,7 +43,7 @@ __modinst: $(modules)
 # Installation
 #
 quiet_cmd_install = INSTALL $@
-      cmd_install = mkdir -p $(dir $@); cp $< $@
+      cmd_install = cp $< $@
 
 # Strip
 #
@@ -95,6 +103,8 @@ depmod: $(modules)
 quiet_cmd_depmod = DEPMOD  $(MODLIB)
       cmd_depmod = $(srctree)/scripts/depmod.sh $(KERNELRELEASE)
 
+$(install-y): prepare
+
 else
 
 $(dst)/%.ko: FORCE
Signature · 1 line
2.39.2
#10 lore raw

PATCH 6/8 kbuild: move more module installation code to scripts/Makefile.modinst

In reply to Masahiro Yamada

Move more relevant code to scripts/Makefile.modinst.

---

 Makefile                 | 34 +++++++--------------------------
 scripts/Makefile.modinst | 41 +++++++++++++++++++++++++++++++++++++---
 2 files changed, 45 insertions(+), 30 deletions(-)
Makefile +7 -27
index 7d9cab3d2186..82d22debf6c9 100644
@@ -1477,24 +1477,6 @@ endif
 
 endif # CONFIG_MODULES
 
-modinst_pre :=
-ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
-modinst_pre := __modinst_pre
-endif
-
-modules_install: $(modinst_pre)
-PHONY += __modinst_pre
-__modinst_pre:
-	@rm -rf $(MODLIB)/kernel
-	@rm -f $(MODLIB)/build
-	@mkdir -p $(MODLIB)
-ifdef CONFIG_MODULES
-	@ln -s $(CURDIR) $(MODLIB)/build
-	@sed 's:^\(.*\)\.o$$:kernel/\1.ko:' modules.order > $(MODLIB)/modules.order
-endif
-	@cp -f modules.builtin $(MODLIB)/
-	@cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
-
 ###
 # Cleaning is done on three levels.
 # make clean     Delete most generated files
@@ -1836,12 +1818,15 @@ help:
 	@echo  '  clean           - remove generated files in module directory only'
 	@echo  ''
 
+ifndef CONFIG_MODULES
+modules modules_install: __external_modules_error
 __external_modules_error:
 	@echo >&2 '***'
 	@echo >&2 '*** The present kernel disabled CONFIG_MODULES.'
 	@echo >&2 '*** You cannot build or install external modules.'
 	@echo >&2 '***'
 	@false
+endif
 
 endif # KBUILD_EXTMOD
 
@@ -1850,6 +1835,9 @@ endif # KBUILD_EXTMOD
 
 PHONY += modules modules_install modules_prepare
 
+modules_install:
+	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
+
 ifdef CONFIG_MODULES
 
 $(MODORDER): $(build-dir)
@@ -1866,17 +1854,9 @@ PHONY += modules_check
 modules_check: $(MODORDER)
 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
 
-modules_install:
-	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
-
 else # CONFIG_MODULES
 
-# Modules not configured
-# ---------------------------------------------------------------------------
-
-PHONY += __external_modules_error
-
-modules modules_install: __external_modules_error
+modules:
 	@:
 
 KBUILD_MODULES :=
scripts/Makefile.modinst +38 -3

70 lines not on this page · raw message

Signature · 1 line
2.39.2
Reviewed-by on v1 6/8
#11 lore raw

Re: [PATCH 6/8] kbuild: move more module installation code to scripts/Makefile.modinst

Quoted 55 lines · Masahiro Yamada

Move more relevant code to scripts/Makefile.modinst.

---

 Makefile                 | 34 +++++++--------------------------
 scripts/Makefile.modinst | 41 +++++++++++++++++++++++++++++++++++++---
 2 files changed, 45 insertions(+), 30 deletions(-)
Makefile +3 -18
index 7d9cab3d2186..82d22debf6c9 100644
@@ -1477,24 +1477,6 @@ endif
 
 endif # CONFIG_MODULES
 
-modinst_pre :=
-ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
-modinst_pre := __modinst_pre
-endif
-
-modules_install: $(modinst_pre)
-PHONY += __modinst_pre
-__modinst_pre:
-	@rm -rf $(MODLIB)/kernel
-	@rm -f $(MODLIB)/build
-	@mkdir -p $(MODLIB)
-ifdef CONFIG_MODULES
-	@ln -s $(CURDIR) $(MODLIB)/build
-	@sed 's:^\(.*\)\.o$$:kernel/\1.ko:' modules.order > $(MODLIB)/modules.order
-endif
-	@cp -f modules.builtin $(MODLIB)/
-	@cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
-
 ###
 # Cleaning is done on three levels.
 # make clean     Delete most generated files
@@ -1836,12 +1818,15 @@ help:
 	@echo  '  clean           - remove generated files in module directory only'
 	@echo  ''
 
+ifndef CONFIG_MODULES
+modules modules_install: __external_modules_error
 __external_modules_error:
 	@echo >&2 '***'
 	@echo >&2 '*** The present kernel disabled CONFIG_MODULES.'
 	@echo >&2 '*** You cannot build or install external modules.'
 	@echo >&2 '***'
 	@false
+endif
 
 endif # KBUILD_EXTMOD
 

Makefile endif # KBUILD_EXTMOD · line 1839

Quoted 5 lines
Makefile +2 -0
@@ -1850,6 +1835,9 @@ endif # KBUILD_EXTMOD
 
 PHONY += modules modules_install modules_prepare
 
+modules_install:
+	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst

I was a bit surprised to see 'modules_install' being allowed unconditionally for in-tree usage (thus, even if CONFIG_MODULES=n), but then realised that this is the same behaviour as we had before. Out of
curiosity: _why_ do we need to install $(MODLIB)/modules.builtin{,.modinfo} also for configs w/ CONFIG_MODULES=n?

Quoted 102 lines
Makefile +2 -9
+
 ifdef CONFIG_MODULES
 
 $(MODORDER): $(build-dir)
@@ -1866,17 +1854,9 @@ PHONY += modules_check
 modules_check: $(MODORDER)
 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
 
-modules_install:
-	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
-
 else # CONFIG_MODULES
 
-# Modules not configured
-# ---------------------------------------------------------------------------
-
-PHONY += __external_modules_error
-
-modules modules_install: __external_modules_error
+modules:
 	@:
 
 KBUILD_MODULES :=
scripts/Makefile.modinst +38 -3
index 5d687a453d90..dc7c54669082 100644
@@ -13,9 +13,41 @@ install-y :=
 
 PHONY += prepare
 
+ifeq ($(KBUILD_EXTMOD)$(modules_sign_only),)
+
+# Install more files for in-tree modules_install
+
+prepare:
+	$(Q)rm -fr $(MODLIB)/kernel $(MODLIB)/build
+	$(Q)mkdir -p $(sort $(dir $(install-y)))
+
+install-$(CONFIG_MODULES) += $(addprefix $(MODLIB)/, build modules.order)
+
+$(MODLIB)/build: FORCE
+	$(call cmd,symlink)
+
+quiet_cmd_symlink = SYMLINK $@
+      cmd_symlink = ln -s $(CURDIR) $@
+
+$(MODLIB)/modules.order: modules.order FORCE
+	$(call cmd,install_modorder)
+
+quiet_cmd_install_modorder = INSTALL $@
+      cmd_install_modorder = sed 's:^\(.*\)\.o$$:kernel/\1.ko:' $< > $@
+
+# Install modules.builtin(.modinfo) even when CONFIG_MODULES is disabled.
+install-y += $(addprefix $(MODLIB)/, modules.builtin modules.builtin.modinfo)
+
+$(addprefix $(MODLIB)/, modules.builtin modules.builtin.modinfo): $(MODLIB)/%: % FORCE
+	$(call cmd,install)
+
+else
+
 prepare:
 	$(Q)mkdir -p $(sort $(dir $(install-y)))
 
+endif
+
 modules := $(call read-file, $(MODORDER))
 
 ifeq ($(KBUILD_EXTMOD),)
@@ -34,9 +66,10 @@ suffix-$(CONFIG_MODULE_COMPRESS_XZ)	:= .xz
 suffix-$(CONFIG_MODULE_COMPRESS_ZSTD)	:= .zst
 
 modules := $(patsubst $(extmod_prefix)%.o, $(dst)/%.ko$(suffix-y), $(modules))
-install-y += $(modules)
 
-__modinst: $(modules)
+install-$(CONFIG_MODULES) += $(modules)
+
+__modinst: $(install-y)
 	@:
 
 #
@@ -94,14 +127,16 @@ $(dst)/%.ko: $(extmod_prefix)%.ko FORCE
 	$(call cmd,strip)
 	$(call cmd,sign)
 
+ifdef CONFIG_MODULES
 __modinst: depmod
 
 PHONY += depmod
-depmod: $(modules)
+depmod: $(install-y)
 	$(call cmd,depmod)
 
 quiet_cmd_depmod = DEPMOD  $(MODLIB)
       cmd_depmod = $(srctree)/scripts/depmod.sh $(KERNELRELEASE)
+endif
 
 $(install-y): prepare
 
Signature · 1 line
2.39.2

Thanks for cleaning up. For me, the new rules look better than the original ones.

#12 lore raw

Re: [PATCH 6/8] kbuild: move more module installation code to scripts/Makefile.modinst

Quoted 60 lines · Nicolas Schier
Quoted 58 lines · Masahiro Yamada

Move more relevant code to scripts/Makefile.modinst.

---

 Makefile                 | 34 +++++++--------------------------
 scripts/Makefile.modinst | 41 +++++++++++++++++++++++++++++++++++++---
 2 files changed, 45 insertions(+), 30 deletions(-)
Makefile +3 -18
index 7d9cab3d2186..82d22debf6c9 100644
@@ -1477,24 +1477,6 @@ endif
 
 endif # CONFIG_MODULES
 
-modinst_pre :=
-ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
-modinst_pre := __modinst_pre
-endif
-
-modules_install: $(modinst_pre)
-PHONY += __modinst_pre
-__modinst_pre:
-     @rm -rf $(MODLIB)/kernel
-     @rm -f $(MODLIB)/build
-     @mkdir -p $(MODLIB)
-ifdef CONFIG_MODULES
-     @ln -s $(CURDIR) $(MODLIB)/build
-     @sed 's:^\(.*\)\.o$$:kernel/\1.ko:' modules.order > $(MODLIB)/modules.order
-endif
-     @cp -f modules.builtin $(MODLIB)/
-     @cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
-
 ###
 # Cleaning is done on three levels.
 # make clean     Delete most generated files
@@ -1836,12 +1818,15 @@ help:
      @echo  '  clean           - remove generated files in module directory only'
      @echo  ''
 
+ifndef CONFIG_MODULES
+modules modules_install: __external_modules_error
 __external_modules_error:
      @echo >&2 '***'
      @echo >&2 '*** The present kernel disabled CONFIG_MODULES.'
      @echo >&2 '*** You cannot build or install external modules.'
      @echo >&2 '***'
      @false
+endif
 
 endif # KBUILD_EXTMOD
 
@@ -1850,6 +1835,9 @@ endif # KBUILD_EXTMOD
 
 PHONY += modules modules_install modules_prepare
 
Quoted 9 lines

Makefile endif # KBUILD_EXTMOD · line 1839

Quoted 2 lines
Makefile +2 -0
+modules_install:
+     $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst

I was a bit surprised to see 'modules_install' being allowed unconditionally for in-tree usage (thus, even if CONFIG_MODULES=n), but then realised that this is the same behaviour as we had before. Out of
curiosity: _why_ do we need to install $(MODLIB)/modules.builtin{,.modinfo} also for configs w/ CONFIG_MODULES=n?

I see your tags in commit
8ae071fc216a25f4f797f33c56857f4dd6b4408e :)

Some drivers need to load firmware.

To make such drivers working in initrd, mkinitramfs needs to copy necessary firmware files into the initrd.
So, the tool needs to know which drivers are enabled.

That is my understanding why modules.builtin(.modinfo) is needed even with CONFIG_MODULES=n.

Signature · 2 lines
Best Regards
Masahiro Yamada
#13 lore raw

Re: [PATCH 6/8] kbuild: move more module installation code to scripts/Makefile.modinst

Quoted 78 lines · Masahiro Yamada
Quoted 60 lines · Nicolas Schier
Quoted 58 lines · Masahiro Yamada

Move more relevant code to scripts/Makefile.modinst.

---

 Makefile                 | 34 +++++++--------------------------
 scripts/Makefile.modinst | 41 +++++++++++++++++++++++++++++++++++++---
 2 files changed, 45 insertions(+), 30 deletions(-)
Makefile +3 -18
index 7d9cab3d2186..82d22debf6c9 100644
@@ -1477,24 +1477,6 @@ endif
 
 endif # CONFIG_MODULES
 
-modinst_pre :=
-ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
-modinst_pre := __modinst_pre
-endif
-
-modules_install: $(modinst_pre)
-PHONY += __modinst_pre
-__modinst_pre:
-     @rm -rf $(MODLIB)/kernel
-     @rm -f $(MODLIB)/build
-     @mkdir -p $(MODLIB)
-ifdef CONFIG_MODULES
-     @ln -s $(CURDIR) $(MODLIB)/build
-     @sed 's:^\(.*\)\.o$$:kernel/\1.ko:' modules.order > $(MODLIB)/modules.order
-endif
-     @cp -f modules.builtin $(MODLIB)/
-     @cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
-
 ###
 # Cleaning is done on three levels.
 # make clean     Delete most generated files
@@ -1836,12 +1818,15 @@ help:
      @echo  '  clean           - remove generated files in module directory only'
      @echo  ''
 
+ifndef CONFIG_MODULES
+modules modules_install: __external_modules_error
 __external_modules_error:
      @echo >&2 '***'
      @echo >&2 '*** The present kernel disabled CONFIG_MODULES.'
      @echo >&2 '*** You cannot build or install external modules.'
      @echo >&2 '***'
      @false
+endif
 
 endif # KBUILD_EXTMOD
 
@@ -1850,6 +1835,9 @@ endif # KBUILD_EXTMOD
 
 PHONY += modules modules_install modules_prepare
 
Quoted 9 lines

Makefile endif # KBUILD_EXTMOD · line 1839

Quoted 2 lines
Makefile +2 -0
+modules_install:
+     $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst

I was a bit surprised to see 'modules_install' being allowed unconditionally for in-tree usage (thus, even if CONFIG_MODULES=n), but then realised that this is the same behaviour as we had before. Out of
curiosity: _why_ do we need to install $(MODLIB)/modules.builtin{,.modinfo} also for configs w/ CONFIG_MODULES=n?

I see your tags in commit
8ae071fc216a25f4f797f33c56857f4dd6b4408e :)

Some drivers need to load firmware.

Quoted 7 lines

To make such drivers working in initrd, mkinitramfs needs to copy necessary firmware files into the initrd.
So, the tool needs to know which drivers are enabled.

That is my understanding why modules.builtin(.modinfo) is needed even with CONFIG_MODULES=n.

Ups, yes. Thanks for the reminder!

Kind regards,
Nicolas

#14 lore raw

PATCH 7/8 kbuild: support 'make modules_sign' with CONFIG_MODULE_SIG_ALL=n

In reply to Masahiro Yamada

Commit d890f510c8e4 ("MODSIGN: Add modules_sign make target") introduced 'make modules_sign' to manually sign modules.

Some time later, commit d9d8d7ed498e ("MODSIGN: Add option to not sign modules during modules_install") introduced CONFIG_MODULE_SIG_ALL. If it was disabled, mod_sign_cmd was set to no-op ('true' command). It affected not only 'make modules_install' but also 'make modules_sign'. With CONFIG_MODULE_SIG_ALL=n, 'make modules_install' did not sign modules and 'make modules_sign' could not sign modules either.

Kbuild has kept that behavior, and nobody has complained about it, but I think it is weird.

CONFIG_MODULE_SIG_ALL=n should turn off signing only for modules_install. If users want to sign modules manually, they should be allowed to use 'make modules_sign'.

---

 scripts/Makefile.modinst | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
scripts/Makefile.modinst +5 -4
index dc7c54669082..33d424a3f265 100644
@@ -106,7 +106,6 @@ endif
 # Signing
 # Don't stop modules_install even if we can't sign external modules.
 #
-ifeq ($(CONFIG_MODULE_SIG_ALL),y)
 ifeq ($(filter pkcs11:%, $(CONFIG_MODULE_SIG_KEY)),)
 sig-key := $(if $(wildcard $(CONFIG_MODULE_SIG_KEY)),,$(srctree)/)$(CONFIG_MODULE_SIG_KEY)
 else
@@ -115,13 +114,15 @@ endif
 quiet_cmd_sign = SIGN    $@
       cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) "$(sig-key)" certs/signing_key.x509 $@ \
                  $(if $(KBUILD_EXTMOD),|| true)
-else
+
+ifeq ($(modules_sign_only),)
+
+# During modules_install, modules are signed only when CONFIG_MODULE_SIG_ALL=y.
+ifndef CONFIG_MODULE_SIG_ALL
 quiet_cmd_sign :=
       cmd_sign := :
 endif
 
-ifeq ($(modules_sign_only),)
-
 $(dst)/%.ko: $(extmod_prefix)%.ko FORCE
 	$(call cmd,install)
 	$(call cmd,strip)
Signature · 1 line
2.39.2
Reviewed-by on v1 7/8
#15 lore raw

Re: [PATCH 7/8] kbuild: support 'make modules_sign' with CONFIG_MODULE_SIG_ALL=n

Quoted 13 lines · Masahiro Yamada

Commit d890f510c8e4 ("MODSIGN: Add modules_sign make target") introduced 'make modules_sign' to manually sign modules.

Some time later, commit d9d8d7ed498e ("MODSIGN: Add option to not sign modules during modules_install") introduced CONFIG_MODULE_SIG_ALL. If it was disabled, mod_sign_cmd was set to no-op ('true' command). It affected not only 'make modules_install' but also 'make modules_sign'. With CONFIG_MODULE_SIG_ALL=n, 'make modules_install' did not sign modules and 'make modules_sign' could not sign modules either.

Kbuild has kept that behavior, and nobody has complained about it, but I think it is weird.

Quoted 6 lines

CONFIG_MODULE_SIG_ALL=n should turn off signing only for modules_install. If users want to sign modules manually, they should be allowed to use 'make modules_sign'.

---

Quoted 37 lines
 scripts/Makefile.modinst | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
scripts/Makefile.modinst +5 -4
index dc7c54669082..33d424a3f265 100644
@@ -106,7 +106,6 @@ endif
 # Signing
 # Don't stop modules_install even if we can't sign external modules.
 #
-ifeq ($(CONFIG_MODULE_SIG_ALL),y)
 ifeq ($(filter pkcs11:%, $(CONFIG_MODULE_SIG_KEY)),)
 sig-key := $(if $(wildcard $(CONFIG_MODULE_SIG_KEY)),,$(srctree)/)$(CONFIG_MODULE_SIG_KEY)
 else
@@ -115,13 +114,15 @@ endif
 quiet_cmd_sign = SIGN    $@
       cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) "$(sig-key)" certs/signing_key.x509 $@ \
                  $(if $(KBUILD_EXTMOD),|| true)
-else
+
+ifeq ($(modules_sign_only),)
+
+# During modules_install, modules are signed only when CONFIG_MODULE_SIG_ALL=y.
+ifndef CONFIG_MODULE_SIG_ALL
 quiet_cmd_sign :=
       cmd_sign := :
 endif
 
-ifeq ($(modules_sign_only),)
-
 $(dst)/%.ko: $(extmod_prefix)%.ko FORCE
 	$(call cmd,install)
 	$(call cmd,strip)
Signature · 1 line
2.39.2
Signature · 5 lines
Nicolas Schier
 
epost|xmpp: [email protected]          irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --
#16 lore raw

PATCH 8/8 kbuild: support modules_sign for external modules as well

In reply to Masahiro Yamada

The modules_sign target is currently only available for in-tree modules, but it actually works for external modules as well.

Move the modules_sign rule to the common part.

---

 Makefile                 | 32 ++++++++++++++++----------------
 scripts/Makefile.modinst |  4 ++--
 2 files changed, 18 insertions(+), 18 deletions(-)
Makefile +16 -16
index 82d22debf6c9..87a9eef3fb4b 100644
@@ -1461,20 +1461,6 @@ modules: modules_prepare
 modules_prepare: prepare
 	$(Q)$(MAKE) $(build)=scripts scripts/module.lds
 
-export modules_sign_only :=
-
-ifeq ($(CONFIG_MODULE_SIG),y)
-PHONY += modules_sign
-modules_sign: modules_install
-	@:
-
-# modules_sign is a subset of modules_install.
-# 'make modules_install modules_sign' is equivalent to 'make modules_install'.
-ifeq ($(filter modules_install,$(MAKECMDGOALS)),)
-modules_sign_only := y
-endif
-endif
-
 endif # CONFIG_MODULES
 
 ###
@@ -1833,10 +1819,24 @@ endif # KBUILD_EXTMOD
 # ---------------------------------------------------------------------------
 # Modules
 
-PHONY += modules modules_install modules_prepare
+PHONY += modules modules_install modules_sign modules_prepare
 
 modules_install:
-	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
+	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst \
+	sign-only=$(if $(filter modules_install,$(MAKECMDGOALS)),,y)
+
+ifeq ($(CONFIG_MODULE_SIG),y)
+# modules_sign is a subset of modules_install.
+# 'make modules_install modules_sign' is equivalent to 'make modules_install'.
+modules_sign: modules_install
+	@:
+else
+modules_sign:
+	@echo >&2 '***'
+	@echo >&2 '*** CONFIG_MODULE_SIG is disabled. You cannot sign modules.'
+	@echo >&2 '***'
+	@false
+endif
 
 ifdef CONFIG_MODULES
 
scripts/Makefile.modinst +2 -2
index 33d424a3f265..459cb1fed223 100644
@@ -13,7 +13,7 @@ install-y :=
 
 PHONY += prepare
 
-ifeq ($(KBUILD_EXTMOD)$(modules_sign_only),)
+ifeq ($(KBUILD_EXTMOD)$(sign-only),)
 
 # Install more files for in-tree modules_install
 
@@ -115,7 +115,7 @@ quiet_cmd_sign = SIGN    $@
       cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) "$(sig-key)" certs/signing_key.x509 $@ \
                  $(if $(KBUILD_EXTMOD),|| true)
 
-ifeq ($(modules_sign_only),)
+ifeq ($(sign-only),)
 
 # During modules_install, modules are signed only when CONFIG_MODULE_SIG_ALL=y.
 ifndef CONFIG_MODULE_SIG_ALL
Signature · 1 line
2.39.2
Reviewed-by on v1 8/8
#17 lore raw

Re: [PATCH 8/8] kbuild: support modules_sign for external modules as well

Quoted 7 lines · Masahiro Yamada

The modules_sign target is currently only available for in-tree modules, but it actually works for external modules as well.

Move the modules_sign rule to the common part.

---

Quoted 81 lines
 Makefile                 | 32 ++++++++++++++++----------------
 scripts/Makefile.modinst |  4 ++--
 2 files changed, 18 insertions(+), 18 deletions(-)
Makefile +16 -16
index 82d22debf6c9..87a9eef3fb4b 100644
@@ -1461,20 +1461,6 @@ modules: modules_prepare
 modules_prepare: prepare
 	$(Q)$(MAKE) $(build)=scripts scripts/module.lds
 
-export modules_sign_only :=
-
-ifeq ($(CONFIG_MODULE_SIG),y)
-PHONY += modules_sign
-modules_sign: modules_install
-	@:
-
-# modules_sign is a subset of modules_install.
-# 'make modules_install modules_sign' is equivalent to 'make modules_install'.
-ifeq ($(filter modules_install,$(MAKECMDGOALS)),)
-modules_sign_only := y
-endif
-endif
-
 endif # CONFIG_MODULES
 
 ###
@@ -1833,10 +1819,24 @@ endif # KBUILD_EXTMOD
 # ---------------------------------------------------------------------------
 # Modules
 
-PHONY += modules modules_install modules_prepare
+PHONY += modules modules_install modules_sign modules_prepare
 
 modules_install:
-	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
+	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst \
+	sign-only=$(if $(filter modules_install,$(MAKECMDGOALS)),,y)
+
+ifeq ($(CONFIG_MODULE_SIG),y)
+# modules_sign is a subset of modules_install.
+# 'make modules_install modules_sign' is equivalent to 'make modules_install'.
+modules_sign: modules_install
+	@:
+else
+modules_sign:
+	@echo >&2 '***'
+	@echo >&2 '*** CONFIG_MODULE_SIG is disabled. You cannot sign modules.'
+	@echo >&2 '***'
+	@false
+endif
 
 ifdef CONFIG_MODULES
 
scripts/Makefile.modinst +2 -2
index 33d424a3f265..459cb1fed223 100644
@@ -13,7 +13,7 @@ install-y :=
 
 PHONY += prepare
 
-ifeq ($(KBUILD_EXTMOD)$(modules_sign_only),)
+ifeq ($(KBUILD_EXTMOD)$(sign-only),)
 
 # Install more files for in-tree modules_install
 
@@ -115,7 +115,7 @@ quiet_cmd_sign = SIGN    $@
       cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) "$(sig-key)" certs/signing_key.x509 $@ \
                  $(if $(KBUILD_EXTMOD),|| true)
 
-ifeq ($(modules_sign_only),)
+ifeq ($(sign-only),)
 
 # During modules_install, modules are signed only when CONFIG_MODULE_SIG_ALL=y.
 ifndef CONFIG_MODULE_SIG_ALL
Signature · 1 line
2.39.2
Signature · 5 lines
Nicolas Schier
 
epost|xmpp: [email protected]          irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --
Reviewed-by on v1 1/8
#18 lore raw
In reply to Masahiro Yamada
Quoted 6 lines · Masahiro Yamada

Commit 961ab4a3cd66 ("kbuild: merge scripts/Makefile.modsign to scripts/Makefile.modinst") started to run depmod at the end of 'make modules_sign'.

Move the depmod rule to scripts/Makefile.modinst and run it only when $(modules_sign_only) is empty.

Moving the depmod rule is in patch 3/8, first half of the sentence seems to be left over?

Quoted 24 lines
Fixes 961ab4a3cd66 ("kbuild: merge scripts/Makefile.modsign to scripts/Makefile.modinst")

---

 Makefile | 2 ++
 1 file changed, 2 insertions(+)
Makefile +2 -0
index e0d52539a0f1..7d54a0700c6e 100644
@@ -1877,7 +1877,9 @@ quiet_cmd_depmod = DEPMOD  $(MODLIB)
 
 modules_install:
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
+ifndef modules_sign_only
 	$(call cmd,depmod)
+endif
 
 else # CONFIG_MODULES
 
Signature · 1 line
2.39.2
#19 lore raw
Quoted 11 lines · Nicolas Schier
Quoted 6 lines · Masahiro Yamada

Commit 961ab4a3cd66 ("kbuild: merge scripts/Makefile.modsign to scripts/Makefile.modinst") started to run depmod at the end of 'make modules_sign'.

Move the depmod rule to scripts/Makefile.modinst and run it only when $(modules_sign_only) is empty.

Moving the depmod rule is in patch 3/8, first half of the sentence seems to be left over?

Theoretically, 1/8 and 3/8 can be squashed together, but 3/8 is too big to be back-ported.

1/8 was split out for easy back-porting.

Quoted 26 lines
Quoted 24 lines
Fixes 961ab4a3cd66 ("kbuild: merge scripts/Makefile.modsign to scripts/Makefile.modinst")

---

 Makefile | 2 ++
 1 file changed, 2 insertions(+)
Makefile +2 -1
index e0d52539a0f1..7d54a0700c6e 100644
@@ -1877,7 +1877,9 @@ quiet_cmd_depmod = DEPMOD  $(MODLIB)
 
 modules_install:
      $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
+ifndef modules_sign_only
      $(call cmd,depmod)
+endif
 
 else # CONFIG_MODULES
 
--

2.39.2

Signature · 2 lines
Best Regards
Masahiro Yamada