gnu: pies: Update to 1.4.
[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, 2019 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.1")
52 (source (origin
53 (method url-fetch)
54 (uri (string-append
55 "https://download.flashrom.org/releases/flashrom-v"
56 version ".tar.bz2"))
57 (sha256
58 (base32
59 "06afq680n9p34hi3vrkn12vd1pfyq2062db9qqbi4hi21k3skbdf"))))
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
68 (list "CC=gcc"
69 (string-append "PREFIX=" %output)
70 "CONFIG_ENABLE_LIBUSB0_PROGRAMMERS=no")
71 #:tests? #f ; no 'check' target
72 #:phases
73 (modify-phases %standard-phases
74 (delete 'configure) ; no configure script
75 (add-before 'build 'patch-exec-paths
76 (lambda* (#:key inputs #:allow-other-keys)
77 (substitute* "dmi.c"
78 (("\"dmidecode\"")
79 (format #f "~S"
80 (string-append (assoc-ref inputs "dmidecode")
81 "/sbin/dmidecode"))))
82 #t)))))
83 (home-page "https://flashrom.org/")
84 (synopsis "Identify, read, write, erase, and verify ROM/flash chips")
85 (description
86 "flashrom is a utility for identifying, reading, writing,
87 verifying and erasing flash chips. It is designed to flash
88 BIOS/EFI/coreboot/firmware/optionROM images on mainboards,
89 network/graphics/storage controller cards, and various other
90 programmer devices.")
91 (license license:gpl2)))
92
93 (define-public 0xffff
94 (package
95 (name "0xffff")
96 (version "0.8")
97 (source
98 (origin
99 (method git-fetch)
100 (uri (git-reference
101 (url "https://github.com/pali/0xffff.git")
102 (commit version)))
103 (file-name (git-file-name name version))
104 (sha256
105 (base32 "1a5b7k96vzirb0m8lqp7ldn77ppz4ngf56wslhsj2c6flcyvns4v"))))
106 (build-system gnu-build-system)
107 (inputs
108 `(("libusb" ,libusb-0.1))) ; doesn't work with libusb-compat
109 (arguments
110 '(#:phases
111 (modify-phases %standard-phases
112 (delete 'configure)) ; no configure
113 #:make-flags
114 (list "CC=gcc"
115 "BUILD_DATE=GNU Guix"
116 (string-append "PREFIX=" %output))
117 #:tests? #f)) ; no 'check' target
118 (home-page "https://github.com/pali/0xFFFF")
119 (synopsis "Flash FIASCO images on Maemo devices")
120 (description
121 "The Open Free Fiasco Firmware Flasher (0xFFFF) is a flashing tool
122 for FIASCO images. It supports generating, unpacking, editing and
123 flashing of FIASCO images for Maemo devices. Use it with care. It can
124 brick your device.")
125 (license license:gpl3+)))
126
127 (define-public avrdude
128 (package
129 (name "avrdude")
130 (version "6.3")
131 (source
132 (origin
133 (method url-fetch)
134 (uri (string-append "mirror://savannah/avrdude/avrdude-"
135 version ".tar.gz"))
136 (sha256
137 (base32 "15m1w1qad3dj7r8n5ng1qqcaiyx1gyd6hnc3p2apgjllccdp77qg"))))
138 (build-system gnu-build-system)
139 (inputs
140 `(("libelf" ,libelf)
141 ("libusb" ,libusb-compat)
142 ("libftdi" ,libftdi)))
143 (native-inputs
144 `(("bison" ,bison)
145 ("flex" ,flex)))
146 (home-page "https://www.nongnu.org/avrdude/")
147 (synopsis "AVR downloader and uploader")
148 (description
149 "AVRDUDE is a utility to download/upload/manipulate the ROM and
150 EEPROM contents of AVR microcontrollers using the @acronym{ISP, in-system
151 programming} technique.")
152 (license license:gpl2+)))
153
154 (define-public dfu-programmer
155 (package
156 (name "dfu-programmer")
157 (version "0.7.2")
158 (source
159 (origin
160 (method url-fetch)
161 (uri (string-append "mirror://sourceforge/dfu-programmer/dfu-programmer/"
162 version "/dfu-programmer-" version ".tar.gz"))
163 (sha256
164 (base32
165 "15gr99y1z9vbvhrkd25zqhnzhg6zjmaam3vfjzf2mazd39mx7d0x"))
166 (patches (search-patches "dfu-programmer-fix-libusb.patch"))))
167 (build-system gnu-build-system)
168 (native-inputs
169 `(("pkg-config" ,pkg-config)))
170 (inputs
171 `(("libusb" ,libusb)))
172 (home-page "http://dfu-programmer.github.io/")
173 (synopsis "Device firmware update programmer for Atmel chips")
174 (description
175 "Dfu-programmer is a multi-platform command-line programmer for
176 Atmel (8051, AVR, XMEGA & AVR32) chips with a USB bootloader supporting
177 ISP.")
178 (license license:gpl2+)))
179
180 (define-public dfu-util
181 (package
182 (name "dfu-util")
183 (version "0.9")
184 (source (origin
185 (method url-fetch)
186 (uri (string-append
187 "http://dfu-util.sourceforge.net/releases/dfu-util-"
188 version ".tar.gz"))
189 (sha256
190 (base32
191 "0czq73m92ngf30asdzrfkzraag95hlrr74imbanqq25kdim8qhin"))))
192 (build-system gnu-build-system)
193 (inputs
194 `(("libusb" ,libusb)))
195 (native-inputs
196 `(("pkg-config" ,pkg-config)))
197 (synopsis "Host side of the USB Device Firmware Upgrade (DFU) protocol")
198 (description
199 "The DFU (Universal Serial Bus Device Firmware Upgrade) protocol is
200 intended to download and upload firmware to devices connected over USB. It
201 ranges from small devices like micro-controller boards up to mobile phones.
202 With dfu-util you are able to download firmware to your device or upload
203 firmware from it.")
204 (home-page "http://dfu-util.sourceforge.net/")
205 (license license:gpl2+)))
206
207 (define-public teensy-loader-cli
208 ;; The repo does not tag versions nor does it use releases, but a commit
209 ;; message says "Importing 2.1", while the sourcce still says "2.0". So pin
210 ;; to a fixed commit.
211 (let ((commit "f289b7a2e5627464044249f0e5742830e052e360"))
212 (package
213 (name "teensy-loader-cli")
214 (version (string-append "2.1-1." (string-take commit 7)))
215 (source
216 (origin
217 (method url-fetch)
218 (uri (string-append "https://github.com/PaulStoffregen/"
219 "teensy_loader_cli/archive/" commit ".tar.gz"))
220 (sha256 (base32 "17wqc2q4fa473cy7f5m2yiyb9nq0qw7xal2kzrxzaikgm9rabsw8"))
221 (file-name (string-append "teensy-loader-cli-" version ".tar.gz" ))
222 (modules '((guix build utils)))
223 (snippet
224 `(begin
225 ;; Remove example flash files and teensy rebooter flash binaries.
226 (for-each delete-file (find-files "." "\\.(elf|hex)$"))
227 ;; Fix the version
228 (substitute* "teensy_loader_cli.c"
229 (("Teensy Loader, Command Line, Version 2.0\\\\n")
230 (string-append "Teensy Loader, Command Line, " ,version "\\n")))
231 #t))
232 (patches (search-patches "teensy-loader-cli-help.patch"))))
233 (build-system gnu-build-system)
234 (arguments
235 '(#:tests? #f ;; Makefile has no test target
236 #:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
237 #:phases
238 (modify-phases %standard-phases
239 (delete 'configure)
240 (replace 'install
241 (lambda* (#:key outputs #:allow-other-keys)
242 (let* ((out (assoc-ref outputs "out"))
243 (bin (string-append out "/bin")))
244 (install-file "teensy_loader_cli" bin)
245 #t))))))
246 (inputs
247 `(("libusb-compat" ,libusb-compat)))
248 (synopsis "Command line firmware uploader for Teensy development boards")
249 (description
250 "The Teensy loader program communicates with your Teensy board when the
251 HalfKay bootloader is running, so you can upload new programs and run them.
252
253 You need to add the udev rules to make the Teensy update available for
254 non-root users.")
255 (home-page "https://www.pjrc.com/teensy/loader_cli.html")
256 (license license:gpl3))))
257
258 (define-public rkflashtool
259 (let ((commit "094bd6410cb016e487e2ccb1050c59eeac2e6dd1")
260 (revision "1"))
261 (package
262 (name "rkflashtool")
263 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
264 (source
265 (origin
266 (method git-fetch)
267 (uri (git-reference
268 (url "https://github.com/linux-rockchip/rkflashtool.git")
269 (commit commit)))
270 (file-name (string-append name "-" version "-checkout"))
271 (sha256
272 (base32
273 "1zkd8zxir3rfg3sy9r20bcnxclnplryn583gqpcr3iad0k3xbah7"))))
274 (build-system gnu-build-system)
275 (arguments
276 '(#:phases
277 (modify-phases %standard-phases
278 (delete 'configure)) ; no configure
279 #:make-flags (list (string-append "PREFIX=" %output))
280 #:tests? #f)) ; no tests
281 (native-inputs
282 `(("pkg-config" ,pkg-config)))
283 (inputs
284 `(("libusb" ,libusb)))
285 (home-page "https://github.com/linux-rockchip/rkflashtool")
286 (synopsis "Tools for flashing Rockchip devices")
287 (description "Allows flashing of Rockchip based embedded linux devices.
288 The list of currently supported devices is: RK2818, RK2918, RK2928, RK3026,
289 RK3036, RK3066, RK312X, RK3168, RK3188, RK3288, RK3368.")
290 (license license:bsd-2))))
291
292 (define-public heimdall
293 (package
294 (name "heimdall")
295 (version "1.4.2")
296 (source (origin
297 (method url-fetch)
298 (uri (string-append "https://github.com/Benjamin-Dobell/Heimdall"
299 "/archive/v" version ".tar.gz"))
300 (file-name (string-append name "-" version ".tar.gz"))
301 (sha256
302 (base32
303 "1y7gwg3lipyp2zcysm2vid1qg5nwin9bxbvgzs28lz2rya4fz6sq"))))
304 (build-system cmake-build-system)
305 (arguments
306 `(#:build-type "Release"
307 #:tests? #f ; no tests
308 #:phases
309 (modify-phases %standard-phases
310 (add-after 'unpack 'patch-invocations
311 (lambda* (#:key outputs #:allow-other-keys)
312 (substitute* '("heimdall-frontend/source/aboutform.cpp"
313 "heimdall-frontend/source/mainwindow.cpp")
314 (("start[(]\"heimdall\"")
315 (string-append "start(\"" (assoc-ref outputs "out")
316 "/bin/heimdall\"")))
317 #t))
318 (replace 'install
319 (lambda* (#:key outputs #:allow-other-keys)
320 (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
321 (lib (string-append (assoc-ref outputs "out") "/lib")))
322 (install-file "bin/heimdall" bin)
323 (install-file "bin/heimdall-frontend" bin)
324 (install-file "libpit/libpit.a" lib)
325 #t))))))
326 (inputs
327 `(("libusb" ,libusb)
328 ("qtbase" ,qtbase)
329 ("zlib" ,zlib)))
330 (home-page "http://glassechidna.com.au/heimdall/")
331 (synopsis "Flash firmware onto Samsung mobile devices")
332 (description "@command{heimdall} is a tool suite used to flash firmware (aka
333 ROMs) onto Samsung mobile devices. Heimdall connects to a mobile device over
334 USB and interacts with low-level software running on the device, known as Loke.
335 Loke and Heimdall communicate via the custom Samsung-developed protocol typically
336 referred to as the \"Odin 3 protocol\".")
337 (license license:expat)))
338
339 (define-public ifdtool
340 (package
341 (name "ifdtool")
342 (version "4.9")
343 (source (origin
344 (method git-fetch)
345 (uri (git-reference
346 (url "https://github.com/coreboot/coreboot.git")
347 (commit version)))
348 (file-name (git-file-name name version))
349 (sha256
350 (base32
351 "0jidj29jh6p65d17k304wlzhxvp4p3c2namgcdwg2sxq8jfr0zlm"))))
352 (build-system gnu-build-system)
353 (arguments
354 `(#:make-flags
355 (list "CC=gcc"
356 "INSTALL=install"
357 (string-append "PREFIX=" (assoc-ref %outputs "out")))
358 #:phases
359 (modify-phases %standard-phases
360 (add-after 'unpack 'chdir
361 (lambda _
362 (chdir "util/ifdtool")
363 #t))
364 (delete 'configure)) ; no configure script
365 #:tests? #f)) ; no test suite
366 (home-page "https://github.com/corna/me_cleaner/")
367 (synopsis "Intel Firmware Descriptor dumper")
368 (description "This package provides @command{ifdtool}, a program to
369 dump Intel Firmware Descriptor data of an image file.")
370 (license license:gpl2)))
371
372 (define-public intelmetool
373 (package
374 (name "intelmetool")
375 (version "4.7")
376 (source (origin
377 (method git-fetch)
378 (uri (git-reference
379 (url "https://review.coreboot.org/p/coreboot")
380 (commit version)))
381 (file-name (git-file-name name version))
382 (sha256
383 (base32
384 "0nw555i0fm5kljha9h47bk70ykbwv8ddfk6qhz6kfqb79vzhy4h2"))))
385 (build-system gnu-build-system)
386 (inputs
387 `(("pciutils" ,pciutils)
388 ("zlib" ,zlib)))
389 (arguments
390 `(#:make-flags
391 (list "CC=gcc"
392 "INSTALL=install"
393 (string-append "PREFIX=" (assoc-ref %outputs "out")))
394 #:phases
395 (modify-phases %standard-phases
396 (add-after 'unpack 'chdir
397 (lambda _
398 (chdir "util/intelmetool")
399 #t))
400 (delete 'configure)
401 (delete 'check))))
402 (home-page "https://github.com/zamaudio/intelmetool")
403 (synopsis "Intel Management Engine tools")
404 (description "This package provides tools for working with Intel
405 Management Engine (ME). You need to @code{sudo rmmod mei_me} and
406 @code{sudo rmmod mei} before using this tool. Also pass
407 @code{iomem=relaxed} to the Linux kernel command line.")
408 (license license:gpl2)
409
410 ;; This is obviously an Intel thing, plus it requires <cpuid.h>.
411 (supported-systems '("x86_64-linux" "i686-linux"))))
412
413 (define-public me-cleaner
414 (package
415 (name "me-cleaner")
416 (version "1.1")
417 (source (origin
418 (method url-fetch)
419 (uri (string-append "https://github.com/corna/me_cleaner/"
420 "archive/v" version ".tar.gz"))
421 (sha256
422 (base32
423 "1pgwdqy0jly80nhxmlmyibs343497yjzs6dwfbkcw0l1gjm8i5hw"))
424 (file-name (string-append name "-" version ".tar.gz"))))
425 (build-system python-build-system)
426 (arguments
427 `(#:phases
428 (modify-phases %standard-phases
429 (add-after 'unpack 'create-setup.py
430 (lambda _
431 (call-with-output-file "setup.py"
432 (lambda (port)
433 (format port "\
434 from setuptools import setup
435 setup(name='me_cleaner', version='~a', scripts=['me_cleaner.py'])
436 " ,version)))
437 #t)))))
438 (home-page "https://github.com/corna/me_cleaner")
439 (synopsis "Intel ME cleaner")
440 (description "This package provides tools for disabling Intel
441 ME as far as possible (it only edits ME firmware image files).")
442 (license license:gpl3+)
443
444 ;; This is an Intel thing.
445 (supported-systems '("x86_64-linux" "i686-linux"))))
446
447 (define-public uefitool
448 (package
449 (name "uefitool")
450 (version "0.22.4")
451 (source (origin
452 (method url-fetch)
453 (uri (string-append "https://github.com/LongSoft/UEFITool/archive/"
454 version ".tar.gz"))
455 (sha256
456 (base32
457 "05jmhv7jpq08kqbd1477y1lgyjvcic3njrd0bmzdy7v7b7lnhl82"))
458 (file-name (string-append name "-" version ".tar.gz"))))
459 (build-system gnu-build-system)
460 (arguments
461 `(#:phases
462 (modify-phases %standard-phases
463 (replace 'configure
464 (lambda _
465 (invoke "qmake" "-makefile")))
466 (replace 'install
467 (lambda* (#:key outputs #:allow-other-keys)
468 (install-file "UEFITool" (string-append (assoc-ref outputs "out")
469 "/bin"))
470 #t)))))
471 (inputs
472 `(("qtbase" ,qtbase)))
473 (home-page "https://github.com/LongSoft/UEFITool/")
474 (synopsis "UEFI image editor")
475 (description "@code{uefitool} is a graphical image file editor for
476 Unifinished Extensible Firmware Interface (UEFI) images.")
477 (license license:bsd-2)))