Skip to contentSkip to conversation

linux: do not run depmod during the installation

PATCH New unixmania at gmail.com 2 participants 2 messages Mar 21, 2020 – Mar 22, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux: do not run depmod during the installation

From: Carlos Santos <[email protected]>

The kernel "install" target runs depmod by means of a wrapper script (scripts/depmod.sh), so passing a dummy depmod (e.g. /dev/null) would cause warning messages like this:

    DEPMOD  5.4.27
    ./scripts/depmod.sh: 46: /dev/null: Permission denied
    make[2]: *** [Makefile:1326: _modinst_post] Error 126

We can avoid running the script by overriding the cmd_depmod variable, which contains the command line to run depmod.

As a safety measure, setting DEPMOD to /bin/false makes the installation fail if overriding cmd_depmod does not work in a future kernel version.

---
CC: Yann E. MORIN <[email protected]>

---
 linux/linux.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
linux/linux.mk +2 -1
index 2e3ea52053..383d1908d6 100644
@@ -134,7 +134,8 @@ LINUX_MAKE_FLAGS = \
 	ARCH=$(KERNEL_ARCH) \
 	INSTALL_MOD_PATH=$(TARGET_DIR) \
 	CROSS_COMPILE="$(TARGET_CROSS)" \
-	DEPMOD=$(HOST_DIR)/sbin/depmod
+	DEPMOD=/bin/false \
+	cmd_depmod=":"
 
 ifeq ($(BR2_REPRODUCIBLE),y)
 LINUX_MAKE_ENV += \
Signature · 1 line
2.18.2
#1 lore raw

PATCH 1/1 linux: do not run depmod during the installation

Carlos, All,

On 2020-03-21 20:57 -0300, unixmania at gmail.com spake thusly:

Quoted 10 lines

From: Carlos Santos <[email protected]>

The kernel "install" target runs depmod by means of a wrapper script (scripts/depmod.sh), so passing a dummy depmod (e.g. /dev/null) would cause warning messages like this:

    DEPMOD  5.4.27
    ./scripts/depmod.sh: 46: /dev/null: Permission denied
    make[2]: *** [Makefile:1326: _modinst_post] Error 126
Quoted 5 lines

We can avoid running the script by overriding the cmd_depmod variable, which contains the command line to run depmod.

As a safety measure, setting DEPMOD to /bin/false makes the installation fail if overriding cmd_depmod does not work in a future kernel version.

Really, what's the problem with running this demod here?

The default AArch64 kernel defconfig takes almost 12 minutes to build on my machine, and the install, including running depmod, takes just under 14 seconds (including parsing all Buildroot Makefiles!).

So running depmod is hardly a time hog...

Quoted 13 lines

---
CC: Yann E. MORIN <[email protected]>

---
 linux/linux.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
linux/linux.mk +0 -0
index 2e3ea52053..383d1908d6 100644

linux/linux.mk LINUX_MAKE_FLAGS = \ · line 138

Quoted 6 lines
linux/linux.mk +2 -1
@@ -134,7 +134,8 @@ LINUX_MAKE_FLAGS = \
 	ARCH=$(KERNEL_ARCH) \
 	INSTALL_MOD_PATH=$(TARGET_DIR) \
 	CROSS_COMPILE="$(TARGET_CROSS)" \
-	DEPMOD=$(HOST_DIR)/sbin/depmod
+	DEPMOD=/bin/false \
+	cmd_depmod=":"

This is touching the internals of the kernel, so no.

Regards,
Yann E. MORIN.

Quoted 5 lines
linux/linux.mk +0 -0
 ifeq ($(BR2_REPRODUCIBLE),y)
 LINUX_MAKE_ENV += \
Signature · 1 line
2.18.2
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'