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
51 ;; XXX: The CFLAGS=... line below can probably be removed when updating.
56 "https://download.flashrom.org/releases/flashrom-"
60 "0r7fkpfc8w51n8ffbhclj4wa3kwrk0ijv1acwpw5myx5bchzl0ip"))))
61 (build-system gnu-build-system)
62 (inputs `(("dmidecode" ,dmidecode)
63 ("pciutils" ,pciutils)
65 ("libftdi" ,libftdi)))
66 (native-inputs `(("pkg-config" ,pkg-config)))
70 ;; The default includes ‘-Wall -Werror’, causing the build to fail
71 ;; with deprecation warnings against libusb versions >= 1.0.22.
73 (string-append "PREFIX=" %output)
74 "CONFIG_ENABLE_LIBUSB0_PROGRAMMERS=no")
75 #:tests? #f ; no 'check' target
77 (modify-phases %standard-phases
78 (delete 'configure) ; no configure script
79 (add-before 'build 'patch-exec-paths
80 (lambda* (#:key inputs #:allow-other-keys)
84 (string-append (assoc-ref inputs "dmidecode")
87 (home-page "https://flashrom.org/")
88 (synopsis "Identify, read, write, erase, and verify ROM/flash chips")
90 "flashrom is a utility for identifying, reading, writing,
91 verifying and erasing flash chips. It is designed to flash
92 BIOS/EFI/coreboot/firmware/optionROM images on mainboards,
93 network/graphics/storage controller cards, and various other
95 (license license:gpl2)))
104 (uri (string-append "https://github.com/pali/0xffff/archive/"
106 (file-name (string-append "0xFFFF" version ".tar.gz" ))
109 "1g4032c81wkk37wvbg1dxcqq6mnd76y9x7f2crmzqi6z4q9jcxmj"))))
110 (build-system gnu-build-system)
112 `(("libusb" ,libusb-0.1))) ; doesn't work with libusb-compat
115 (modify-phases %standard-phases
116 (delete 'configure)) ; no configure
117 #:make-flags (list (string-append "PREFIX=" %output))
118 #:tests? #f)) ; no 'check' target
119 (home-page "https://github.com/pali/0xFFFF")
120 (synopsis "Flash FIASCO images on Maemo devices")
122 "The Open Free Fiasco Firmware Flasher (0xFFFF) is a flashing tool
123 for FIASCO images. It supports generating, unpacking, editing and
124 flashing of FIASCO images for Maemo devices. Use it with care. It can
126 (license license:gpl3+)))
128 (define-public avrdude
135 (uri (string-append "mirror://savannah/avrdude/avrdude-"
139 "0frxg0q09nrm95z7ymzddx7ysl77ilfbdix1m81d9jjpiv5bm64y"))))
140 (build-system gnu-build-system)
143 ("libusb" ,libusb-compat)
144 ("libftdi" ,libftdi)))
148 (home-page "https://www.nongnu.org/avrdude/")
149 (synopsis "AVR downloader and uploader")
151 "AVRDUDE is a utility to download/upload/manipulate the ROM and
152 EEPROM contents of AVR microcontrollers using the in-system programming
154 (license license:gpl2+)))
156 (define-public dfu-programmer
158 (name "dfu-programmer")
163 (uri (string-append "mirror://sourceforge/dfu-programmer/dfu-programmer/"
164 version "/dfu-programmer-" version ".tar.gz"))
167 "15gr99y1z9vbvhrkd25zqhnzhg6zjmaam3vfjzf2mazd39mx7d0x"))
168 (patches (search-patches "dfu-programmer-fix-libusb.patch"))))
169 (build-system gnu-build-system)
171 `(("pkg-config" ,pkg-config)))
173 `(("libusb" ,libusb)))
174 (home-page "http://dfu-programmer.github.io/")
175 (synopsis "Device firmware update programmer for Atmel chips")
177 "Dfu-programmer is a multi-platform command-line programmer for
178 Atmel (8051, AVR, XMEGA & AVR32) chips with a USB bootloader supporting
180 (license license:gpl2+)))
182 (define-public dfu-util
189 "http://dfu-util.sourceforge.net/releases/dfu-util-"
193 "0czq73m92ngf30asdzrfkzraag95hlrr74imbanqq25kdim8qhin"))))
194 (build-system gnu-build-system)
196 `(("libusb" ,libusb)))
198 `(("pkg-config" ,pkg-config)))
199 (synopsis "Host side of the USB Device Firmware Upgrade (DFU) protocol")
201 "The DFU (Universal Serial Bus Device Firmware Upgrade) protocol is
202 intended to download and upload firmware to devices connected over USB. It
203 ranges from small devices like micro-controller boards up to mobile phones.
204 With dfu-util you are able to download firmware to your device or upload
206 (home-page "http://dfu-util.sourceforge.net/")
207 (license license:gpl2+)))
209 (define-public teensy-loader-cli
210 ;; The repo does not tag versions nor does it use releases, but a commit
211 ;; message says "Importing 2.1", while the sourcce still says "2.0". So pin
212 ;; to a fixed commit.
213 (let ((commit "f289b7a2e5627464044249f0e5742830e052e360"))
215 (name "teensy-loader-cli")
216 (version (string-append "2.1-1." (string-take commit 7)))
220 (uri (string-append "https://github.com/PaulStoffregen/"
221 "teensy_loader_cli/archive/" commit ".tar.gz"))
222 (sha256 (base32 "17wqc2q4fa473cy7f5m2yiyb9nq0qw7xal2kzrxzaikgm9rabsw8"))
223 (file-name (string-append "teensy-loader-cli-" version ".tar.gz" ))
224 (modules '((guix build utils)))
227 ;; Remove example flash files and teensy rebooter flash binaries.
228 (for-each delete-file (find-files "." "\\.(elf|hex)$"))
230 (substitute* "teensy_loader_cli.c"
231 (("Teensy Loader, Command Line, Version 2.0\\\\n")
232 (string-append "Teensy Loader, Command Line, " ,version "\\n")))
234 (patches (search-patches "teensy-loader-cli-help.patch"))))
235 (build-system gnu-build-system)
237 '(#:tests? #f ;; Makefile has no test target
238 #:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
240 (modify-phases %standard-phases
243 (lambda* (#:key outputs #:allow-other-keys)
244 (let* ((out (assoc-ref outputs "out"))
245 (bin (string-append out "/bin")))
246 (install-file "teensy_loader_cli" bin)
249 `(("libusb-compat" ,libusb-compat)))
250 (synopsis "Command line firmware uploader for Teensy development boards")
252 "The Teensy loader program communicates with your Teensy board when the
253 HalfKay bootloader is running, so you can upload new programs and run them.
255 You need to add the udev rules to make the Teensy update available for
257 (home-page "https://www.pjrc.com/teensy/loader_cli.html")
258 (license license:gpl3))))
260 (define-public rkflashtool
261 (let ((commit "094bd6410cb016e487e2ccb1050c59eeac2e6dd1")
265 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
270 (url "https://github.com/linux-rockchip/rkflashtool.git")
272 (file-name (string-append name "-" version "-checkout"))
275 "1zkd8zxir3rfg3sy9r20bcnxclnplryn583gqpcr3iad0k3xbah7"))))
276 (build-system gnu-build-system)
279 (modify-phases %standard-phases
280 (delete 'configure)) ; no configure
281 #:make-flags (list (string-append "PREFIX=" %output))
282 #:tests? #f)) ; no tests
284 `(("pkg-config" ,pkg-config)))
286 `(("libusb" ,libusb)))
287 (home-page "https://github.com/linux-rockchip/rkflashtool")
288 (synopsis "Tools for flashing Rockchip devices")
289 (description "Allows flashing of Rockchip based embedded linux devices.
290 The list of currently supported devices is: RK2818, RK2918, RK2928, RK3026,
291 RK3036, RK3066, RK312X, RK3168, RK3188, RK3288, RK3368.")
292 (license license:bsd-2))))
294 (define-public heimdall
300 (uri (string-append "https://github.com/Benjamin-Dobell/Heimdall"
301 "/archive/v" version ".tar.gz"))
302 (file-name (string-append name "-" version ".tar.gz"))
305 "1y7gwg3lipyp2zcysm2vid1qg5nwin9bxbvgzs28lz2rya4fz6sq"))))
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 "http://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://review.coreboot.org/p/coreboot")
350 (file-name (git-file-name name version))
353 "0nw555i0fm5kljha9h47bk70ykbwv8ddfk6qhz6kfqb79vzhy4h2"))))
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")
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
421 (uri (string-append "https://github.com/corna/me_cleaner/"
422 "archive/v" version ".tar.gz"))
425 "1pgwdqy0jly80nhxmlmyibs343497yjzs6dwfbkcw0l1gjm8i5hw"))
426 (file-name (string-append name "-" version ".tar.gz"))))
427 (build-system python-build-system)
430 (modify-phases %standard-phases
431 (add-after 'unpack 'create-setup.py
433 (call-with-output-file "setup.py"
436 from setuptools import setup
437 setup(name='me_cleaner', version='~a', scripts=['me_cleaner.py'])
440 (home-page "https://github.com/corna/me_cleaner")
441 (synopsis "Intel ME cleaner")
442 (description "This package provides tools for disabling Intel
443 ME as far as possible (it only edits ME firmware image files).")
444 (license license:gpl3+)
446 ;; This is an Intel thing.
447 (supported-systems '("x86_64-linux" "i686-linux"))))
449 (define-public uefitool
455 (uri (string-append "https://github.com/LongSoft/UEFITool/archive/"
459 "05jmhv7jpq08kqbd1477y1lgyjvcic3njrd0bmzdy7v7b7lnhl82"))
460 (file-name (string-append name "-" version ".tar.gz"))))
461 (build-system gnu-build-system)
464 (modify-phases %standard-phases
467 (invoke "qmake" "-makefile")))
469 (lambda* (#:key outputs #:allow-other-keys)
470 (install-file "UEFITool" (string-append (assoc-ref outputs "out")
474 `(("qtbase" ,qtbase)))
475 (home-page "https://github.com/LongSoft/UEFITool/")
476 (synopsis "UEFI image editor")
477 (description "@code{uefitool} is a graphical image file editor for
478 Unifinished Extensible Firmware Interface (UEFI) images.")
479 (license license:bsd-2)))