diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 5ae6366593..16f7195578 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -777,12 +777,12 @@ (define-public linux-libre-headers linux-libre-headers-5.10.35) ;;; (define* (kernel-config arch #:key variant) - "Return a file-like object of the Linux-Libre build configuration file for -ARCH and optionally VARIANT, or #f if there is no such configuration." + "Return the absolute file name of the Linux-Libre build configuration file +for ARCH and optionally VARIANT, or #f if there is no such configuration." (let* ((name (string-append (if variant (string-append variant "-") "") (if (string=? "i386" arch) "i686" arch) ".conf")) (file (string-append "linux-libre/" name))) - (local-file (search-auxiliary-file file)))) + (search-auxiliary-file file))) (define %default-extra-linux-options `(;; Make the kernel config available at /proc/config.gz @@ -890,9 +890,8 @@ (define (doc-supported? version) (define* (make-linux-libre version gnu-revision hash-string supported-systems #:key (extra-version #f) - ;; A function that takes an arch and a variant, and - ;; return a file-like object. See kernel-config - ;; for an example. + ;; A function that takes an arch and a variant. + ;; See kernel-config for an example. (configuration-file #f) (defconfig "defconfig") (extra-options %default-extra-linux-options) @@ -976,20 +975,8 @@ (define* (make-linux-libre* version gnu-revision source supported-systems #$(and extra-version (string-append "-" extra-version))))) (replace 'configure - (lambda _ - (let ((config - #$(match (let ((arch (platform-linux-architecture - (lookup-platform-by-target-or-system - (or (%current-target-system) - (%current-system)))))) - (and configuration-file arch - (configuration-file - arch - #:variant (version-major+minor version)))) - (#f ;no config for this platform - #f) - ((? file-like? config) - config)))) + (lambda* (#:key inputs #:allow-other-keys) + (let ((config (assoc-ref inputs "kconfig"))) ;; Use a custom kernel configuration file or a default ;; configuration file. (if config @@ -997,15 +984,15 @@ (define* (make-linux-libre* version gnu-revision source supported-systems (copy-file config ".config") (chmod ".config" #o666)) (invoke "make" #$defconfig)) - ;; Appending works even when the option wasn't in the file. - ;; The last one prevails if duplicated. + ;; Appending works even when the option wasn't in the + ;; file. The last one prevails if duplicated. (let ((port (open-file ".config" "a")) (extra-configuration #$(config->string extra-options))) (display extra-configuration port) (close-port port)) (invoke "make" "oldconfig")))) (replace 'install - (lambda _ + (lambda* (#:key inputs #:allow-other-keys) (let ((moddir (string-append #$output "/lib/modules")) (dtbdir (string-append #$output "/lib/dtbs"))) ;; Install kernel image, kernel configuration and link map. @@ -1020,11 +1007,11 @@ (define* (make-linux-libre* version gnu-revision source supported-systems ;; Install kernel modules (mkdir-p moddir) (invoke "make" - ;; Disable depmod because the Guix system's module - ;; directory is an union of potentially multiple - ;; packages. It is not possible to use depmod to - ;; usefully calculate a dependency graph while - ;; building only one of them. + ;; Disable depmod because the Guix system's + ;; module directory is an union of potentially + ;; multiple packages. It is not possible to use + ;; depmod to usefully calculate a dependency + ;; graph while building only one of them. "DEPMOD=true" (string-append "MODULE_DIR=" moddir) (string-append "INSTALL_PATH=" #$output) @@ -1037,8 +1024,8 @@ (define* (make-linux-libre* version gnu-revision source supported-systems (version (match versions ((x) x)))) ;; There are symlinks to the build and source directory. - ;; Both will point to target /tmp/guix-build* and thus not - ;; be useful in a profile. Delete the symlinks. + ;; Both will point to target /tmp/guix-build* and thus + ;; not be useful in a profile. Delete the symlinks. (false-if-file-not-found (delete-file (string-append moddir "/" version "/build"))) @@ -1046,22 +1033,35 @@ (define* (make-linux-libre* version gnu-revision source supported-systems (delete-file (string-append moddir "/" version "/source")))))))))) (native-inputs - (list perl - bc - openssl - elfutils ;needed to enable CONFIG_STACK_VALIDATION - flex - bison - ;; These are needed to compile the GCC plugins. - gmp - mpfr - mpc)) + `(("perl" ,perl) + ("bc" ,bc) + ("openssl" ,openssl) + ("elfutils" ,elfutils) ;needed to enable CONFIG_STACK_VALIDATION + ("flex" ,flex) + ("bison" ,bison) + + ;; These are needed to compile the GCC plugins. + ("gmp" ,gmp) + ("mpfr" ,mpfr) + ("mpc" ,mpc) + ,@(match (let ((arch (platform-linux-architecture + (lookup-platform-by-target-or-system + (or (%current-target-system) + (%current-system)))))) + (and configuration-file arch + (configuration-file + arch + #:variant (version-major+minor version)))) + (#f ;no config for this platform + '()) + ((? string? config) + `(("kconfig" ,config)))))) (home-page "https://www.gnu.org/software/linux-libre/") (synopsis "100% free redistribution of a cleaned Linux kernel") (description "GNU Linux-Libre is a free (as in freedom) variant of the Linux kernel. It has been modified to remove all non-free binary blobs.") (license license:gpl2) - (properties '((max-silent-time . 3600))))) ;don't timeout on blob scan + (properties '((max-silent-time . 3600))))) ;don't timeout on blob scan. ;;;