projects/guix·blob python-team · refs

295 lines · 11.3 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2018 Danny Milosavljevic <[email protected]>
3;;; Copyright © 2018 Ludovic Courtès <[email protected]>
4;;; Copyright © 2019 Tobias Geerinckx-Rice <[email protected]>
5;;; Copyright © 2025 Cayetano Santos <[email protected]>
6;;; Copyright © 2026 Denis 'GNUtoo' Carikli <[email protected]>
7;;;
8;;; This file is part of GNU Guix.
9;;;
10;;; GNU Guix is free software; you can redistribute it and/or modify it
11;;; under the terms of the GNU General Public License as published by
12;;; the Free Software Foundation; either version 3 of the License, or (at
13;;; your option) any later version.
14;;;
15;;; GNU Guix is distributed in the hope that it will be useful, but
16;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;;; GNU General Public License for more details.
19;;;
20;;; You should have received a copy of the GNU General Public License
21;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23(define-module (gnu packages coreboot)
24 #:use-module (gnu packages bison)
25 #:use-module (gnu packages compression)
26 #:use-module (gnu packages compiler-tools)
27 #:use-module (gnu packages pciutils)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix build-system cargo)
30 #:use-module (guix build-system cmake)
31 #:use-module (guix build-system copy)
32 #:use-module (guix build-system gnu)
33 #:use-module (guix build-system go)
34 #:use-module (guix build-system meson)
35 #:use-module (guix build-system pyproject)
36 #:use-module (guix build-system qt)
37 #:use-module (guix download)
38 #:use-module (guix gexp)
39 #:use-module (guix git-download)
40 #:use-module (guix packages)
41 #:use-module (guix utils)
42 #:use-module (srfi srfi-26))
43
44(define %coreboot-version "26.06")
45
46(define %coreboot-origin
47 (origin
48 (method git-fetch)
49 (uri (git-reference
50 (url "https://review.coreboot.org/coreboot")
51 (commit %coreboot-version)))
52 (file-name (git-file-name "coreboot" %coreboot-version))
53 (sha256
54 (base32
55 "0niqq358n0fp44ay73g8hpavz0nbx1kn8x1iplhr42srym9vcwwn"))))
56
57(define-public bincfg
58 (package
59 (name "bincfg")
60 (version %coreboot-version)
61 (source %coreboot-origin)
62 (build-system gnu-build-system)
63 (arguments
64 (list
65 #:tests? #f ; no test suite
66 #:make-flags
67 #~(list
68 (string-append "CC=" #$(cc-for-target)))
69 #:phases
70 #~(modify-phases %standard-phases
71 (delete 'configure) ; no configure script
72 (add-after 'unpack 'chdir
73 (lambda _
74 (chdir "util/bincfg")))
75 (add-after 'build 'build-binaries
76 (lambda* (#:key make-flags #:allow-other-keys)
77 (for-each
78 (lambda (target result)
79 (apply invoke "make" (string-append "gen-" target) make-flags)
80 (rename-file result
81 (string-append target ".bin")))
82 (list
83 ;; generate GbE for X200
84 "gbe-ich9m"
85 ;; generate GbE for X220/x230
86 "gbe-82579LM"
87 ;; generate IFD for X200
88 "ifd-x200")
89 (list
90 "flashregion_3_gbe.bin"
91 "flashregion_3_gbe.bin"
92 "flashregion_0_fd.bin"))))
93 ;; The Makefile has no install target.
94 (replace 'install
95 (lambda _
96 (let ((bin (string-append #$output "/bin"))
97 (lib (string-append #$output "/lib/bincfg"))
98 (data (string-append #$output "/share/bincfg")))
99 ;; Install the program
100 (install-file "bincfg" bin)
101 ;; And its data
102 (for-each
103 (lambda (path)
104 (install-file path data))
105 (append (find-files "." ".*\\.set")
106 (find-files "." ".*\\.spec")))
107 ;; And the files generated with the data
108 (for-each
109 (lambda (path)
110 (install-file path lib))
111 (find-files "." ".*\\.bin"))))))))
112 (native-inputs (list bison flex))
113 (home-page "https://coreboot.org")
114 (synopsis "Encoder/decoder for binary formats described in text files")
115 (description "
116The bincfg program comes with specifications files for the following binary
117formats:
118@itemize
119@item Various DDR3 and DDR4 SPD
120@item Configuration data for the Intel 82579LM Gigabit Ethernet PHY
121@item Configuration data for the Intel Gigabit Ethernet controller present in
122 the Intel ICH9-M chipset.
123@item Intel Firmware Descriptor data for the Lenovo ThinkPad X200
124@item Configuration data for the ITE IT8718F SuperIO
125@end itemize
126It also comes with example files generated by bincfg.")
127 (license license:gpl3+)))
128
129(define-public bucts
130 (package
131 (name "bucts")
132 (version %coreboot-version)
133 (source %coreboot-origin)
134 (build-system gnu-build-system)
135 (arguments
136 (list
137 #:tests? #f ;no tests
138 #:make-flags #~(list (string-append "CC=" #$(cc-for-target)))
139 #:phases #~(modify-phases %standard-phases
140 (delete 'configure) ;no configure script
141 (add-after 'unpack 'enter-source
142 (lambda _
143 (chdir "util/bucts")))
144 (add-after 'enter-source 'set-version
145 (lambda _
146 (substitute* "Makefile"
147 (("^VERSION:=*")
148 #$(string-append "VERSION:=" version)))))
149 ;; no install target
150 (replace 'install
151 (lambda _
152 (let ((bin (string-append #$output "/bin"))
153 (doc (string-append #$output "/share/doc/bucts/"))
154 (licenses (string-append #$output
155 "/share/licenses/bucts/")))
156 (install-file "bucts" bin)
157 (install-file "readme.md" doc)
158 (install-file "../../COPYING" licenses)))))))
159 (inputs (list pciutils))
160 (home-page "https://coreboot.org")
161 (synopsis "Tool to swap the BIOS bootblock and backup bootblock on the
162Intel I945 chipsets")
163 (description
164 "The @command{bucts} command can flip a bit in the BUC.TS register of the
165Intel I945 chipsets and show the register status. When the bit is set, it
166swaps the bootblock location. Because the bootblock region is often set
167read-only by the default BIOS, this enables to bypass that restriction and is
168used as part of a procedure to replace the nonfree BIOS with free software on
169various computers (Lenovo X60, X60s, X60T, T60, probably more).")
170 (license license:gpl2)))
171
172(define-public ectool
173 (package
174 (name "ectool")
175 (version %coreboot-version)
176 (source %coreboot-origin)
177 (build-system gnu-build-system)
178 (arguments
179 (list
180 #:tests? #f ; no test suite
181 #:make-flags
182 #~(list (string-append "CC=" #$(cc-for-target))
183 "INSTALL=install"
184 (string-append "PREFIX=" #$output))
185 #:phases
186 #~(modify-phases %standard-phases
187 (add-after 'unpack 'chdir
188 (lambda _
189 (chdir "util/ectool")))
190 (delete 'configure)))) ; no configure script
191 (home-page "https://doc.coreboot.org/util.html")
192 (synopsis "Tool to dump and modify @acronym{EC, Embedded Controller} RAM
193on computers such as laptops")
194 (description "This package provides @command{ectool}, a program to dump
195and modify the contents of @acronym{EC, Embedded Controller} RAM
196on mobile computers.")
197 (license license:gpl2)))
198
199(define-public ifdtool
200 (package
201 (name "ifdtool")
202 (version %coreboot-version)
203 (source %coreboot-origin)
204 (build-system gnu-build-system)
205 (arguments
206 (list
207 #:make-flags
208 #~(list (string-append "CC=" #$(cc-for-target))
209 "INSTALL=install"
210 (string-append "PREFIX=" #$output))
211 #:phases
212 #~(modify-phases %standard-phases
213 (add-after 'unpack 'chdir
214 (lambda _
215 (chdir "util/ifdtool")))
216 (delete 'configure)) ; no configure script
217 #:tests? #f)) ; no test suite
218 (home-page "https://doc.coreboot.org/util/ifdtool/")
219 (synopsis "Intel Firmware Descriptor dumper")
220 (description "This package provides @command{ifdtool}, a program to
221dump Intel Firmware Descriptor data of an image file.")
222 (license license:gpl2)))
223
224(define-public intelmetool
225 (package
226 (name "intelmetool")
227 (version %coreboot-version)
228 (source %coreboot-origin)
229 (build-system gnu-build-system)
230 (arguments
231 (list
232 #:tests? #f ;no test suite
233 #:make-flags
234 #~(list (string-append "CC=" #$(cc-for-target))
235 "INSTALL=install"
236 (string-append "PREFIX=" #$output))
237 #:phases
238 #~(modify-phases %standard-phases
239 (add-after 'unpack 'chdir
240 (lambda _
241 (chdir "util/intelmetool")))
242 (delete 'configure) ;no configure script
243 (delete 'check))))
244 (inputs (list pciutils zlib))
245 (home-page
246 "https://github.com/coreboot/coreboot/tree/main/util/intelmetool/")
247 (synopsis "Intel Management Engine tools")
248 (description "This package provides tools for working with Intel
249Management Engine (ME). You need to @code{sudo rmmod mei_me} and
250@code{sudo rmmod mei} before using this tool. Also pass
251@code{iomem=relaxed} to the Linux kernel command line.")
252 (license license:gpl2)
253
254 ;; This is obviously an Intel thing, plus it requires <cpuid.h>.
255 (supported-systems '("x86_64-linux" "i686-linux"))))
256
257(define-public nvramtool
258 (package
259 (name "nvramtool")
260 (version %coreboot-version)
261 (source %coreboot-origin)
262 (build-system gnu-build-system)
263 (arguments
264 (list
265 #:tests? #f ; no test suite
266 #:make-flags
267 #~(list (string-append "CC=" #$(cc-for-target))
268 "INSTALL=install"
269 (string-append "PREFIX=" #$output))
270 #:phases
271 #~(modify-phases %standard-phases
272 (add-after 'unpack 'chdir
273 (lambda _
274 (chdir "util/nvramtool")))
275 (delete 'configure)))) ; no configure script
276 (home-page "https://coreboot.org")
277 (synopsis "Command line tool that can edit Coreboot settings")
278 (description "@command{nvramtool} can see and/or modify Coreboot settings
279like the serial port speed, log level, etc. It requires Coreboot to be compiled
280with CONFIG_USE_OPTION_TABLE and some options require the iomem=relaxed kernel
281command line to work. Features:
282@itemize
283@item If Coreboot was compiled without CONFIG_STATIC_OPTION_TABLE, it can change
284 its settings, which are applied after a reboot.
285@item It can modify Coreboot images default settings with
286 @command{nvramtool -C coreboot.rom [...]}.
287@item It has various options related to the file format used to store these
288 settings.
289@item It can also read/write the CMOS memory where the Coreboot settings can be
290 located.
291@end itemize")
292 ;; Some files are "GPL-2.0-only or BSD-3-Clause", other are GPL-2.0-only
293 ;; and anyway there is. There is also a license declaration in
294 ;; cli/nvramtool.8 that applies to "This program" which uses the GPLv2.
295 (license license:gpl2)))