blob: 319e96223ea9ad5c0446dd36753b14724bb6df76 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
|
;;; Package Repository for GNU Guix
;;; Copyright © 2021-2025 Franz Geffke <m@f-a.nz>
(define-module (px packages linux)
#:use-module ((guix licenses)
#:prefix license:)
#:use-module (guix build-system copy)
#:use-module (guix build-system gnu)
#:use-module (guix build-system linux-module)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix platform)
#:use-module (guix utils)
#:use-module (gnu packages base)
#:use-module (gnu packages bootloaders)
#:use-module (gnu packages compression)
#:use-module (gnu packages linux)
#:use-module (gnu system)
#:use-module (ice-9 match)
#:use-module (nongnu packages linux)
#:use-module (nonguix licenses)
#:export (%reterminal-kernel-modules))
(define-public brcm80211-firmware
(package
(name "brcm80211-firmware")
(version "20210818-1")
(source
(origin
(method url-fetch)
(uri (string-append
"http://ftp.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-brcm80211_"
version "_all.deb"))
(sha256
(base32 "04wg9fqay6rpg80b7s4h4g2kwq8msbh81lb3nd0jj45nnxrdxy7p"))))
(build-system copy-build-system)
(native-inputs (list tar bzip2))
(arguments
'(#:phases (modify-phases %standard-phases
(replace 'unpack
(lambda* (#:key inputs #:allow-other-keys)
(let ((source (assoc-ref inputs "source")))
(invoke "ar" "x" source)
(invoke "ls")
(invoke "tar" "-xvf" "data.tar.xz"))))
(add-after 'install 'make-symlinks
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(symlink (string-append out
"/lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,4-model-b.txt")
(string-append out
"/lib/firmware/brcm/brcmfmac43455-sdio.txt"))
(symlink (string-append out
"/lib/firmware/brcm/brcmfmac43455-sdio.bin")
(string-append out
"/lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,4-compute-module.bin"))))))
#:install-plan '(("lib/firmware/" "lib/firmware"))))
(home-page "https://packages.debian.org/sid/firmware-brcm80211")
(synopsis "Binary firmware for Broadcom/Cypress 802.11 wireless cards")
(description "This package contains the binary firmware for wireless
network cards supported by the brcmsmac or brcmfmac driver.")
(license license:expat)))
(define-public bluez-firmware
(let ((commit "31ad68831357d2019624004f1f0846475671088f")
(revision "1"))
(package
(name "bluez-firmware")
(version (git-version "0.0.0" revision commit))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/RPi-Distro/bluez-firmware.git")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32 "083s9n7kgyqjpr8jk6xw97fszzqpp3ndss3wjxn7c3snl47m9cy2"))))
(build-system copy-build-system)
(arguments
'(#:install-plan '(("broadcom/BCM4345C0.hcd"
"lib/firmware/brcm/BCM4345C0.hcd"))))
(home-page "https://github.com/RPi-Distro/bluez-firmware")
(synopsis "Bluetooth firmware")
(description "BlueZ - Bluetooth protocol stack for Linux")
(license license:expat))))
(define (config->string options)
(string-join (map (match-lambda
((option quote m)
(string-append option "=m"))
((option . #t) (string-append option "=y"))
((option . #f) (string-append option "=n"))) options)
"\n"))
(define %default-extra-linux-options
`( ;Some very mild hardening.
("CONFIG_SECURITY_DMESG_RESTRICT" . #t)
;; All kernels should have NAMESPACES options enabled
("CONFIG_NAMESPACES" . #t)
("CONFIG_UTS_NS" . #t)
("CONFIG_IPC_NS" . #t)
("CONFIG_USER_NS" . #t)
("CONFIG_PID_NS" . #t)
("CONFIG_NET_NS" . #t)
;; Various options needed for elogind service:
;; https://issues.guix.gnu.org/43078
("CONFIG_CGROUP_FREEZER" . #t)
("CONFIG_BLK_CGROUP" . #t)
("CONFIG_CGROUP_WRITEBACK" . #t)
("CONFIG_CGROUP_SCHED" . #t)
("CONFIG_CGROUP_PIDS" . #t)
("CONFIG_CGROUP_FREEZER" . #t)
("CONFIG_CGROUP_DEVICE" . #t)
("CONFIG_CGROUP_CPUACCT" . #t)
("CONFIG_CGROUP_PERF" . #t)
("CONFIG_SOCK_CGROUP_DATA" . #t)
("CONFIG_BLK_CGROUP_IOCOST" . #t)
("CONFIG_CGROUP_NET_PRIO" . #t)
("CONFIG_CGROUP_NET_CLASSID" . #t)
("CONFIG_MEMCG" . #t)
("CONFIG_MEMCG_SWAP" . #t)
("CONFIG_MEMCG_KMEM" . #t)
("CONFIG_CPUSETS" . #t)
("CONFIG_PROC_PID_CPUSET" . #t)
;; Allow disk encryption by default
("CONFIG_DM_CRYPT" . m)
;; Modules required for initrd:
("CONFIG_NET_9P" . m)
("CONFIG_NET_9P_VIRTIO" . m)
("CONFIG_VIRTIO_BLK" . m)
("CONFIG_VIRTIO_NET" . m)
("CONFIG_VIRTIO_PCI" . m)
("CONFIG_VIRTIO_BALLOON" . m)
("CONFIG_VIRTIO_MMIO" . m)
("CONFIG_FUSE_FS" . m)
("CONFIG_CIFS" . m)
("CONFIG_9P_FS" . m)))
(define-public linux-raspberry-5.15
(package
(inherit linux-libre-5.15)
(name "linux-raspberry")
(version "5.15.32")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/raspberrypi/linux")
(commit "1.20220331")))
(file-name (string-append "linux-" version))
(sha256
(base32 "1k18cwnsqdy5ckymy92kp8czckzwgn8wn2zdibzrrg9jxrflx6vl"))))
(supported-systems '("aarch64-linux"))
(arguments
(substitute-keyword-arguments (package-arguments linux-libre-5.15)
((#:phases phases)
#~(modify-phases #$phases
(replace 'configure
(lambda* (#:key inputs target #:allow-other-keys)
;; Avoid introducing timestamps
(setenv "KCONFIG_NOTIMESTAMP" "1")
(setenv "KBUILD_BUILD_TIMESTAMP"
(getenv "SOURCE_DATE_EPOCH"))
;; Other variables useful for reproducibility.
(setenv "KBUILD_BUILD_USER" "guix")
(setenv "KBUILD_BUILD_HOST" "guix")
;; Set ARCH and CROSS_COMPILE.
(let ((arch #$(platform-linux-architecture (lookup-platform-by-target-or-system
(or (%current-target-system)
(%current-system))))))
(setenv "ARCH" arch)
(format #t "`ARCH' set to `~a'~%"
(getenv "ARCH"))
(when target
(setenv "C_INCLUDE_PATH"
(string-join (cdr (string-split (getenv
"C_INCLUDE_PATH")
#\:)) ":"))
(setenv "CPLUS_INCLUDE_PATH"
(string-join (cdr (string-split (getenv
"CPLUS_INCLUDE_PATH")
#\:)) ":"))
(setenv "LIBRARY_PATH"
(string-join (cdr (string-split (getenv
"LIBRARY_PATH")
#\:)) ":"))
(setenv "CROSS_COMPILE"
(string-append target "-"))
(format #t "`CROSS_COMPILE' set to `~a'~%"
(getenv "CROSS_COMPILE"))))
(setenv "KERNEL" "kernel8")
(invoke "make" "bcm2711_defconfig")
(let ((port (open-file ".config" "a"))
(extra-configuration #$(config->string
%default-extra-linux-options)))
(display extra-configuration port)
(close-port port))
))))))))
;;;
;;; reTerminal related modules
;;;
(define-public bq24179-charger-linux-module
(package
(name "bq24179-charger-linux-module")
(version "0.1")
(source
(file-append (origin
(method git-fetch)
(uri (git-reference (url
"https://github.com/Seeed-Studio/seeed-linux-dtoverlays.git")
(commit
"589dab165f7a55eec0cc5fa25cc0bf892f4aa52c")))
(file-name (git-file-name name version))
(sha256 (base32
"002y8x0dmglhfgm60az6059jjnfm5q1zxdfp0b4s8dqybhjbdhb5")))
"/modules/bq24179_charger"))
(build-system linux-module-build-system)
(arguments
(list
#:tests? #f
#:linux linux-raspberry-5.15)) ;no test suite, RPI Linux
(home-page
"https://github.com/Seeed-Studio/seeed-linux-dtoverlays/tree/master/modules/bq24179_charger")
(synopsis
"Linux kernel module for bq24179_charger found in Seeed Studio ReTerminal")
(description "This is the Linux kernel bq24179_charger driver")
(license license:gpl2)))
(define-public lis3lv02d-linux-module
(package
(name "lis3lv02d-linux-module")
(version "0.1")
(source
(file-append (origin
(method git-fetch)
(uri (git-reference (url
"https://github.com/Seeed-Studio/seeed-linux-dtoverlays.git")
(commit
"589dab165f7a55eec0cc5fa25cc0bf892f4aa52c")))
(file-name (git-file-name name version))
(sha256 (base32
"002y8x0dmglhfgm60az6059jjnfm5q1zxdfp0b4s8dqybhjbdhb5")))
"/modules/lis3lv02d"))
(build-system linux-module-build-system)
(arguments
(list
#:tests? #f
#:linux linux-raspberry-5.15)) ;no test suite, RPI Linux
(home-page
"https://github.com/Seeed-Studio/seeed-linux-dtoverlays/tree/master/modules/lis3lv02d")
(synopsis
"Linux kernel module for GROVE 3-Axis Digital Accelerometer found in Seed Studio ReTerminal")
(description
"This is the Linux kernel GROVE 3-Axis Digital Accelerometer driver")
(license license:gpl2)))
(define-public ltr30x-linux-module
(package
(name "ltr30x-linux-module")
(version "0.1")
(source
(file-append (origin
(method git-fetch)
(uri (git-reference (url
"https://github.com/Seeed-Studio/seeed-linux-dtoverlays.git")
(commit
"589dab165f7a55eec0cc5fa25cc0bf892f4aa52c")))
(file-name (git-file-name name version))
(sha256 (base32
"002y8x0dmglhfgm60az6059jjnfm5q1zxdfp0b4s8dqybhjbdhb5")))
"/modules/ltr30x"))
(build-system linux-module-build-system)
(arguments
(list
#:tests? #f
#:linux linux-raspberry-5.15)) ;no test suite, RPI Linux
(home-page
"https://github.com/Seeed-Studio/seeed-linux-dtoverlays/tree/master/modules/ltr30x")
(synopsis
"Linux kernel module for ltr30x ambient light and proximity sensor found in Seed Studio ReTerminal")
(description
"This is the Linux kernel ltr30x ambient light and proximity sensor driver")
(license license:gpl2)))
(define-public mipi_dsi-linux-module
(package
(name "mipi_dsi-linux-module")
(version "0.1")
(source
(file-append (origin
(method git-fetch)
(uri (git-reference (url
"https://github.com/Seeed-Studio/seeed-linux-dtoverlays.git")
(commit
"589dab165f7a55eec0cc5fa25cc0bf892f4aa52c")))
(file-name (git-file-name name version))
(sha256 (base32
"002y8x0dmglhfgm60az6059jjnfm5q1zxdfp0b4s8dqybhjbdhb5")))
"/modules/mipi_dsi"))
(build-system linux-module-build-system)
(arguments
(list
#:tests? #f
#:linux linux-raspberry-5.15)) ;no test suite, RPI Linux
(home-page
"https://github.com/Seeed-Studio/seeed-linux-dtoverlays/tree/master/modules/mipi_dsi")
(synopsis
"Linux kernel module for MIPI-DSI panel with touch panel attached to I2C bus found in Seed Studio ReTerminal")
(description
"This is a linux kernel driver for MIPI-DSI panel with touch panel attached to I2C bus.")
(license license:gpl2)))
(define-public seeed-reterminal-dtoverlays
(package
(name "seeed-reterminal-dtoverlays")
(version "1.9")
(license license:gpl2)
(source
(file-append (origin
(method git-fetch)
(uri (git-reference (url
"https://github.com/Seeed-Studio/seeed-linux-dtoverlays.git")
(commit
"589dab165f7a55eec0cc5fa25cc0bf892f4aa52c")))
(file-name (git-file-name name version))
(sha256 (base32
"002y8x0dmglhfgm60az6059jjnfm5q1zxdfp0b4s8dqybhjbdhb5")))
"/overlays/rpi"))
(build-system gnu-build-system)
(arguments
'(#:phases (modify-phases %standard-phases
(delete 'configure)
(add-before 'build 'set-prefix-in-makefile
(lambda* (#:key outputs #:allow-other-keys)
;; Modify the makefile so that its
;; 'DEST' variable points to "out".
(let ((out (assoc-ref outputs "out")))
(substitute* "Makefile"
(("DEST :=.*")
(string-append "DEST := " out "\n"))) #t)))
(add-before 'install 'create-dir
(lambda* (#:key outputs #:allow-other-keys)
(mkdir-p (assoc-ref outputs "out")))))
#:tests? #f))
(native-inputs `(("dtc" ,dtc)))
(synopsis "Device Tree overlays for Seed Studio ReTerminal")
(description "Device Tree overlays for Seed Studio ReTerminal")
(home-page "https://github.com/Seeed-Studio/seeed-linux-dtoverlays/")))
(define %reterminal-kernel-modules
(list bq24179-charger-linux-module lis3lv02d-linux-module
ltr30x-linux-module mipi_dsi-linux-module))
|