services: mingetty: Move tty optionality to agetty.
[jackhill/guix/guix.git] / gnu / packages / flashing-tools.scm
CommitLineData
4acd5c0f 1;;; GNU Guix --- Functional package management for GNU
eff5f452 2;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
4acd5c0f 3;;; Copyright © 2014 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
af3166c3
HG
4;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
5;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
7526edb9 6;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
29ac89a6 7;;; Copyright © 2017 Jonathan Brielmaier <jonathan.brielmaier@web.de>
f282aa53 8;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
a03abe78 9;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
4acd5c0f
MR
10;;;
11;;; This file is part of GNU Guix.
12;;;
13;;; GNU Guix is free software; you can redistribute it and/or modify it
14;;; under the terms of the GNU General Public License as published by
15;;; the Free Software Foundation; either version 3 of the License, or (at
16;;; your option) any later version.
17;;;
18;;; GNU Guix is distributed in the hope that it will be useful, but
19;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;;; GNU General Public License for more details.
22;;;
23;;; You should have received a copy of the GNU General Public License
24;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
eff5f452 26(define-module (gnu packages flashing-tools)
f282aa53 27 #:use-module ((guix licenses) #:prefix license:)
4acd5c0f 28 #:use-module (guix download)
7526edb9 29 #:use-module (guix git-download)
4acd5c0f
MR
30 #:use-module (guix packages)
31 #:use-module (gnu packages)
f282aa53 32 #:use-module (guix build-system cmake)
4acd5c0f 33 #:use-module (guix build-system gnu)
0297a160 34 #:use-module (guix build-system python)
4acd5c0f 35 #:use-module (gnu packages bison)
f282aa53 36 #:use-module (gnu packages compression)
4acd5c0f
MR
37 #:use-module (gnu packages flex)
38 #:use-module (gnu packages elf)
9721c0b6 39 #:use-module (gnu packages pciutils)
eff5f452 40 #:use-module (gnu packages pkg-config)
4acd5c0f 41 #:use-module (gnu packages libusb)
eff5f452
MR
42 #:use-module (gnu packages libftdi)
43 #:use-module (gnu packages pciutils)
f282aa53 44 #:use-module (gnu packages qt)
af3166c3 45 #:use-module (gnu packages autotools)
eff5f452
MR
46 #:use-module (gnu packages admin))
47
48(define-public flashrom
49 (package
50 (name "flashrom")
a03abe78 51 (version "1.0")
eff5f452
MR
52 (source (origin
53 (method url-fetch)
54 (uri (string-append
03ddad84 55 "https://download.flashrom.org/releases/flashrom-"
eff5f452
MR
56 version ".tar.bz2"))
57 (sha256
58 (base32
a03abe78 59 "0r7fkpfc8w51n8ffbhclj4wa3kwrk0ijv1acwpw5myx5bchzl0ip"))))
eff5f452
MR
60 (build-system gnu-build-system)
61 (inputs `(("dmidecode" ,dmidecode)
62 ("pciutils" ,pciutils)
63 ("libusb" ,libusb)
64 ("libftdi" ,libftdi)))
65 (native-inputs `(("pkg-config" ,pkg-config)))
66 (arguments
03ddad84
DM
67 '(#:make-flags (list "CC=gcc"
68 (string-append "PREFIX=" %output)
69 "CONFIG_ENABLE_LIBUSB0_PROGRAMMERS=no")
a03abe78 70 #:tests? #f ; no 'check' target
eff5f452 71 #:phases
dc1d3cde 72 (modify-phases %standard-phases
a03abe78 73 (delete 'configure) ; no configure script
dc1d3cde
KK
74 (add-before 'build 'patch-exec-paths
75 (lambda* (#:key inputs #:allow-other-keys)
76 (substitute* "dmi.c"
77 (("\"dmidecode\"")
78 (format #f "~S"
79 (string-append (assoc-ref inputs "dmidecode")
80 "/sbin/dmidecode"))))
81 #t)))))
291b5de9 82 (home-page "https://flashrom.org/")
eff5f452
MR
83 (synopsis "Identify, read, write, erase, and verify ROM/flash chips")
84 (description
85 "flashrom is a utility for identifying, reading, writing,
86verifying and erasing flash chips. It is designed to flash
87BIOS/EFI/coreboot/firmware/optionROM images on mainboards,
88network/graphics/storage controller cards, and various other
89programmer devices.")
f282aa53 90 (license license:gpl2)))
4acd5c0f 91
29ac89a6
JB
92(define-public 0xffff
93 (package
94 (name "0xffff")
95 (version "0.7")
96 (source
97 (origin
98 (method url-fetch)
99 (uri (string-append "https://github.com/pali/0xffff/archive/"
100 version ".tar.gz"))
101 (file-name (string-append "0xFFFF" version ".tar.gz" ))
102 (sha256
103 (base32
104 "1g4032c81wkk37wvbg1dxcqq6mnd76y9x7f2crmzqi6z4q9jcxmj"))))
105 (build-system gnu-build-system)
106 (inputs
107 `(("libusb",libusb-0.1))) ; doesn't work with libusb-compat
108 (arguments
109 '(#:phases
110 (modify-phases %standard-phases
111 (delete 'configure)) ; no configure
112 #:make-flags (list (string-append "PREFIX=" %output))
113 #:tests? #f)) ; no 'check' target
114 (home-page "https://github.com/pali/0xFFFF")
115 (synopsis "Flash FIASCO images on Maemo devices")
116 (description
117 "The Open Free Fiasco Firmware Flasher (0xFFFF) is a flashing tool
118for FIASCO images. It supports generating, unpacking, editing and
119flashing of FIASCO images for Maemo devices. Use it with care. It can
120brick your device.")
f282aa53 121 (license license:gpl3+)))
29ac89a6 122
4acd5c0f
MR
123(define-public avrdude
124 (package
125 (name "avrdude")
126 (version "6.1")
127 (source
128 (origin
129 (method url-fetch)
130 (uri (string-append "mirror://savannah/avrdude/avrdude-"
131 version ".tar.gz"))
132 (sha256
133 (base32
b0069a67 134 "0frxg0q09nrm95z7ymzddx7ysl77ilfbdix1m81d9jjpiv5bm64y"))))
4acd5c0f
MR
135 (build-system gnu-build-system)
136 (inputs
137 `(("libelf" ,libelf)
b0069a67 138 ("libusb" ,libusb-compat)
4acd5c0f
MR
139 ("libftdi" ,libftdi)))
140 (native-inputs
141 `(("bison" ,bison)
142 ("flex" ,flex)))
143 (home-page "http://www.nongnu.org/avrdude/")
144 (synopsis "AVR downloader and uploader")
145 (description
146 "AVRDUDE is a utility to download/upload/manipulate the ROM and
147EEPROM contents of AVR microcontrollers using the in-system programming
148technique (ISP).")
f282aa53 149 (license license:gpl2+)))
2a9a4fb8
MR
150
151(define-public dfu-programmer
152 (package
153 (name "dfu-programmer")
702675c5 154 (version "0.7.2")
2a9a4fb8
MR
155 (source
156 (origin
157 (method url-fetch)
de67e922
LF
158 (uri (string-append "mirror://sourceforge/dfu-programmer/dfu-programmer/"
159 version "/dfu-programmer-" version ".tar.gz"))
2a9a4fb8
MR
160 (sha256
161 (base32
702675c5 162 "15gr99y1z9vbvhrkd25zqhnzhg6zjmaam3vfjzf2mazd39mx7d0x"))
fc1adab1 163 (patches (search-patches "dfu-programmer-fix-libusb.patch"))))
2a9a4fb8 164 (build-system gnu-build-system)
702675c5
DT
165 (native-inputs
166 `(("pkg-config" ,pkg-config)))
2a9a4fb8
MR
167 (inputs
168 `(("libusb" ,libusb)))
169 (home-page "http://dfu-programmer.github.io/")
170 (synopsis "Device firmware update programmer for Atmel chips")
171 (description
7c125ce0
AK
172 "Dfu-programmer is a multi-platform command-line programmer for
173Atmel (8051, AVR, XMEGA & AVR32) chips with a USB bootloader supporting
174ISP.")
f282aa53 175 (license license:gpl2+)))
af3166c3
HG
176
177(define-public dfu-util
178 (package
179 (name "dfu-util")
180 (version "0.9")
181 (source (origin
182 (method url-fetch)
183 (uri (string-append
184 "http://dfu-util.sourceforge.net/releases/dfu-util-"
185 version ".tar.gz"))
186 (sha256
187 (base32
188 "0czq73m92ngf30asdzrfkzraag95hlrr74imbanqq25kdim8qhin"))))
189 (build-system gnu-build-system)
190 (inputs
191 `(("libusb" ,libusb)))
192 (native-inputs
193 `(("pkg-config" ,pkg-config)))
194 (synopsis "Host side of the USB Device Firmware Upgrade (DFU) protocol")
195 (description
196 "The DFU (Universal Serial Bus Device Firmware Upgrade) protocol is
197intended to download and upload firmware to devices connected over USB. It
198ranges from small devices like micro-controller boards up to mobile phones.
199With dfu-util you are able to download firmware to your device or upload
200firmware from it.")
201 (home-page "http://dfu-util.sourceforge.net/")
f282aa53 202 (license license:gpl2+)))
d3a858cb
HG
203
204(define-public teensy-loader-cli
205 ;; The repo does not tag versions nor does it use releases, but a commit
206 ;; message says "Importing 2.1", while the sourcce still says "2.0". So pin
207 ;; to a fixed commit.
208 (let ((commit "f289b7a2e5627464044249f0e5742830e052e360"))
209 (package
210 (name "teensy-loader-cli")
211 (version (string-append "2.1-1." (string-take commit 7)))
212 (source
213 (origin
214 (method url-fetch)
215 (uri (string-append "https://github.com/PaulStoffregen/"
216 "teensy_loader_cli/archive/" commit ".tar.gz"))
217 (sha256 (base32 "17wqc2q4fa473cy7f5m2yiyb9nq0qw7xal2kzrxzaikgm9rabsw8"))
218 (file-name (string-append "teensy-loader-cli-" version ".tar.gz" ))
219 (modules '((guix build utils)))
220 (snippet
221 `(begin
222 ;; Remove example flash files and teensy rebooter flash binaries.
223 (for-each delete-file (find-files "." "\\.(elf|hex)$"))
224 ;; Fix the version
225 (substitute* "teensy_loader_cli.c"
226 (("Teensy Loader, Command Line, Version 2.0\\\\n")
227 (string-append "Teensy Loader, Command Line, " ,version "\\n")))
228 #t))
229 (patches (search-patches "teensy-loader-cli-help.patch"))))
230 (build-system gnu-build-system)
231 (arguments
232 '(#:tests? #f ;; Makefile has no test target
233 #:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
234 #:phases
235 (modify-phases %standard-phases
236 (delete 'configure)
237 (replace 'install
238 (lambda* (#:key outputs #:allow-other-keys)
239 (let* ((out (assoc-ref outputs "out"))
240 (bin (string-append out "/bin")))
241 (install-file "teensy_loader_cli" bin)
242 #t))))))
243 (inputs
244 `(("libusb-compat" ,libusb-compat)))
245 (synopsis "Command line firmware uploader for Teensy development boards")
246 (description
247 "The Teensy loader program communicates with your Teensy board when the
248HalfKay bootloader is running, so you can upload new programs and run them.
249
250You need to add the udev rules to make the Teensy update available for
251non-root users.")
252 (home-page "https://www.pjrc.com/teensy/loader_cli.html")
f282aa53 253 (license license:gpl3))))
7526edb9
EF
254
255(define-public rkflashtool
256 (let ((commit "094bd6410cb016e487e2ccb1050c59eeac2e6dd1")
257 (revision "1"))
258 (package
259 (name "rkflashtool")
260 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
261 (source
262 (origin
263 (method git-fetch)
264 (uri (git-reference
265 (url "https://github.com/linux-rockchip/rkflashtool.git")
266 (commit commit)))
267 (file-name (string-append name "-" version "-checkout"))
268 (sha256
269 (base32
270 "1zkd8zxir3rfg3sy9r20bcnxclnplryn583gqpcr3iad0k3xbah7"))))
271 (build-system gnu-build-system)
272 (arguments
273 '(#:phases
274 (modify-phases %standard-phases
275 (delete 'configure)) ; no configure
276 #:make-flags (list (string-append "PREFIX=" %output))
277 #:tests? #f)) ; no tests
278 (native-inputs
279 `(("pkg-config" ,pkg-config)))
280 (inputs
281 `(("libusb" ,libusb)))
282 (home-page "https://github.com/linux-rockchip/rkflashtool")
283 (synopsis "Tools for flashing Rockchip devices")
284 (description "Allows flashing of Rockchip based embedded linux devices.
285The list of currently supported devices is: RK2818, RK2918, RK2928, RK3026,
286RK3036, RK3066, RK312X, RK3168, RK3188, RK3288, RK3368.")
f282aa53
JL
287 (license license:bsd-2))))
288
289(define-public heimdall
290 (package
291 (name "heimdall")
292 (version "1.4.2")
293 (source (origin
294 (method url-fetch)
295 (uri (string-append "https://github.com/Benjamin-Dobell/Heimdall"
296 "/archive/v" version ".tar.gz"))
297 (file-name (string-append name "-" version ".tar.gz"))
298 (sha256
299 (base32
300 "1y7gwg3lipyp2zcysm2vid1qg5nwin9bxbvgzs28lz2rya4fz6sq"))))
301 (build-system cmake-build-system)
302 (arguments
303 `(#:configure-flags '("-DCMAKE_BUILD_TYPE=Release")
304 #:tests? #f; no tests
305 #:phases
306 (modify-phases %standard-phases
307 (add-after 'unpack 'patch-invocations
308 (lambda* (#:key outputs #:allow-other-keys)
309 (substitute* '("heimdall-frontend/source/aboutform.cpp"
310 "heimdall-frontend/source/mainwindow.cpp")
311 (("start[(]\"heimdall\"")
312 (string-append "start(\"" (assoc-ref outputs "out")
313 "/bin/heimdall\"")))
314 #t))
315 (replace 'install
316 (lambda* (#:key outputs #:allow-other-keys)
317 (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
318 (lib (string-append (assoc-ref outputs "out") "/lib")))
319 (install-file "bin/heimdall" bin)
320 (install-file "bin/heimdall-frontend" bin)
321 (install-file "libpit/libpit.a" lib)
322 #t))))))
323 (inputs
324 `(("libusb" ,libusb)
325 ("qtbase" ,qtbase)
326 ("zlib" ,zlib)))
327 (home-page "http://glassechidna.com.au/heimdall/")
328 (synopsis "Flash firmware onto Samsung mobile devices")
329 (description "@command{heimdall} is a tool suite used to flash firmware (aka
330ROMs) onto Samsung mobile devices. Heimdall connects to a mobile device over
331USB and interacts with low-level software running on the device, known as Loke.
332Loke and Heimdall communicate via the custom Samsung-developed protocol typically
333referred to as the \"Odin 3 protocol\".")
334 (license license:expat)))
501e1847
DM
335
336(define-public ifdtool
337 (package
338 (name "ifdtool")
339 (version "4.7")
340 (source (origin
341 (method git-fetch)
342 (uri (git-reference
343 (url "https://review.coreboot.org/p/coreboot")
344 (commit version)))
345 (file-name (git-file-name name version))
346 (sha256
347 (base32
348 "0nw555i0fm5kljha9h47bk70ykbwv8ddfk6qhz6kfqb79vzhy4h2"))))
349 (build-system gnu-build-system)
350 (arguments
351 `(#:make-flags
352 (list "CC=gcc"
353 "INSTALL=install"
354 (string-append "PREFIX=" (assoc-ref %outputs "out")))
355 #:phases
356 (modify-phases %standard-phases
357 (add-after 'unpack 'chdir
358 (lambda _
359 (chdir "util/ifdtool")
360 #t))
361 (delete 'configure)
362 (delete 'check))))
363 (home-page "https://github.com/corna/me_cleaner/")
364 (synopsis "Intel Firmware Descriptor dumper")
365 (description "This package provides @ifdtool}, a program to
366dump Intel Firmware Descriptor data of an image file.")
367 (license license:gpl2)))
9721c0b6
DM
368
369(define-public intelmetool
370 (package
371 (name "intelmetool")
372 (version "4.7")
373 (source (origin
374 (method git-fetch)
375 (uri (git-reference
376 (url "https://review.coreboot.org/p/coreboot")
377 (commit version)))
378 (file-name (git-file-name name version))
379 (sha256
380 (base32
381 "0nw555i0fm5kljha9h47bk70ykbwv8ddfk6qhz6kfqb79vzhy4h2"))))
382 (build-system gnu-build-system)
383 (inputs
384 `(("pciutils" ,pciutils)
385 ("zlib" ,zlib)))
386 (arguments
387 `(#:make-flags
388 (list "CC=gcc"
389 "INSTALL=install"
390 (string-append "PREFIX=" (assoc-ref %outputs "out")))
391 #:phases
392 (modify-phases %standard-phases
393 (add-after 'unpack 'chdir
394 (lambda _
395 (chdir "util/intelmetool")
396 #t))
397 (delete 'configure)
398 (delete 'check))))
399 (home-page "https://github.com/zamaudio/intelmetool")
400 (synopsis "Intel ME tools")
401 (description "This package provides tools for working with Intel
402Management Engine (ME). You need to @code{sudo rmmod mei_me} and
403@code{sudo rmmod mei} before using this tool. Also pass
404@code{iomem=relaxed} to the Linux kernel command line.")
405 (license license:gpl2)))
0297a160
DM
406
407(define-public me-cleaner
408 (package
409 (name "me-cleaner")
410 (version "1.1")
411 (source (origin
412 (method url-fetch)
413 (uri (string-append "https://github.com/corna/me_cleaner/"
414 "archive/v" version ".tar.gz"))
415 (sha256
416 (base32
417 "1pgwdqy0jly80nhxmlmyibs343497yjzs6dwfbkcw0l1gjm8i5hw"))
418 (file-name (string-append name "-" version ".tar.gz"))))
419 (build-system python-build-system)
420 (arguments
421 `(#:phases
422 (modify-phases %standard-phases
423 (add-after 'unpack 'create-setup.py
424 (lambda _
425 (call-with-output-file "setup.py"
426 (lambda (port)
427 (format port "\
428from setuptools import setup
429setup(name='me_cleaner', version='~a', scripts=['me_cleaner.py'])
430" ,version)))
431 #t)))))
432 (home-page "https://github.com/corna/me_cleaner")
433 (synopsis "Intel ME cleaner")
434 (description "This package provides tools for disabling Intel
435ME as far as possible (it only edits ME firmware image files).")
436 (license license:gpl3+)))