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 Ludovic Courtès <ludo@gnu.org>
6 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2017 Jonathan Brielmaier <jonathan.brielmaier@web.de>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages flashing-tools)
25 #:use-module (guix licenses)
26 #:use-module (guix download)
27 #:use-module (guix git-download)
28 #:use-module (guix packages)
29 #:use-module (gnu packages)
30 #:use-module (guix build-system gnu)
31 #:use-module (gnu packages bison)
32 #:use-module (gnu packages flex)
33 #:use-module (gnu packages elf)
34 #:use-module (gnu packages pkg-config)
35 #:use-module (gnu packages libusb)
36 #:use-module (gnu packages libftdi)
37 #:use-module (gnu packages pciutils)
38 #:use-module (gnu packages autotools)
39 #:use-module (gnu packages admin))
41 (define-public flashrom
48 "https://download.flashrom.org/releases/flashrom-"
52 "0i9wg1lyfg99bld7d00zqjm9f0lk6m0q3h3n9c195c9yysq5ccfb"))))
53 (build-system gnu-build-system)
54 (inputs `(("dmidecode" ,dmidecode)
55 ("pciutils" ,pciutils)
57 ("libftdi" ,libftdi)))
58 (native-inputs `(("pkg-config" ,pkg-config)))
60 '(#:make-flags (list "CC=gcc"
61 (string-append "PREFIX=" %output)
62 "CONFIG_ENABLE_LIBUSB0_PROGRAMMERS=no")
63 #:tests? #f ; no 'check' target
68 'build 'patch-exec-paths
69 (lambda* (#:key inputs #:allow-other-keys)
73 (string-append (assoc-ref inputs "dmidecode")
74 "/sbin/dmidecode")))))
76 (home-page "http://flashrom.org/")
77 (synopsis "Identify, read, write, erase, and verify ROM/flash chips")
79 "flashrom is a utility for identifying, reading, writing,
80 verifying and erasing flash chips. It is designed to flash
81 BIOS/EFI/coreboot/firmware/optionROM images on mainboards,
82 network/graphics/storage controller cards, and various other
93 (uri (string-append "https://github.com/pali/0xffff/archive/"
95 (file-name (string-append "0xFFFF" version ".tar.gz" ))
98 "1g4032c81wkk37wvbg1dxcqq6mnd76y9x7f2crmzqi6z4q9jcxmj"))))
99 (build-system gnu-build-system)
101 `(("libusb",libusb-0.1))) ; doesn't work with libusb-compat
104 (modify-phases %standard-phases
105 (delete 'configure)) ; no configure
106 #:make-flags (list (string-append "PREFIX=" %output))
107 #:tests? #f)) ; no 'check' target
108 (home-page "https://github.com/pali/0xFFFF")
109 (synopsis "Flash FIASCO images on Maemo devices")
111 "The Open Free Fiasco Firmware Flasher (0xFFFF) is a flashing tool
112 for FIASCO images. It supports generating, unpacking, editing and
113 flashing of FIASCO images for Maemo devices. Use it with care. It can
117 (define-public avrdude
124 (uri (string-append "mirror://savannah/avrdude/avrdude-"
128 "0frxg0q09nrm95z7ymzddx7ysl77ilfbdix1m81d9jjpiv5bm64y"))))
129 (build-system gnu-build-system)
132 ("libusb" ,libusb-compat)
133 ("libftdi" ,libftdi)))
137 (home-page "http://www.nongnu.org/avrdude/")
138 (synopsis "AVR downloader and uploader")
140 "AVRDUDE is a utility to download/upload/manipulate the ROM and
141 EEPROM contents of AVR microcontrollers using the in-system programming
145 (define-public dfu-programmer
147 (name "dfu-programmer")
152 (uri (string-append "mirror://sourceforge/dfu-programmer/dfu-programmer/"
153 version "/dfu-programmer-" version ".tar.gz"))
156 "15gr99y1z9vbvhrkd25zqhnzhg6zjmaam3vfjzf2mazd39mx7d0x"))
157 (patches (search-patches "dfu-programmer-fix-libusb.patch"))))
158 (build-system gnu-build-system)
160 `(("pkg-config" ,pkg-config)))
162 `(("libusb" ,libusb)))
163 (home-page "http://dfu-programmer.github.io/")
164 (synopsis "Device firmware update programmer for Atmel chips")
166 "Dfu-programmer is a multi-platform command-line programmer for
167 Atmel (8051, AVR, XMEGA & AVR32) chips with a USB bootloader supporting
171 (define-public dfu-util
178 "http://dfu-util.sourceforge.net/releases/dfu-util-"
182 "0czq73m92ngf30asdzrfkzraag95hlrr74imbanqq25kdim8qhin"))))
183 (build-system gnu-build-system)
185 `(("libusb" ,libusb)))
187 `(("pkg-config" ,pkg-config)))
188 (synopsis "Host side of the USB Device Firmware Upgrade (DFU) protocol")
190 "The DFU (Universal Serial Bus Device Firmware Upgrade) protocol is
191 intended to download and upload firmware to devices connected over USB. It
192 ranges from small devices like micro-controller boards up to mobile phones.
193 With dfu-util you are able to download firmware to your device or upload
195 (home-page "http://dfu-util.sourceforge.net/")
198 (define-public teensy-loader-cli
199 ;; The repo does not tag versions nor does it use releases, but a commit
200 ;; message says "Importing 2.1", while the sourcce still says "2.0". So pin
201 ;; to a fixed commit.
202 (let ((commit "f289b7a2e5627464044249f0e5742830e052e360"))
204 (name "teensy-loader-cli")
205 (version (string-append "2.1-1." (string-take commit 7)))
209 (uri (string-append "https://github.com/PaulStoffregen/"
210 "teensy_loader_cli/archive/" commit ".tar.gz"))
211 (sha256 (base32 "17wqc2q4fa473cy7f5m2yiyb9nq0qw7xal2kzrxzaikgm9rabsw8"))
212 (file-name (string-append "teensy-loader-cli-" version ".tar.gz" ))
213 (modules '((guix build utils)))
216 ;; Remove example flash files and teensy rebooter flash binaries.
217 (for-each delete-file (find-files "." "\\.(elf|hex)$"))
219 (substitute* "teensy_loader_cli.c"
220 (("Teensy Loader, Command Line, Version 2.0\\\\n")
221 (string-append "Teensy Loader, Command Line, " ,version "\\n")))
223 (patches (search-patches "teensy-loader-cli-help.patch"))))
224 (build-system gnu-build-system)
226 '(#:tests? #f ;; Makefile has no test target
227 #:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
229 (modify-phases %standard-phases
232 (lambda* (#:key outputs #:allow-other-keys)
233 (let* ((out (assoc-ref outputs "out"))
234 (bin (string-append out "/bin")))
235 (install-file "teensy_loader_cli" bin)
238 `(("libusb-compat" ,libusb-compat)))
239 (synopsis "Command line firmware uploader for Teensy development boards")
241 "The Teensy loader program communicates with your Teensy board when the
242 HalfKay bootloader is running, so you can upload new programs and run them.
244 You need to add the udev rules to make the Teensy update available for
246 (home-page "https://www.pjrc.com/teensy/loader_cli.html")
249 (define-public rkflashtool
250 (let ((commit "094bd6410cb016e487e2ccb1050c59eeac2e6dd1")
254 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
259 (url "https://github.com/linux-rockchip/rkflashtool.git")
261 (file-name (string-append name "-" version "-checkout"))
264 "1zkd8zxir3rfg3sy9r20bcnxclnplryn583gqpcr3iad0k3xbah7"))))
265 (build-system gnu-build-system)
268 (modify-phases %standard-phases
269 (delete 'configure)) ; no configure
270 #:make-flags (list (string-append "PREFIX=" %output))
271 #:tests? #f)) ; no tests
273 `(("pkg-config" ,pkg-config)))
275 `(("libusb" ,libusb)))
276 (home-page "https://github.com/linux-rockchip/rkflashtool")
277 (synopsis "Tools for flashing Rockchip devices")
278 (description "Allows flashing of Rockchip based embedded linux devices.
279 The list of currently supported devices is: RK2818, RK2918, RK2928, RK3026,
280 RK3036, RK3066, RK312X, RK3168, RK3188, RK3288, RK3368.")