gnu: Fix common unquote typos.
[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, 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>
10 ;;;
11 ;;; This file is part of GNU Guix.
12 ;;;
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.
17 ;;;
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.
22 ;;;
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/>.
25
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))
47
48 (define-public flashrom
49 (package
50 (name "flashrom")
51 (version "1.0")
52 (source (origin
53 (method url-fetch)
54 (uri (string-append
55 "https://download.flashrom.org/releases/flashrom-"
56 version ".tar.bz2"))
57 (sha256
58 (base32
59 "0r7fkpfc8w51n8ffbhclj4wa3kwrk0ijv1acwpw5myx5bchzl0ip"))))
60 (build-system gnu-build-system)
61 (inputs `(("dmidecode" ,dmidecode)
62 ("pciutils" ,pciutils)
63 ("libusb" ,libusb)
64 ("libftdi" ,libftdi)))
65 (native-inputs `(("pkg-config" ,pkg-config)))
66 (arguments
67 '(#:make-flags (list "CC=gcc"
68 (string-append "PREFIX=" %output)
69 "CONFIG_ENABLE_LIBUSB0_PROGRAMMERS=no")
70 #:tests? #f ; no 'check' target
71 #:phases
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)
76 (substitute* "dmi.c"
77 (("\"dmidecode\"")
78 (format #f "~S"
79 (string-append (assoc-ref inputs "dmidecode")
80 "/sbin/dmidecode"))))
81 #t)))))
82 (home-page "https://flashrom.org/")
83 (synopsis "Identify, read, write, erase, and verify ROM/flash chips")
84 (description
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
89 programmer devices.")
90 (license license:gpl2)))
91
92 (define-public 0xffff
93 (package
94 (name "0xffff")
95 (version "0.7")
96 (source
97 (origin
98 (method url-fetch)
99 (uri (string-append "https://github.com/pali/0xffff/archive/"
100 version ".tar.gz"))
101 (file-name (string-append "0xFFFF" version ".tar.gz" ))
102 (sha256
103 (base32
104 "1g4032c81wkk37wvbg1dxcqq6mnd76y9x7f2crmzqi6z4q9jcxmj"))))
105 (build-system gnu-build-system)
106 (inputs
107 `(("libusb" ,libusb-0.1))) ; doesn't work with libusb-compat
108 (arguments
109 '(#:phases
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")
116 (description
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
120 brick your device.")
121 (license license:gpl3+)))
122
123 (define-public avrdude
124 (package
125 (name "avrdude")
126 (version "6.1")
127 (source
128 (origin
129 (method url-fetch)
130 (uri (string-append "mirror://savannah/avrdude/avrdude-"
131 version ".tar.gz"))
132 (sha256
133 (base32
134 "0frxg0q09nrm95z7ymzddx7ysl77ilfbdix1m81d9jjpiv5bm64y"))))
135 (build-system gnu-build-system)
136 (inputs
137 `(("libelf" ,libelf)
138 ("libusb" ,libusb-compat)
139 ("libftdi" ,libftdi)))
140 (native-inputs
141 `(("bison" ,bison)
142 ("flex" ,flex)))
143 (home-page "https://www.nongnu.org/avrdude/")
144 (synopsis "AVR downloader and uploader")
145 (description
146 "AVRDUDE is a utility to download/upload/manipulate the ROM and
147 EEPROM contents of AVR microcontrollers using the in-system programming
148 technique (ISP).")
149 (license license:gpl2+)))
150
151 (define-public dfu-programmer
152 (package
153 (name "dfu-programmer")
154 (version "0.7.2")
155 (source
156 (origin
157 (method url-fetch)
158 (uri (string-append "mirror://sourceforge/dfu-programmer/dfu-programmer/"
159 version "/dfu-programmer-" version ".tar.gz"))
160 (sha256
161 (base32
162 "15gr99y1z9vbvhrkd25zqhnzhg6zjmaam3vfjzf2mazd39mx7d0x"))
163 (patches (search-patches "dfu-programmer-fix-libusb.patch"))))
164 (build-system gnu-build-system)
165 (native-inputs
166 `(("pkg-config" ,pkg-config)))
167 (inputs
168 `(("libusb" ,libusb)))
169 (home-page "http://dfu-programmer.github.io/")
170 (synopsis "Device firmware update programmer for Atmel chips")
171 (description
172 "Dfu-programmer is a multi-platform command-line programmer for
173 Atmel (8051, AVR, XMEGA & AVR32) chips with a USB bootloader supporting
174 ISP.")
175 (license license:gpl2+)))
176
177 (define-public dfu-util
178 (package
179 (name "dfu-util")
180 (version "0.9")
181 (source (origin
182 (method url-fetch)
183 (uri (string-append
184 "http://dfu-util.sourceforge.net/releases/dfu-util-"
185 version ".tar.gz"))
186 (sha256
187 (base32
188 "0czq73m92ngf30asdzrfkzraag95hlrr74imbanqq25kdim8qhin"))))
189 (build-system gnu-build-system)
190 (inputs
191 `(("libusb" ,libusb)))
192 (native-inputs
193 `(("pkg-config" ,pkg-config)))
194 (synopsis "Host side of the USB Device Firmware Upgrade (DFU) protocol")
195 (description
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
200 firmware from it.")
201 (home-page "http://dfu-util.sourceforge.net/")
202 (license license:gpl2+)))
203
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"))
209 (package
210 (name "teensy-loader-cli")
211 (version (string-append "2.1-1." (string-take commit 7)))
212 (source
213 (origin
214 (method url-fetch)
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)))
220 (snippet
221 `(begin
222 ;; Remove example flash files and teensy rebooter flash binaries.
223 (for-each delete-file (find-files "." "\\.(elf|hex)$"))
224 ;; Fix the version
225 (substitute* "teensy_loader_cli.c"
226 (("Teensy Loader, Command Line, Version 2.0\\\\n")
227 (string-append "Teensy Loader, Command Line, " ,version "\\n")))
228 #t))
229 (patches (search-patches "teensy-loader-cli-help.patch"))))
230 (build-system gnu-build-system)
231 (arguments
232 '(#:tests? #f ;; Makefile has no test target
233 #:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
234 #:phases
235 (modify-phases %standard-phases
236 (delete 'configure)
237 (replace 'install
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)
242 #t))))))
243 (inputs
244 `(("libusb-compat" ,libusb-compat)))
245 (synopsis "Command line firmware uploader for Teensy development boards")
246 (description
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.
249
250 You need to add the udev rules to make the Teensy update available for
251 non-root users.")
252 (home-page "https://www.pjrc.com/teensy/loader_cli.html")
253 (license license:gpl3))))
254
255 (define-public rkflashtool
256 (let ((commit "094bd6410cb016e487e2ccb1050c59eeac2e6dd1")
257 (revision "1"))
258 (package
259 (name "rkflashtool")
260 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
261 (source
262 (origin
263 (method git-fetch)
264 (uri (git-reference
265 (url "https://github.com/linux-rockchip/rkflashtool.git")
266 (commit commit)))
267 (file-name (string-append name "-" version "-checkout"))
268 (sha256
269 (base32
270 "1zkd8zxir3rfg3sy9r20bcnxclnplryn583gqpcr3iad0k3xbah7"))))
271 (build-system gnu-build-system)
272 (arguments
273 '(#:phases
274 (modify-phases %standard-phases
275 (delete 'configure)) ; no configure
276 #:make-flags (list (string-append "PREFIX=" %output))
277 #:tests? #f)) ; no tests
278 (native-inputs
279 `(("pkg-config" ,pkg-config)))
280 (inputs
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))))
288
289 (define-public heimdall
290 (package
291 (name "heimdall")
292 (version "1.4.2")
293 (source (origin
294 (method url-fetch)
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"))
298 (sha256
299 (base32
300 "1y7gwg3lipyp2zcysm2vid1qg5nwin9bxbvgzs28lz2rya4fz6sq"))))
301 (build-system cmake-build-system)
302 (arguments
303 `(#:configure-flags '("-DCMAKE_BUILD_TYPE=Release")
304 #:tests? #f; no tests
305 #:phases
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")
313 "/bin/heimdall\"")))
314 #t))
315 (replace 'install
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)
322 #t))))))
323 (inputs
324 `(("libusb" ,libusb)
325 ("qtbase" ,qtbase)
326 ("zlib" ,zlib)))
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)))
335
336 (define-public ifdtool
337 (package
338 (name "ifdtool")
339 (version "4.7")
340 (source (origin
341 (method git-fetch)
342 (uri (git-reference
343 (url "https://review.coreboot.org/p/coreboot")
344 (commit version)))
345 (file-name (git-file-name name version))
346 (sha256
347 (base32
348 "0nw555i0fm5kljha9h47bk70ykbwv8ddfk6qhz6kfqb79vzhy4h2"))))
349 (build-system gnu-build-system)
350 (arguments
351 `(#:make-flags
352 (list "CC=gcc"
353 "INSTALL=install"
354 (string-append "PREFIX=" (assoc-ref %outputs "out")))
355 #:phases
356 (modify-phases %standard-phases
357 (add-after 'unpack 'chdir
358 (lambda _
359 (chdir "util/ifdtool")
360 #t))
361 (delete 'configure)
362 (delete 'check))))
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)))
368
369 (define-public intelmetool
370 (package
371 (name "intelmetool")
372 (version "4.7")
373 (source (origin
374 (method git-fetch)
375 (uri (git-reference
376 (url "https://review.coreboot.org/p/coreboot")
377 (commit version)))
378 (file-name (git-file-name name version))
379 (sha256
380 (base32
381 "0nw555i0fm5kljha9h47bk70ykbwv8ddfk6qhz6kfqb79vzhy4h2"))))
382 (build-system gnu-build-system)
383 (inputs
384 `(("pciutils" ,pciutils)
385 ("zlib" ,zlib)))
386 (arguments
387 `(#:make-flags
388 (list "CC=gcc"
389 "INSTALL=install"
390 (string-append "PREFIX=" (assoc-ref %outputs "out")))
391 #:phases
392 (modify-phases %standard-phases
393 (add-after 'unpack 'chdir
394 (lambda _
395 (chdir "util/intelmetool")
396 #t))
397 (delete 'configure)
398 (delete 'check))))
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)
406
407 ;; This is obviously an Intel thing, plus it requires <cpuid.h>.
408 (supported-systems '("x86_64-linux" "i686-linux"))))
409
410 (define-public me-cleaner
411 (package
412 (name "me-cleaner")
413 (version "1.1")
414 (source (origin
415 (method url-fetch)
416 (uri (string-append "https://github.com/corna/me_cleaner/"
417 "archive/v" version ".tar.gz"))
418 (sha256
419 (base32
420 "1pgwdqy0jly80nhxmlmyibs343497yjzs6dwfbkcw0l1gjm8i5hw"))
421 (file-name (string-append name "-" version ".tar.gz"))))
422 (build-system python-build-system)
423 (arguments
424 `(#:phases
425 (modify-phases %standard-phases
426 (add-after 'unpack 'create-setup.py
427 (lambda _
428 (call-with-output-file "setup.py"
429 (lambda (port)
430 (format port "\
431 from setuptools import setup
432 setup(name='me_cleaner', version='~a', scripts=['me_cleaner.py'])
433 " ,version)))
434 #t)))))
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+)
440
441 ;; This is an Intel thing.
442 (supported-systems '("x86_64-linux" "i686-linux"))))