gnu: Remove ".git" from "https://github/…/….git".
[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, 2019 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, 2020 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.2")
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 "0ax4kqnh7kd3z120ypgp73qy1knz47l6qxsqzrfkd97mh5cdky71"))))
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")
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 "https://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 (git-version "2.1" "1" commit))
215 (source
216 (origin
217 (method git-fetch)
218 (uri (git-reference
219 (url "https://github.com/PaulStoffregen/teensy_loader_cli")
220 (commit commit)))
221 (sha256 (base32 "0sssim56pwsxp5cp5dlf6mi9h5fx2592m6j1g7abnm0s09b0lpdx"))
222 (file-name (git-file-name name version))
223 (modules '((guix build utils)))
224 (snippet
225 `(begin
226 ;; Remove example flash files and teensy rebooter flash binaries.
227 (for-each delete-file (find-files "." "\\.(elf|hex)$"))
228 ;; Fix the version
229 (substitute* "teensy_loader_cli.c"
230 (("Teensy Loader, Command Line, Version 2.0\\\\n")
231 (string-append "Teensy Loader, Command Line, " ,version "\\n")))
232 #t))
233 (patches (search-patches "teensy-loader-cli-help.patch"))))
234 (build-system gnu-build-system)
235 (arguments
236 '(#:tests? #f ;; Makefile has no test target
237 #:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
238 #:phases
239 (modify-phases %standard-phases
240 (delete 'configure)
241 (replace 'install
242 (lambda* (#:key outputs #:allow-other-keys)
243 (let* ((out (assoc-ref outputs "out"))
244 (bin (string-append out "/bin")))
245 (install-file "teensy_loader_cli" bin)
246 #t))))))
247 (inputs
248 `(("libusb-compat" ,libusb-compat)))
249 (synopsis "Command line firmware uploader for Teensy development boards")
250 (description
251 "The Teensy loader program communicates with your Teensy board when the
252 HalfKay bootloader is running, so you can upload new programs and run them.
253
254 You need to add the udev rules to make the Teensy update available for
255 non-root users.")
256 (home-page "https://www.pjrc.com/teensy/loader_cli.html")
257 (license license:gpl3))))
258
259 (define-public rkflashtool
260 (let ((commit "8966c4e277de8148290554aaaa4146a3a84a3c53")
261 (revision "1"))
262 (package
263 (name "rkflashtool")
264 (version (git-version "5.2" revision commit))
265 (source
266 (origin
267 (method git-fetch)
268 (uri (git-reference
269 (url "https://github.com/linux-rockchip/rkflashtool")
270 (commit commit)))
271 (file-name (git-file-name name version))
272 (sha256
273 (base32
274 "1ndyzg1zlgg20dd8js9kfqm5kq19k005vddkvf65qj20w0pcyahn"))))
275 (build-system gnu-build-system)
276 (arguments
277 '(#:phases
278 (modify-phases %standard-phases
279 (delete 'configure)) ; no configure
280 #:make-flags (list (string-append "PREFIX=" %output))
281 #:tests? #f)) ; no tests
282 (native-inputs
283 `(("pkg-config" ,pkg-config)))
284 (inputs
285 `(("libusb" ,libusb)))
286 (home-page "https://github.com/linux-rockchip/rkflashtool")
287 (synopsis "Tools for flashing Rockchip devices")
288 (description "Allows flashing of Rockchip based embedded linux devices.
289 The list of currently supported devices is: RK2818, RK2918, RK2928, RK3026,
290 RK3036, RK3066, RK312X, RK3168, RK3188, RK3288, RK3368.")
291 (license license:bsd-2))))
292
293 (define-public heimdall
294 (package
295 (name "heimdall")
296 (version "1.4.2")
297 (source (origin
298 (method git-fetch)
299 (uri (git-reference
300 (url "https://gitlab.com/BenjaminDobell/Heimdall.git")
301 (commit (string-append "v" version))))
302 (file-name (git-file-name name version))
303 (sha256
304 (base32
305 "1ygn4snvcmi98rgldgxf5hwm7zzi1zcsihfvm6awf9s6mpcjzbqz"))))
306 (build-system cmake-build-system)
307 (arguments
308 `(#:build-type "Release"
309 #:tests? #f ; no tests
310 #:phases
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")
318 "/bin/heimdall\"")))
319 #t))
320 (replace 'install
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)
327 #t))))))
328 (inputs
329 `(("libusb" ,libusb)
330 ("qtbase" ,qtbase)
331 ("zlib" ,zlib)))
332 (home-page "https://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)))
340
341 (define-public ifdtool
342 (package
343 (name "ifdtool")
344 (version "4.9")
345 (source (origin
346 (method git-fetch)
347 (uri (git-reference
348 (url "https://github.com/coreboot/coreboot")
349 (commit version)))
350 (file-name (git-file-name name version))
351 (sha256
352 (base32
353 "0jidj29jh6p65d17k304wlzhxvp4p3c2namgcdwg2sxq8jfr0zlm"))))
354 (build-system gnu-build-system)
355 (arguments
356 `(#:make-flags
357 (list "CC=gcc"
358 "INSTALL=install"
359 (string-append "PREFIX=" (assoc-ref %outputs "out")))
360 #:phases
361 (modify-phases %standard-phases
362 (add-after 'unpack 'chdir
363 (lambda _
364 (chdir "util/ifdtool")
365 #t))
366 (delete 'configure)) ; no configure script
367 #:tests? #f)) ; no test suite
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)))
373
374 (define-public intelmetool
375 (package
376 (name "intelmetool")
377 (version "4.7")
378 (source (origin
379 (method git-fetch)
380 (uri (git-reference
381 (url "https://review.coreboot.org/p/coreboot")
382 (commit version)))
383 (file-name (git-file-name name version))
384 (sha256
385 (base32
386 "0nw555i0fm5kljha9h47bk70ykbwv8ddfk6qhz6kfqb79vzhy4h2"))))
387 (build-system gnu-build-system)
388 (inputs
389 `(("pciutils" ,pciutils)
390 ("zlib" ,zlib)))
391 (arguments
392 `(#:make-flags
393 (list "CC=gcc"
394 "INSTALL=install"
395 (string-append "PREFIX=" (assoc-ref %outputs "out")))
396 #:phases
397 (modify-phases %standard-phases
398 (add-after 'unpack 'chdir
399 (lambda _
400 (chdir "util/intelmetool")
401 #t))
402 (delete 'configure)
403 (delete 'check))))
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)
411
412 ;; This is obviously an Intel thing, plus it requires <cpuid.h>.
413 (supported-systems '("x86_64-linux" "i686-linux"))))
414
415 (define-public me-cleaner
416 (package
417 (name "me-cleaner")
418 (version "1.2")
419 (source (origin
420 (method git-fetch)
421 (uri (git-reference
422 (url "https://github.com/corna/me_cleaner")
423 (commit (string-append "v" version))))
424 (sha256
425 (base32
426 "1bdj2clm13ir441vn7sv860xsc5gh71ja5lc2wn0gggnff0adxj4"))
427 (file-name (git-file-name name version))))
428 (build-system python-build-system)
429 (arguments
430 `(#:phases
431 (modify-phases %standard-phases
432 (add-after 'install 'install-documentation
433 (lambda* (#:key outputs #:allow-other-keys)
434 (let* ((out (assoc-ref outputs "out"))
435 (man (string-append out "/share/man/man1")))
436 (install-file "man/me_cleaner.1" man)
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.27.0")
451 (source (origin
452 (method git-fetch)
453 (uri (git-reference
454 (url "https://github.com/LongSoft/UEFITool")
455 (commit version)))
456 (sha256
457 (base32
458 "1i1p823qld927p4f1wcphqcnivb9mq7fi5xmzibxc3g9zzgnyc2h"))
459 (file-name (git-file-name name version))))
460 (build-system gnu-build-system)
461 (arguments
462 `(#:phases
463 (modify-phases %standard-phases
464 (replace 'configure
465 (lambda _
466 (invoke "qmake" "-makefile")))
467 (replace 'install
468 (lambda* (#:key outputs #:allow-other-keys)
469 (install-file "UEFITool" (string-append (assoc-ref outputs "out")
470 "/bin"))
471 #t)))))
472 (inputs
473 `(("qtbase" ,qtbase)))
474 (home-page "https://github.com/LongSoft/UEFITool/")
475 (synopsis "UEFI image editor")
476 (description "@code{uefitool} is a graphical image file editor for
477 Unifinished Extensible Firmware Interface (UEFI) images.")
478 (license license:bsd-2)))