gnu: make-linux-libre*: Run install targets in parallel.

This reduces the total build time by about 20%.

* gnu/packages/linux.scm (make-linux-libre*) [phases] {install}: Ensure that
-jN is used for the install targets.  Also honor make flags.

Change-Id: Ib3f4fdcbdeab736315a91eafa8d6d1dff5b89884
This commit is contained in:
Maxim Cournoyer 2024-05-13 12:20:57 -04:00
parent e7afa035d4
commit c3566fccb6
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -1076,9 +1076,15 @@ ARCH and optionally VARIANT, or #f if there is no such configuration."
(close-port port)) (close-port port))
(invoke "make" "oldconfig")))) (invoke "make" "oldconfig"))))
(replace 'install (replace 'install
(lambda _ (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
(let ((moddir (string-append #$output "/lib/modules")) (let ((moddir (string-append #$output "/lib/modules"))
(dtbdir (string-append #$output "/lib/dtbs"))) (dtbdir (string-append #$output "/lib/dtbs"))
(make-flags
(append make-flags
(list "-j"
(if parallel-build?
(number->string (parallel-job-count))
"1")))))
;; Install kernel image, kernel configuration and link map. ;; Install kernel image, kernel configuration and link map.
(for-each (lambda (file) (install-file file #$output)) (for-each (lambda (file) (install-file file #$output))
(find-files "." "^(\\.config|bzImage|zImage|Image\ (find-files "." "^(\\.config|bzImage|zImage|Image\
@ -1086,22 +1092,23 @@ ARCH and optionally VARIANT, or #f if there is no such configuration."
;; Install device tree files ;; Install device tree files
(unless (null? (find-files "." "\\.dtb$")) (unless (null? (find-files "." "\\.dtb$"))
(mkdir-p dtbdir) (mkdir-p dtbdir)
(invoke "make" (string-append "INSTALL_DTBS_PATH=" dtbdir) (apply invoke "make"
"dtbs_install")) (string-append "INSTALL_DTBS_PATH=" dtbdir)
"dtbs_install" make-flags))
;; Install kernel modules ;; Install kernel modules
(mkdir-p moddir) (mkdir-p moddir)
(invoke "make" (apply invoke "make"
;; Disable depmod because the Guix system's module ;; Disable depmod because the Guix system's module
;; directory is an union of potentially multiple ;; directory is an union of potentially multiple
;; packages. It is not possible to use depmod to ;; packages. It is not possible to use depmod to
;; usefully calculate a dependency graph while ;; usefully calculate a dependency graph while building
;; building only one of them. ;; only one of them.
"DEPMOD=true" "DEPMOD=true"
(string-append "MODULE_DIR=" moddir) (string-append "MODULE_DIR=" moddir)
(string-append "INSTALL_PATH=" #$output) (string-append "INSTALL_PATH=" #$output)
(string-append "INSTALL_MOD_PATH=" #$output) (string-append "INSTALL_MOD_PATH=" #$output)
"INSTALL_MOD_STRIP=1" "INSTALL_MOD_STRIP=1"
"modules_install") "modules_install" make-flags)
(let* ((versions (filter (lambda (name) (let* ((versions (filter (lambda (name)
(not (string-prefix? "." name))) (not (string-prefix? "." name)))
(scandir moddir))) (scandir moddir)))