Subject: [bug#37868] [PATCH v4] system: Add kernel-module-packages to operating-system.

From: Danny Milosavljevic <[email-masked]>
Date: Tue, 25 Feb 2020 14:34:35 +0100

> I think that's because the Linux kernel linux-libre we build already has those
> files.  Those files in linux-libre are stale cache files when you have extra
> modules (because they don't list those extra modules).

It is.  Setting DEPMOD=true in the "install" phase of make-linux-libre* makes
almost all of those go away, except for the ones for "build" and "source".

The latter point to /tmp/guix-build*linux-libre*, so we could just remove those,
too.

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 78182555c1..d1be57fded 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -760,12 +760,14 @@ for ARCH and optionally VARIANT, or #f if there is no such configuration."
                ;; Install kernel modules
                (mkdir-p moddir)
                (invoke "make"
-                       (string-append "DEPMOD=" kmod "/bin/depmod")
+                       "DEPMOD=true"
                        (string-append "MODULE_DIR=" moddir)
                        (string-append "INSTALL_PATH=" out)
                        (string-append "INSTALL_MOD_PATH=" out)
                        "INSTALL_MOD_STRIP=1"
-                       "modules_install")))))
+                       "modules_install")
+               ;; TODO: delete-file moddir/*/build, moddir/*/source (they are symlinks to tmp files anyway)
+                       ))))
        #:tests? #f))
     (home-page "https://www.gnu.org/software/linux-libre/")
     (synopsis "100% free redistribution of a cleaned Linux kernel")