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