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>
11 ;;; This file is part of GNU Guix.
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.
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.
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/>.
26 (define-module (gnu packages flashing-tools)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module (guix packages)
31 #:use-module (gnu packages)
32 #:use-module (guix build-system cmake)
33 #:use-module (guix build-system gnu)
34 #:use-module (guix build-system python)
35 #:use-module (gnu packages bison)
36 #:use-module (gnu packages compression)
37 #:use-module (gnu packages flex)
38 #:use-module (gnu packages elf)
39 #:use-module (gnu packages pciutils)
40 #:use-module (gnu packages pkg-config)
41 #:use-module (gnu packages libusb)
42 #:use-module (gnu packages libftdi)
43 #:use-module (gnu packages pciutils)
44 #:use-module (gnu packages qt)
45 #:use-module (gnu packages autotools)
46 #:use-module (gnu packages admin))
48 (define-public flashrom
55 "https://download.flashrom.org/releases/flashrom-v"
59 "0ax4kqnh7kd3z120ypgp73qy1knz47l6qxsqzrfkd97mh5cdky71"))))
60 (build-system gnu-build-system)
61 (inputs `(("dmidecode" ,dmidecode)
62 ("pciutils" ,pciutils)
64 ("libftdi" ,libftdi)))
65 (native-inputs `(("pkg-config" ,pkg-config)))
69 (string-append "PREFIX=" %output)
70 "CONFIG_ENABLE_LIBUSB0_PROGRAMMERS=no")
71 #:tests? #f ; no 'check' target
73 (modify-phases %standard-phases
74 (delete 'configure) ; no configure script
75 (add-before 'build 'patch-exec-paths
76 (lambda* (#:key inputs #:allow-other-keys)
80 (string-append (assoc-ref inputs "dmidecode")
83 (home-page "https://flashrom.org/")
84 (synopsis "Identify, read, write, erase, and verify ROM/flash chips")
86 "flashrom is a utility for identifying, reading, writing,
87 verifying and erasing flash chips. It is designed to flash
88 BIOS/EFI/coreboot/firmware/optionROM images on mainboards,
89 network/graphics/storage controller cards, and various other
91 (license license:gpl2)))
101 (url "https://github.com/pali/0xffff")
103 (file-name (git-file-name name version))
105 (base32 "1a5b7k96vzirb0m8lqp7ldn77ppz4ngf56wslhsj2c6flcyvns4v"))))
106 (build-system gnu-build-system)
108 `(("libusb" ,libusb-0.1))) ; doesn't work with libusb-compat
111 (modify-phases %standard-phases
112 (delete 'configure)) ; no configure
115 "BUILD_DATE=GNU Guix"
116 (string-append "PREFIX=" %output))
117 #:tests? #f)) ; no 'check' target
118 (home-page "https://github.com/pali/0xFFFF")
119 (synopsis "Flash FIASCO images on Maemo devices")
121 "The Open Free Fiasco Firmware Flasher (0xFFFF) is a flashing tool
122 for FIASCO images. It supports generating, unpacking, editing and
123 flashing of FIASCO images for Maemo devices. Use it with care. It can
125 (license license:gpl3+)))
127 (define-public avrdude
134 (uri (string-append "mirror://savannah/avrdude/avrdude-"
137 (base32 "15m1w1qad3dj7r8n5ng1qqcaiyx1gyd6hnc3p2apgjllccdp77qg"))))
138 (build-system gnu-build-system)
141 ("libusb" ,libusb-compat)
142 ("libftdi" ,libftdi)))
146 (home-page "https://www.nongnu.org/avrdude/")
147 (synopsis "AVR downloader and uploader")
149 "AVRDUDE is a utility to download/upload/manipulate the ROM and
150 EEPROM contents of AVR microcontrollers using the @acronym{ISP, in-system
151 programming} technique.")
152 (license license:gpl2+)))
154 (define-public dfu-programmer
156 (name "dfu-programmer")
161 (uri (string-append "mirror://sourceforge/dfu-programmer/dfu-programmer/"
162 version "/dfu-programmer-" version ".tar.gz"))
165 "15gr99y1z9vbvhrkd25zqhnzhg6zjmaam3vfjzf2mazd39mx7d0x"))
166 (patches (search-patches "dfu-programmer-fix-libusb.patch"))))
167 (build-system gnu-build-system)
169 `(("pkg-config" ,pkg-config)))
171 `(("libusb" ,libusb)))
172 (home-page "https://dfu-programmer.github.io/")
173 (synopsis "Device firmware update programmer for Atmel chips")
175 "Dfu-programmer is a multi-platform command-line programmer for
176 Atmel (8051, AVR, XMEGA & AVR32) chips with a USB bootloader supporting
178 (license license:gpl2+)))
180 (define-public dfu-util
187 "http://dfu-util.sourceforge.net/releases/dfu-util-"
191 "0czq73m92ngf30asdzrfkzraag95hlrr74imbanqq25kdim8qhin"))))
192 (build-system gnu-build-system)
194 `(("libusb" ,libusb)))
196 `(("pkg-config" ,pkg-config)))
197 (synopsis "Host side of the USB Device Firmware Upgrade (DFU) protocol")
199 "The DFU (Universal Serial Bus Device Firmware Upgrade) protocol is
200 intended to download and upload firmware to devices connected over USB. It
201 ranges from small devices like micro-controller boards up to mobile phones.
202 With dfu-util you are able to download firmware to your device or upload
204 (home-page "http://dfu-util.sourceforge.net/")
205 (license license:gpl2+)))
207 (define-public teensy-loader-cli
208 ;; The repo does not tag versions nor does it use releases, but a commit
209 ;; message says "Importing 2.1", while the sourcce still says "2.0". So pin
210 ;; to a fixed commit.
211 (let ((commit "f289b7a2e5627464044249f0e5742830e052e360"))
213 (name "teensy-loader-cli")
214 (version (git-version "2.1" "1" commit))
219 (url "https://github.com/PaulStoffregen/teensy_loader_cli")
221 (sha256 (base32 "0sssim56pwsxp5cp5dlf6mi9h5fx2592m6j1g7abnm0s09b0lpdx"))
222 (file-name (git-file-name name version))
223 (modules '((guix build utils)))
226 ;; Remove example flash files and teensy rebooter flash binaries.
227 (for-each delete-file (find-files "." "\\.(elf|hex)$"))
229 (substitute* "teensy_loader_cli.c"
230 (("Teensy Loader, Command Line, Version 2.0\\\\n")
231 (string-append "Teensy Loader, Command Line, " ,version "\\n")))
233 (patches (search-patches "teensy-loader-cli-help.patch"))))
234 (build-system gnu-build-system)
236 '(#:tests? #f ;; Makefile has no test target
237 #:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
239 (modify-phases %standard-phases
242 (lambda* (#:key outputs #:allow-other-keys)
243 (let* ((out (assoc-ref outputs "out"))
244 (bin (string-append out "/bin")))
245 (install-file "teensy_loader_cli" bin)
248 `(("libusb-compat" ,libusb-compat)))
249 (synopsis "Command line firmware uploader for Teensy development boards")
251 "The Teensy loader program communicates with your Teensy board when the
252 HalfKay bootloader is running, so you can upload new programs and run them.
254 You need to add the udev rules to make the Teensy update available for
256 (home-page "https://www.pjrc.com/teensy/loader_cli.html")
257 (license license:gpl3))))
259 (define-public rkflashtool
260 (let ((commit "8966c4e277de8148290554aaaa4146a3a84a3c53")
264 (version (git-version "5.2" revision commit))
269 (url "https://github.com/linux-rockchip/rkflashtool")
271 (file-name (git-file-name name version))
274 "1ndyzg1zlgg20dd8js9kfqm5kq19k005vddkvf65qj20w0pcyahn"))))
275 (build-system gnu-build-system)
278 (modify-phases %standard-phases
279 (delete 'configure)) ; no configure
280 #:make-flags (list (string-append "PREFIX=" %output))
281 #:tests? #f)) ; no tests
283 `(("pkg-config" ,pkg-config)))
285 `(("libusb" ,libusb)))
286 (home-page "https://github.com/linux-rockchip/rkflashtool")
287 (synopsis "Tools for flashing Rockchip devices")
288 (description "Allows flashing of Rockchip based embedded linux devices.
289 The list of currently supported devices is: RK2818, RK2918, RK2928, RK3026,
290 RK3036, RK3066, RK312X, RK3168, RK3188, RK3288, RK3368.")
291 (license license:bsd-2))))
293 (define-public heimdall
300 (url "https://gitlab.com/BenjaminDobell/Heimdall.git")
301 (commit (string-append "v" version))))
302 (file-name (git-file-name name version))
305 "1ygn4snvcmi98rgldgxf5hwm7zzi1zcsihfvm6awf9s6mpcjzbqz"))))
306 (build-system cmake-build-system)
308 `(#:build-type "Release"
309 #:tests? #f ; no tests
311 (modify-phases %standard-phases
312 (add-after 'unpack 'patch-invocations
313 (lambda* (#:key outputs #:allow-other-keys)
314 (substitute* '("heimdall-frontend/source/aboutform.cpp"
315 "heimdall-frontend/source/mainwindow.cpp")
316 (("start[(]\"heimdall\"")
317 (string-append "start(\"" (assoc-ref outputs "out")
321 (lambda* (#:key outputs #:allow-other-keys)
322 (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
323 (lib (string-append (assoc-ref outputs "out") "/lib")))
324 (install-file "bin/heimdall" bin)
325 (install-file "bin/heimdall-frontend" bin)
326 (install-file "libpit/libpit.a" lib)
332 (home-page "https://glassechidna.com.au/heimdall/")
333 (synopsis "Flash firmware onto Samsung mobile devices")
334 (description "@command{heimdall} is a tool suite used to flash firmware (aka
335 ROMs) onto Samsung mobile devices. Heimdall connects to a mobile device over
336 USB and interacts with low-level software running on the device, known as Loke.
337 Loke and Heimdall communicate via the custom Samsung-developed protocol typically
338 referred to as the \"Odin 3 protocol\".")
339 (license license:expat)))
341 (define-public ifdtool
348 (url "https://github.com/coreboot/coreboot")
350 (file-name (git-file-name name version))
353 "0jidj29jh6p65d17k304wlzhxvp4p3c2namgcdwg2sxq8jfr0zlm"))))
354 (build-system gnu-build-system)
359 (string-append "PREFIX=" (assoc-ref %outputs "out")))
361 (modify-phases %standard-phases
362 (add-after 'unpack 'chdir
364 (chdir "util/ifdtool")
366 (delete 'configure)) ; no configure script
367 #:tests? #f)) ; no test suite
368 (home-page "https://github.com/corna/me_cleaner/")
369 (synopsis "Intel Firmware Descriptor dumper")
370 (description "This package provides @command{ifdtool}, a program to
371 dump Intel Firmware Descriptor data of an image file.")
372 (license license:gpl2)))
374 (define-public intelmetool
381 (url "https://review.coreboot.org/p/coreboot")
383 (file-name (git-file-name name version))
386 "0nw555i0fm5kljha9h47bk70ykbwv8ddfk6qhz6kfqb79vzhy4h2"))))
387 (build-system gnu-build-system)
389 `(("pciutils" ,pciutils)
395 (string-append "PREFIX=" (assoc-ref %outputs "out")))
397 (modify-phases %standard-phases
398 (add-after 'unpack 'chdir
400 (chdir "util/intelmetool")
404 (home-page "https://github.com/zamaudio/intelmetool")
405 (synopsis "Intel Management Engine tools")
406 (description "This package provides tools for working with Intel
407 Management Engine (ME). You need to @code{sudo rmmod mei_me} and
408 @code{sudo rmmod mei} before using this tool. Also pass
409 @code{iomem=relaxed} to the Linux kernel command line.")
410 (license license:gpl2)
412 ;; This is obviously an Intel thing, plus it requires <cpuid.h>.
413 (supported-systems '("x86_64-linux" "i686-linux"))))
415 (define-public me-cleaner
422 (url "https://github.com/corna/me_cleaner")
423 (commit (string-append "v" version))))
426 "1bdj2clm13ir441vn7sv860xsc5gh71ja5lc2wn0gggnff0adxj4"))
427 (file-name (git-file-name name version))))
428 (build-system python-build-system)
431 (modify-phases %standard-phases
432 (add-after 'install 'install-documentation
433 (lambda* (#:key outputs #:allow-other-keys)
434 (let* ((out (assoc-ref outputs "out"))
435 (man (string-append out "/share/man/man1")))
436 (install-file "man/me_cleaner.1" man)
438 (home-page "https://github.com/corna/me_cleaner")
439 (synopsis "Intel ME cleaner")
440 (description "This package provides tools for disabling Intel
441 ME as far as possible (it only edits ME firmware image files).")
442 (license license:gpl3+)
444 ;; This is an Intel thing.
445 (supported-systems '("x86_64-linux" "i686-linux"))))
447 (define-public uefitool
454 (url "https://github.com/LongSoft/UEFITool")
458 "1i1p823qld927p4f1wcphqcnivb9mq7fi5xmzibxc3g9zzgnyc2h"))
459 (file-name (git-file-name name version))))
460 (build-system gnu-build-system)
463 (modify-phases %standard-phases
466 (invoke "qmake" "-makefile")))
468 (lambda* (#:key outputs #:allow-other-keys)
469 (install-file "UEFITool" (string-append (assoc-ref outputs "out")
473 `(("qtbase" ,qtbase)))
474 (home-page "https://github.com/LongSoft/UEFITool/")
475 (synopsis "UEFI image editor")
476 (description "@code{uefitool} is a graphical image file editor for
477 Unifinished Extensible Firmware Interface (UEFI) images.")
478 (license license:bsd-2)))