summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Volf <~@wolfsden.cz>2024-01-11 13:30:38 +0100
committerJonathan Brielmaier <jonathan.brielmaier@web.de>2024-01-23 18:25:40 +0100
commit3857d86267284000dc48660a5dfd56cb2a8cf004 (patch)
tree6386770e7591566a468899384594473beb9b1538
parentd0a8b135d3c75dca774e55e15b4671dcf5965cd1 (diff)
nongnu: linux: Enable mt7921e driver.
In order to be able to use WiFi chip in P14s ThinkPad, the mt7921e module is required. This commit enables it in kernels that do have it. I originally implemented this using a list of additional option, same way %default-extra-linux-options is done. However I quickly realized that approach is not suitable for hardware enablement. The older versions do not support the same drivers as the newer ones. Solution is to create a new procedure that generates the list for a specific kernel version and use it as a default value for #:configs. * nongnu/packages/linux.scm (nonguix-extra-linux-options): New procedure. (corrupt-linux): Use it as default value for #:configs. Signed-off-by: Jonathan Brielmaier <jonathan.brielmaier@web.de>
-rw-r--r--nongnu/packages/linux.scm35
1 files changed, 34 insertions, 1 deletions
diff --git a/nongnu/packages/linux.scm b/nongnu/packages/linux.scm
index 652f258..365590c 100644
--- a/nongnu/packages/linux.scm
+++ b/nongnu/packages/linux.scm
@@ -24,6 +24,7 @@
24;;; Copyright © 2023 Adam Kandur <rndd@tuta.io> 24;;; Copyright © 2023 Adam Kandur <rndd@tuta.io>
25;;; Copyright © 2023 Hilton Chain <hako@ultrarare.space> 25;;; Copyright © 2023 Hilton Chain <hako@ultrarare.space>
26;;; Copyright © 2023 Ada Stevenson <adanskana@gmail.com> 26;;; Copyright © 2023 Ada Stevenson <adanskana@gmail.com>
27;;; Copyright © 2023 Tomas Volf <~@wolfsden.cz>
27 28
28(define-module (nongnu packages linux) 29(define-module (nongnu packages linux)
29 #:use-module (gnu packages) 30 #:use-module (gnu packages)
@@ -52,10 +53,42 @@
52 "/linux/kernel/v" (version-major version) ".x" 53 "/linux/kernel/v" (version-major version) ".x"
53 "/linux-" version ".tar.xz")) 54 "/linux-" version ".tar.xz"))
54 55
56;;; If you are corrupting the kernel on your own, consider using output of
57;;; this procedure as a base for your options:
58;;; (corrupt-linux linux-libre-lts
59;;; #:configs (cons* "CONFIG_FOO=y"
60;;; (nonguix-extra-linux-options linux-libre-lts)
61(define-public (nonguix-extra-linux-options linux-or-version)
62 "Return a list containing additional options that nonguix sets by default
63for a corrupted linux package of specified version. linux-or-version can be
64some freedo package or an output of package-version procedure."
65 (define linux-version
66 (if (package? linux-or-version)
67 (package-version linux-or-version)
68 linux-or-version))
69
70 (reverse (fold (lambda (opt opts)
71 (if (version>=? linux-version (car opt))
72 (cons* (cdr opt) opts)
73 opts))
74 '()
75 ;; List of additional options for nonguix corrupted linux.
76 ;; Each member is a pair of a minimal version (>=) and the
77 ;; option itself. Option has to be in a format suitable for
78 ;; (@ (guix build kconfig) modify-defconfig) procedure.
79 ;;
80 ;; Do note that this list is intended for enabling use of
81 ;; hardware requiring non-free firmware. If a configuration
82 ;; option does work under linux-libre, it should go into Guix
83 ;; actual.
84 '(
85 ;; Driver for MediaTek mt7921e wireless chipset
86 ("5.15" . "CONFIG_MT7921E=m")))))
87
55(define* (corrupt-linux freedo 88(define* (corrupt-linux freedo
56 #:key 89 #:key
57 (name "linux") 90 (name "linux")
58 (configs '()) 91 (configs (nonguix-extra-linux-options freedo))
59 (defconfig #f)) 92 (defconfig #f))
60 93
61 ;; TODO: This very directly depends on guix internals. 94 ;; TODO: This very directly depends on guix internals.