Merge branch 'master' into staging
[jackhill/guix/guix.git] / gnu / packages / flashing-tools.scm
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>
8 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
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.
15 ;;;
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.
20 ;;;
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/>.
23
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))
40
41 (define-public flashrom
42 (package
43 (name "flashrom")
44 (version "0.9.9")
45 (source (origin
46 (method url-fetch)
47 (uri (string-append
48 "https://download.flashrom.org/releases/flashrom-"
49 version ".tar.bz2"))
50 (sha256
51 (base32
52 "0i9wg1lyfg99bld7d00zqjm9f0lk6m0q3h3n9c195c9yysq5ccfb"))))
53 (build-system gnu-build-system)
54 (inputs `(("dmidecode" ,dmidecode)
55 ("pciutils" ,pciutils)
56 ("libusb" ,libusb)
57 ("libftdi" ,libftdi)))
58 (native-inputs `(("pkg-config" ,pkg-config)))
59 (arguments
60 '(#:make-flags (list "CC=gcc"
61 (string-append "PREFIX=" %output)
62 "CONFIG_ENABLE_LIBUSB0_PROGRAMMERS=no")
63 #:tests? #f ; no 'check' target
64 #:phases
65 (alist-delete
66 'configure
67 (alist-cons-before
68 'build 'patch-exec-paths
69 (lambda* (#:key inputs #:allow-other-keys)
70 (substitute* "dmi.c"
71 (("\"dmidecode\"")
72 (format #f "~S"
73 (string-append (assoc-ref inputs "dmidecode")
74 "/sbin/dmidecode")))))
75 %standard-phases))))
76 (home-page "http://flashrom.org/")
77 (synopsis "Identify, read, write, erase, and verify ROM/flash chips")
78 (description
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
83 programmer devices.")
84 (license gpl2)))
85
86 (define-public 0xffff
87 (package
88 (name "0xffff")
89 (version "0.7")
90 (source
91 (origin
92 (method url-fetch)
93 (uri (string-append "https://github.com/pali/0xffff/archive/"
94 version ".tar.gz"))
95 (file-name (string-append "0xFFFF" version ".tar.gz" ))
96 (sha256
97 (base32
98 "1g4032c81wkk37wvbg1dxcqq6mnd76y9x7f2crmzqi6z4q9jcxmj"))))
99 (build-system gnu-build-system)
100 (inputs
101 `(("libusb",libusb-0.1))) ; doesn't work with libusb-compat
102 (arguments
103 '(#:phases
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")
110 (description
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
114 brick your device.")
115 (license gpl3+)))
116
117 (define-public avrdude
118 (package
119 (name "avrdude")
120 (version "6.1")
121 (source
122 (origin
123 (method url-fetch)
124 (uri (string-append "mirror://savannah/avrdude/avrdude-"
125 version ".tar.gz"))
126 (sha256
127 (base32
128 "0frxg0q09nrm95z7ymzddx7ysl77ilfbdix1m81d9jjpiv5bm64y"))))
129 (build-system gnu-build-system)
130 (inputs
131 `(("libelf" ,libelf)
132 ("libusb" ,libusb-compat)
133 ("libftdi" ,libftdi)))
134 (native-inputs
135 `(("bison" ,bison)
136 ("flex" ,flex)))
137 (home-page "http://www.nongnu.org/avrdude/")
138 (synopsis "AVR downloader and uploader")
139 (description
140 "AVRDUDE is a utility to download/upload/manipulate the ROM and
141 EEPROM contents of AVR microcontrollers using the in-system programming
142 technique (ISP).")
143 (license gpl2+)))
144
145 (define-public dfu-programmer
146 (package
147 (name "dfu-programmer")
148 (version "0.7.2")
149 (source
150 (origin
151 (method url-fetch)
152 (uri (string-append "mirror://sourceforge/dfu-programmer/dfu-programmer/"
153 version "/dfu-programmer-" version ".tar.gz"))
154 (sha256
155 (base32
156 "15gr99y1z9vbvhrkd25zqhnzhg6zjmaam3vfjzf2mazd39mx7d0x"))
157 (patches (search-patches "dfu-programmer-fix-libusb.patch"))))
158 (build-system gnu-build-system)
159 (native-inputs
160 `(("pkg-config" ,pkg-config)))
161 (inputs
162 `(("libusb" ,libusb)))
163 (home-page "http://dfu-programmer.github.io/")
164 (synopsis "Device firmware update programmer for Atmel chips")
165 (description
166 "Dfu-programmer is a multi-platform command-line programmer for
167 Atmel (8051, AVR, XMEGA & AVR32) chips with a USB bootloader supporting
168 ISP.")
169 (license gpl2+)))
170
171 (define-public dfu-util
172 (package
173 (name "dfu-util")
174 (version "0.9")
175 (source (origin
176 (method url-fetch)
177 (uri (string-append
178 "http://dfu-util.sourceforge.net/releases/dfu-util-"
179 version ".tar.gz"))
180 (sha256
181 (base32
182 "0czq73m92ngf30asdzrfkzraag95hlrr74imbanqq25kdim8qhin"))))
183 (build-system gnu-build-system)
184 (inputs
185 `(("libusb" ,libusb)))
186 (native-inputs
187 `(("pkg-config" ,pkg-config)))
188 (synopsis "Host side of the USB Device Firmware Upgrade (DFU) protocol")
189 (description
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
194 firmware from it.")
195 (home-page "http://dfu-util.sourceforge.net/")
196 (license gpl2+)))
197
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"))
203 (package
204 (name "teensy-loader-cli")
205 (version (string-append "2.1-1." (string-take commit 7)))
206 (source
207 (origin
208 (method url-fetch)
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)))
214 (snippet
215 `(begin
216 ;; Remove example flash files and teensy rebooter flash binaries.
217 (for-each delete-file (find-files "." "\\.(elf|hex)$"))
218 ;; Fix the version
219 (substitute* "teensy_loader_cli.c"
220 (("Teensy Loader, Command Line, Version 2.0\\\\n")
221 (string-append "Teensy Loader, Command Line, " ,version "\\n")))
222 #t))
223 (patches (search-patches "teensy-loader-cli-help.patch"))))
224 (build-system gnu-build-system)
225 (arguments
226 '(#:tests? #f ;; Makefile has no test target
227 #:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
228 #:phases
229 (modify-phases %standard-phases
230 (delete 'configure)
231 (replace 'install
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)
236 #t))))))
237 (inputs
238 `(("libusb-compat" ,libusb-compat)))
239 (synopsis "Command line firmware uploader for Teensy development boards")
240 (description
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.
243
244 You need to add the udev rules to make the Teensy update available for
245 non-root users.")
246 (home-page "https://www.pjrc.com/teensy/loader_cli.html")
247 (license gpl3))))
248
249 (define-public rkflashtool
250 (let ((commit "094bd6410cb016e487e2ccb1050c59eeac2e6dd1")
251 (revision "1"))
252 (package
253 (name "rkflashtool")
254 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
255 (source
256 (origin
257 (method git-fetch)
258 (uri (git-reference
259 (url "https://github.com/linux-rockchip/rkflashtool.git")
260 (commit commit)))
261 (file-name (string-append name "-" version "-checkout"))
262 (sha256
263 (base32
264 "1zkd8zxir3rfg3sy9r20bcnxclnplryn583gqpcr3iad0k3xbah7"))))
265 (build-system gnu-build-system)
266 (arguments
267 '(#:phases
268 (modify-phases %standard-phases
269 (delete 'configure)) ; no configure
270 #:make-flags (list (string-append "PREFIX=" %output))
271 #:tests? #f)) ; no tests
272 (native-inputs
273 `(("pkg-config" ,pkg-config)))
274 (inputs
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.")
281 (license bsd-2))))