Skip to contentSkip to conversation

kbuild: cancel sub_make_done for the install target to fix DKMS

PATCH In review Masahiro Yamada 2 participants 3 messages Jul 29, 2021 – Aug 1, 2021 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: cancel sub_make_done for the install target to fix DKMS

Since commit bcf637f54f6d ("kbuild: parse C= and M= before changing the working directory"), external modules invoked by DKMS fail to build because M= option is not parsed.

I wanted to add 'unset sub_make_done' in install.sh but similar scripts, arch/*/boot/install.sh, are duplicated, so I set sub_make_done empty in the top Makefile.

Fixes bcf637f54f6d ("kbuild: parse C= and M= before changing the working directory")

---

 Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)
Makefile +10 -0
index bb10a93edf5c..4193092f7c38 100644
@@ -1316,6 +1316,16 @@ PHONY += scripts_unifdef
 scripts_unifdef: scripts_basic
 	$(Q)$(MAKE) $(build)=scripts scripts/unifdef
 
+# ---------------------------------------------------------------------------
+# Install
+
+# Many distros have the custom install script, /sbin/kernelinstall.
+# If DKMS is installed, 'make install' will eventually recuses back
+# to the this Makefile to build and install external modules.
+# Cancel sub_make_done so that options such as M=, V=, etc. are parsed.
+
+install: sub_make_done=
+
 # ---------------------------------------------------------------------------
 # Tools
 
Signature · 1 line
2.27.0
#1 lore raw
Quoted 39 lines · Masahiro Yamada

Since commit bcf637f54f6d ("kbuild: parse C= and M= before changing the working directory"), external modules invoked by DKMS fail to build because M= option is not parsed.

I wanted to add 'unset sub_make_done' in install.sh but similar scripts, arch/*/boot/install.sh, are duplicated, so I set sub_make_done empty in the top Makefile.

Fixes bcf637f54f6d ("kbuild: parse C= and M= before changing the working directory")

---

 Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)
Makefile +10 -1
index bb10a93edf5c..4193092f7c38 100644
@@ -1316,6 +1316,16 @@ PHONY += scripts_unifdef
 scripts_unifdef: scripts_basic
        $(Q)$(MAKE) $(build)=scripts scripts/unifdef
 
+# ---------------------------------------------------------------------------
+# Install
+
+# Many distros have the custom install script, /sbin/kernelinstall.
+# If DKMS is installed, 'make install' will eventually recuses back
+# to the this Makefile to build and install external modules.
+# Cancel sub_make_done so that options such as M=, V=, etc. are parsed.
+
+install: sub_make_done=
+
 # ---------------------------------------------------------------------------
 # Tools
 
--
Quoted 2 lines

2.27.0

This patch tested successfully on my system on 5.14.0-rc3.

#2 lore raw
Quoted 27 lines · John S Gruber
Quoted 25 lines · Masahiro Yamada

Since commit bcf637f54f6d ("kbuild: parse C= and M= before changing the working directory"), external modules invoked by DKMS fail to build because M= option is not parsed.

I wanted to add 'unset sub_make_done' in install.sh but similar scripts, arch/*/boot/install.sh, are duplicated, so I set sub_make_done empty in the top Makefile.

Fixes bcf637f54f6d ("kbuild: parse C= and M= before changing the working directory")

---

 Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)
Makefile +0 -0
index bb10a93edf5c..4193092f7c38 100644
@@ -1316,6 +1316,16 @@ PHONY += scripts_unifdef
 scripts_unifdef: scripts_basic
        $(Q)$(MAKE) $(build)=scripts scripts/unifdef
 
Quoted 4 lines

Makefile PHONY += scripts_unifdef · line 1322

Quoted 4 lines
Makefile +4 -0
+# ---------------------------------------------------------------------------
+# Install
+
+# Many distros have the custom install script, /sbin/kernelinstall.

I fixed up /sbin/kernelinstall to /sbin/installkernel

Applied to linux-kbuild.

Quoted 14 lines
Quoted 10 lines
Makefile +6 -1
+# If DKMS is installed, 'make install' will eventually recuses back
+# to the this Makefile to build and install external modules.
+# Cancel sub_make_done so that options such as M=, V=, etc. are parsed.
+
+install: sub_make_done=
+
 # ---------------------------------------------------------------------------
 # Tools
 
--
Quoted 2 lines

2.27.0

This patch tested successfully on my system on 5.14.0-rc3.

Signature · 2 lines
Best Regards
Masahiro Yamada