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>
12 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
54 (define-public flashrom
61 "https://download.flashrom.org/releases/flashrom-v"
65 "0ax4kqnh7kd3z120ypgp73qy1knz47l6qxsqzrfkd97mh5cdky71"))))
66 (build-system gnu-build-system)
67 (inputs `(("dmidecode" ,dmidecode)
68 ("pciutils" ,pciutils)
70 ("libftdi" ,libftdi)))
71 (native-inputs `(("pkg-config" ,pkg-config)))
75 (string-append "PREFIX=" %output)
76 "CONFIG_ENABLE_LIBUSB0_PROGRAMMERS=no")
77 #:tests? #f ; no 'check' target
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)
86 (string-append (assoc-ref inputs "dmidecode")
89 (home-page "https://flashrom.org/")
90 (synopsis "Identify, read, write, erase, and verify ROM/flash chips")
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
97 (license license:gpl2)))
107 (url "https://github.com/pali/0xffff")
109 (file-name (git-file-name name version))
111 (base32 "1a5b7k96vzirb0m8lqp7ldn77ppz4ngf56wslhsj2c6flcyvns4v"))))
112 (build-system gnu-build-system)
114 `(("libusb" ,libusb-0.1))) ; doesn't work with libusb-compat
117 (modify-phases %standard-phases
118 (delete 'configure)) ; no configure
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")
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
131 (license license:gpl3+)))
133 (define-public avrdude
140 (uri (string-append "mirror://savannah/avrdude/avrdude-"
143 (base32 "15m1w1qad3dj7r8n5ng1qqcaiyx1gyd6hnc3p2apgjllccdp77qg"))))
144 (build-system gnu-build-system)
147 ("libusb" ,libusb-compat)
148 ("libftdi" ,libftdi)))
152 (home-page "https://www.nongnu.org/avrdude/")
153 (synopsis "AVR downloader and uploader")
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+)))
160 (define-public dfu-programmer
162 (name "dfu-programmer")
167 (uri (string-append "mirror://sourceforge/dfu-programmer/dfu-programmer/"
168 version "/dfu-programmer-" version ".tar.gz"))
171 "15gr99y1z9vbvhrkd25zqhnzhg6zjmaam3vfjzf2mazd39mx7d0x"))
172 (patches (search-patches "dfu-programmer-fix-libusb.patch"))))
173 (build-system gnu-build-system)
175 `(("pkg-config" ,pkg-config)))
177 `(("libusb" ,libusb)))
178 (home-page "https://dfu-programmer.github.io/")
179 (synopsis "Device firmware update programmer for Atmel chips")
181 "Dfu-programmer is a multi-platform command-line programmer for
182 Atmel (8051, AVR, XMEGA & AVR32) chips with a USB bootloader supporting
184 (license license:gpl2+)))
186 (define-public dfu-util
193 "http://dfu-util.sourceforge.net/releases/dfu-util-"
197 "0hlvc47ccf5hry13saqhc1j5cdq5jyjv4i05kj0mdh3rzj6wagd0"))))
198 (build-system gnu-build-system)
200 `(("libusb" ,libusb)))
202 `(("pkg-config" ,pkg-config)))
203 (synopsis "Host side of the USB Device Firmware Upgrade (DFU) protocol")
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
210 (home-page "http://dfu-util.sourceforge.net/")
211 (license license:gpl2+)))
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"))
219 (name "teensy-loader-cli")
220 (version (git-version "2.1" "1" commit))
225 (url "https://github.com/PaulStoffregen/teensy_loader_cli")
227 (sha256 (base32 "0sssim56pwsxp5cp5dlf6mi9h5fx2592m6j1g7abnm0s09b0lpdx"))
228 (file-name (git-file-name name version))
229 (modules '((guix build utils)))
232 ;; Remove example flash files and teensy rebooter flash binaries.
233 (for-each delete-file (find-files "." "\\.(elf|hex)$"))
235 (substitute* "teensy_loader_cli.c"
236 (("Teensy Loader, Command Line, Version 2.0\\\\n")
237 (string-append "Teensy Loader, Command Line, " ,version "\\n")))
239 (patches (search-patches "teensy-loader-cli-help.patch"))))
240 (build-system gnu-build-system)
242 '(#:tests? #f ;; Makefile has no test target
243 #:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
245 (modify-phases %standard-phases
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)
254 `(("libusb-compat" ,libusb-compat)))
255 (synopsis "Command line firmware uploader for Teensy development boards")
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.
260 You need to add the udev rules to make the Teensy update available for
262 (home-page "https://www.pjrc.com/teensy/loader_cli.html")
263 (license license:gpl3))))
265 (define-public rkflashtool
266 (let ((commit "8966c4e277de8148290554aaaa4146a3a84a3c53")
270 (version (git-version "5.2" revision commit))
275 (url "https://github.com/linux-rockchip/rkflashtool")
277 (file-name (git-file-name name version))
280 "1ndyzg1zlgg20dd8js9kfqm5kq19k005vddkvf65qj20w0pcyahn"))))
281 (build-system gnu-build-system)
284 (modify-phases %standard-phases
285 (delete 'configure)) ; no configure
286 #:make-flags (list (string-append "PREFIX=" %output))
287 #:tests? #f)) ; no tests
289 `(("pkg-config" ,pkg-config)))
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))))
299 (define-public heimdall
306 (url "https://gitlab.com/BenjaminDobell/Heimdall.git")
307 (commit (string-append "v" version))))
308 (file-name (git-file-name name version))
311 "1ygn4snvcmi98rgldgxf5hwm7zzi1zcsihfvm6awf9s6mpcjzbqz"))))
312 (build-system cmake-build-system)
314 `(#:build-type "Release"
315 #:tests? #f ; no tests
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")
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)
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)))
347 (define-public ifdtool
354 (url "https://github.com/coreboot/coreboot")
356 (file-name (git-file-name name version))
359 "0jidj29jh6p65d17k304wlzhxvp4p3c2namgcdwg2sxq8jfr0zlm"))))
360 (build-system gnu-build-system)
365 (string-append "PREFIX=" (assoc-ref %outputs "out")))
367 (modify-phases %standard-phases
368 (add-after 'unpack 'chdir
370 (chdir "util/ifdtool")
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)))
380 (define-public intelmetool
387 (url "https://review.coreboot.org/p/coreboot")
389 (file-name (git-file-name name version))
392 "0nw555i0fm5kljha9h47bk70ykbwv8ddfk6qhz6kfqb79vzhy4h2"))))
393 (build-system gnu-build-system)
395 `(("pciutils" ,pciutils)
401 (string-append "PREFIX=" (assoc-ref %outputs "out")))
403 (modify-phases %standard-phases
404 (add-after 'unpack 'chdir
406 (chdir "util/intelmetool")
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)
418 ;; This is obviously an Intel thing, plus it requires <cpuid.h>.
419 (supported-systems '("x86_64-linux" "i686-linux"))))
421 (define-public me-cleaner
428 (url "https://github.com/corna/me_cleaner")
429 (commit (string-append "v" version))))
432 "1bdj2clm13ir441vn7sv860xsc5gh71ja5lc2wn0gggnff0adxj4"))
433 (file-name (git-file-name name version))))
434 (build-system python-build-system)
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)
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+)
450 ;; This is an Intel thing.
451 (supported-systems '("x86_64-linux" "i686-linux"))))
453 (define-public uefitool
460 (url "https://github.com/LongSoft/UEFITool")
464 "1i1p823qld927p4f1wcphqcnivb9mq7fi5xmzibxc3g9zzgnyc2h"))
465 (file-name (git-file-name name version))))
466 (build-system gnu-build-system)
469 (modify-phases %standard-phases
472 (invoke "qmake" "-makefile")))
474 (lambda* (#:key outputs #:allow-other-keys)
475 (install-file "UEFITool" (string-append (assoc-ref outputs "out")
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)))
486 (define-public srecord
493 (uri (string-append "mirror://sourceforge/srecord/srecord/"
494 version "/srecord-" version ".tar.gz"))
497 "1qk75q0k5vzmm3932q9hqz2gp8n9rrdfjacsswxc02656f3l3929"))))
498 (build-system gnu-build-system)
501 (list (string-append "SH="
502 (assoc-ref %build-inputs "bash")
506 ("libgcrypt" ,libgcrypt)))
509 ("diffutils" ,diffutils)
510 ("ghostscript" ,ghostscript)
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+)))