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 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 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-"
59 "0r7fkpfc8w51n8ffbhclj4wa3kwrk0ijv1acwpw5myx5bchzl0ip"))))
60 (build-system gnu-build-system)
61 (inputs `(("dmidecode" ,dmidecode)
62 ("pciutils" ,pciutils)
64 ("libftdi" ,libftdi)))
65 (native-inputs `(("pkg-config" ,pkg-config)))
67 '(#:make-flags (list "CC=gcc"
68 (string-append "PREFIX=" %output)
69 "CONFIG_ENABLE_LIBUSB0_PROGRAMMERS=no")
70 #:tests? #f ; no 'check' target
72 (modify-phases %standard-phases
73 (delete 'configure) ; no configure script
74 (add-before 'build 'patch-exec-paths
75 (lambda* (#:key inputs #:allow-other-keys)
79 (string-append (assoc-ref inputs "dmidecode")
82 (home-page "https://flashrom.org/")
83 (synopsis "Identify, read, write, erase, and verify ROM/flash chips")
85 "flashrom is a utility for identifying, reading, writing,
86 verifying and erasing flash chips. It is designed to flash
87 BIOS/EFI/coreboot/firmware/optionROM images on mainboards,
88 network/graphics/storage controller cards, and various other
90 (license license:gpl2)))
99 (uri (string-append "https://github.com/pali/0xffff/archive/"
101 (file-name (string-append "0xFFFF" version ".tar.gz" ))
104 "1g4032c81wkk37wvbg1dxcqq6mnd76y9x7f2crmzqi6z4q9jcxmj"))))
105 (build-system gnu-build-system)
107 `(("libusb" ,libusb-0.1))) ; doesn't work with libusb-compat
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")
117 "The Open Free Fiasco Firmware Flasher (0xFFFF) is a flashing tool
118 for FIASCO images. It supports generating, unpacking, editing and
119 flashing of FIASCO images for Maemo devices. Use it with care. It can
121 (license license:gpl3+)))
123 (define-public avrdude
130 (uri (string-append "mirror://savannah/avrdude/avrdude-"
134 "0frxg0q09nrm95z7ymzddx7ysl77ilfbdix1m81d9jjpiv5bm64y"))))
135 (build-system gnu-build-system)
138 ("libusb" ,libusb-compat)
139 ("libftdi" ,libftdi)))
143 (home-page "https://www.nongnu.org/avrdude/")
144 (synopsis "AVR downloader and uploader")
146 "AVRDUDE is a utility to download/upload/manipulate the ROM and
147 EEPROM contents of AVR microcontrollers using the in-system programming
149 (license license:gpl2+)))
151 (define-public dfu-programmer
153 (name "dfu-programmer")
158 (uri (string-append "mirror://sourceforge/dfu-programmer/dfu-programmer/"
159 version "/dfu-programmer-" version ".tar.gz"))
162 "15gr99y1z9vbvhrkd25zqhnzhg6zjmaam3vfjzf2mazd39mx7d0x"))
163 (patches (search-patches "dfu-programmer-fix-libusb.patch"))))
164 (build-system gnu-build-system)
166 `(("pkg-config" ,pkg-config)))
168 `(("libusb" ,libusb)))
169 (home-page "http://dfu-programmer.github.io/")
170 (synopsis "Device firmware update programmer for Atmel chips")
172 "Dfu-programmer is a multi-platform command-line programmer for
173 Atmel (8051, AVR, XMEGA & AVR32) chips with a USB bootloader supporting
175 (license license:gpl2+)))
177 (define-public dfu-util
184 "http://dfu-util.sourceforge.net/releases/dfu-util-"
188 "0czq73m92ngf30asdzrfkzraag95hlrr74imbanqq25kdim8qhin"))))
189 (build-system gnu-build-system)
191 `(("libusb" ,libusb)))
193 `(("pkg-config" ,pkg-config)))
194 (synopsis "Host side of the USB Device Firmware Upgrade (DFU) protocol")
196 "The DFU (Universal Serial Bus Device Firmware Upgrade) protocol is
197 intended to download and upload firmware to devices connected over USB. It
198 ranges from small devices like micro-controller boards up to mobile phones.
199 With dfu-util you are able to download firmware to your device or upload
201 (home-page "http://dfu-util.sourceforge.net/")
202 (license license:gpl2+)))
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"))
210 (name "teensy-loader-cli")
211 (version (string-append "2.1-1." (string-take commit 7)))
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)))
222 ;; Remove example flash files and teensy rebooter flash binaries.
223 (for-each delete-file (find-files "." "\\.(elf|hex)$"))
225 (substitute* "teensy_loader_cli.c"
226 (("Teensy Loader, Command Line, Version 2.0\\\\n")
227 (string-append "Teensy Loader, Command Line, " ,version "\\n")))
229 (patches (search-patches "teensy-loader-cli-help.patch"))))
230 (build-system gnu-build-system)
232 '(#:tests? #f ;; Makefile has no test target
233 #:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
235 (modify-phases %standard-phases
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)
244 `(("libusb-compat" ,libusb-compat)))
245 (synopsis "Command line firmware uploader for Teensy development boards")
247 "The Teensy loader program communicates with your Teensy board when the
248 HalfKay bootloader is running, so you can upload new programs and run them.
250 You need to add the udev rules to make the Teensy update available for
252 (home-page "https://www.pjrc.com/teensy/loader_cli.html")
253 (license license:gpl3))))
255 (define-public rkflashtool
256 (let ((commit "094bd6410cb016e487e2ccb1050c59eeac2e6dd1")
260 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
265 (url "https://github.com/linux-rockchip/rkflashtool.git")
267 (file-name (string-append name "-" version "-checkout"))
270 "1zkd8zxir3rfg3sy9r20bcnxclnplryn583gqpcr3iad0k3xbah7"))))
271 (build-system gnu-build-system)
274 (modify-phases %standard-phases
275 (delete 'configure)) ; no configure
276 #:make-flags (list (string-append "PREFIX=" %output))
277 #:tests? #f)) ; no tests
279 `(("pkg-config" ,pkg-config)))
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.
285 The list of currently supported devices is: RK2818, RK2918, RK2928, RK3026,
286 RK3036, RK3066, RK312X, RK3168, RK3188, RK3288, RK3368.")
287 (license license:bsd-2))))
289 (define-public heimdall
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"))
300 "1y7gwg3lipyp2zcysm2vid1qg5nwin9bxbvgzs28lz2rya4fz6sq"))))
301 (build-system cmake-build-system)
303 `(#:configure-flags '("-DCMAKE_BUILD_TYPE=Release")
304 #:tests? #f; no tests
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")
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)
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
330 ROMs) onto Samsung mobile devices. Heimdall connects to a mobile device over
331 USB and interacts with low-level software running on the device, known as Loke.
332 Loke and Heimdall communicate via the custom Samsung-developed protocol typically
333 referred to as the \"Odin 3 protocol\".")
334 (license license:expat)))
336 (define-public ifdtool
343 (url "https://review.coreboot.org/p/coreboot")
345 (file-name (git-file-name name version))
348 "0nw555i0fm5kljha9h47bk70ykbwv8ddfk6qhz6kfqb79vzhy4h2"))))
349 (build-system gnu-build-system)
354 (string-append "PREFIX=" (assoc-ref %outputs "out")))
356 (modify-phases %standard-phases
357 (add-after 'unpack 'chdir
359 (chdir "util/ifdtool")
363 (home-page "https://github.com/corna/me_cleaner/")
364 (synopsis "Intel Firmware Descriptor dumper")
365 (description "This package provides @command{ifdtool}, a program to
366 dump Intel Firmware Descriptor data of an image file.")
367 (license license:gpl2)))
369 (define-public intelmetool
376 (url "https://review.coreboot.org/p/coreboot")
378 (file-name (git-file-name name version))
381 "0nw555i0fm5kljha9h47bk70ykbwv8ddfk6qhz6kfqb79vzhy4h2"))))
382 (build-system gnu-build-system)
384 `(("pciutils" ,pciutils)
390 (string-append "PREFIX=" (assoc-ref %outputs "out")))
392 (modify-phases %standard-phases
393 (add-after 'unpack 'chdir
395 (chdir "util/intelmetool")
399 (home-page "https://github.com/zamaudio/intelmetool")
400 (synopsis "Intel Management Engine tools")
401 (description "This package provides tools for working with Intel
402 Management 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)
407 ;; This is obviously an Intel thing, plus it requires <cpuid.h>.
408 (supported-systems '("x86_64-linux" "i686-linux"))))
410 (define-public me-cleaner
416 (uri (string-append "https://github.com/corna/me_cleaner/"
417 "archive/v" version ".tar.gz"))
420 "1pgwdqy0jly80nhxmlmyibs343497yjzs6dwfbkcw0l1gjm8i5hw"))
421 (file-name (string-append name "-" version ".tar.gz"))))
422 (build-system python-build-system)
425 (modify-phases %standard-phases
426 (add-after 'unpack 'create-setup.py
428 (call-with-output-file "setup.py"
431 from setuptools import setup
432 setup(name='me_cleaner', version='~a', scripts=['me_cleaner.py'])
435 (home-page "https://github.com/corna/me_cleaner")
436 (synopsis "Intel ME cleaner")
437 (description "This package provides tools for disabling Intel
438 ME as far as possible (it only edits ME firmware image files).")
439 (license license:gpl3+)
441 ;; This is an Intel thing.
442 (supported-systems '("x86_64-linux" "i686-linux"))))