gnu: ruby-pandoc-ruby: Use pandoc instead of ghc-pandoc.
[jackhill/guix/guix.git] / gnu / packages / flashing-tools.scm
CommitLineData
4acd5c0f 1;;; GNU Guix --- Functional package management for GNU
eff5f452 2;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
4acd5c0f 3;;; Copyright © 2014 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
af3166c3 4;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
ca1499ce 5;;; Copyright © 2016, 2018 Ludovic Courtès <ludo@gnu.org>
64ed7c22 6;;; Copyright © 2016, 2019 Efraim Flashner <efraim@flashner.co.il>
29ac89a6 7;;; Copyright © 2017 Jonathan Brielmaier <jonathan.brielmaier@web.de>
f282aa53 8;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
ccea06cc 9;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
4acd5c0f
MR
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
eff5f452 26(define-module (gnu packages flashing-tools)
f282aa53 27 #:use-module ((guix licenses) #:prefix license:)
4acd5c0f 28 #:use-module (guix download)
7526edb9 29 #:use-module (guix git-download)
4acd5c0f
MR
30 #:use-module (guix packages)
31 #:use-module (gnu packages)
f282aa53 32 #:use-module (guix build-system cmake)
4acd5c0f 33 #:use-module (guix build-system gnu)
0297a160 34 #:use-module (guix build-system python)
4acd5c0f 35 #:use-module (gnu packages bison)
f282aa53 36 #:use-module (gnu packages compression)
4acd5c0f
MR
37 #:use-module (gnu packages flex)
38 #:use-module (gnu packages elf)
9721c0b6 39 #:use-module (gnu packages pciutils)
eff5f452 40 #:use-module (gnu packages pkg-config)
4acd5c0f 41 #:use-module (gnu packages libusb)
eff5f452
MR
42 #:use-module (gnu packages libftdi)
43 #:use-module (gnu packages pciutils)
f282aa53 44 #:use-module (gnu packages qt)
af3166c3 45 #:use-module (gnu packages autotools)
eff5f452
MR
46 #:use-module (gnu packages admin))
47
48(define-public flashrom
49 (package
50 (name "flashrom")
ccea06cc 51 (version "1.2")
eff5f452
MR
52 (source (origin
53 (method url-fetch)
54 (uri (string-append
17499793 55 "https://download.flashrom.org/releases/flashrom-v"
eff5f452
MR
56 version ".tar.bz2"))
57 (sha256
58 (base32
ccea06cc 59 "0ax4kqnh7kd3z120ypgp73qy1knz47l6qxsqzrfkd97mh5cdky71"))))
eff5f452
MR
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
326654e4
TGR
67 '(#:make-flags
68 (list "CC=gcc"
326654e4
TGR
69 (string-append "PREFIX=" %output)
70 "CONFIG_ENABLE_LIBUSB0_PROGRAMMERS=no")
a03abe78 71 #:tests? #f ; no 'check' target
eff5f452 72 #:phases
dc1d3cde 73 (modify-phases %standard-phases
a03abe78 74 (delete 'configure) ; no configure script
dc1d3cde
KK
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)))))
291b5de9 83 (home-page "https://flashrom.org/")
eff5f452
MR
84 (synopsis "Identify, read, write, erase, and verify ROM/flash chips")
85 (description
86 "flashrom is a utility for identifying, reading, writing,
87verifying and erasing flash chips. It is designed to flash
88BIOS/EFI/coreboot/firmware/optionROM images on mainboards,
89network/graphics/storage controller cards, and various other
90programmer devices.")
f282aa53 91 (license license:gpl2)))
4acd5c0f 92
29ac89a6
JB
93(define-public 0xffff
94 (package
95 (name "0xffff")
03df9e5a 96 (version "0.8")
29ac89a6
JB
97 (source
98 (origin
659afdae
TGR
99 (method git-fetch)
100 (uri (git-reference
b0e7b699 101 (url "https://github.com/pali/0xffff")
659afdae
TGR
102 (commit version)))
103 (file-name (git-file-name name version))
104 (sha256
105 (base32 "1a5b7k96vzirb0m8lqp7ldn77ppz4ngf56wslhsj2c6flcyvns4v"))))
29ac89a6
JB
106 (build-system gnu-build-system)
107 (inputs
03df9e5a 108 `(("libusb" ,libusb-0.1))) ; doesn't work with libusb-compat
29ac89a6
JB
109 (arguments
110 '(#:phases
111 (modify-phases %standard-phases
03df9e5a
TGR
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
29ac89a6
JB
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
122for FIASCO images. It supports generating, unpacking, editing and
123flashing of FIASCO images for Maemo devices. Use it with care. It can
124brick your device.")
f282aa53 125 (license license:gpl3+)))
29ac89a6 126
4acd5c0f
MR
127(define-public avrdude
128 (package
129 (name "avrdude")
3b31d985 130 (version "6.3")
4acd5c0f
MR
131 (source
132 (origin
133 (method url-fetch)
134 (uri (string-append "mirror://savannah/avrdude/avrdude-"
135 version ".tar.gz"))
136 (sha256
3b31d985 137 (base32 "15m1w1qad3dj7r8n5ng1qqcaiyx1gyd6hnc3p2apgjllccdp77qg"))))
4acd5c0f
MR
138 (build-system gnu-build-system)
139 (inputs
140 `(("libelf" ,libelf)
b0069a67 141 ("libusb" ,libusb-compat)
4acd5c0f
MR
142 ("libftdi" ,libftdi)))
143 (native-inputs
144 `(("bison" ,bison)
145 ("flex" ,flex)))
340978d7 146 (home-page "https://www.nongnu.org/avrdude/")
4acd5c0f
MR
147 (synopsis "AVR downloader and uploader")
148 (description
149 "AVRDUDE is a utility to download/upload/manipulate the ROM and
a1942cf0
TGR
150EEPROM contents of AVR microcontrollers using the @acronym{ISP, in-system
151programming} technique.")
f282aa53 152 (license license:gpl2+)))
2a9a4fb8
MR
153
154(define-public dfu-programmer
155 (package
156 (name "dfu-programmer")
702675c5 157 (version "0.7.2")
2a9a4fb8
MR
158 (source
159 (origin
160 (method url-fetch)
de67e922
LF
161 (uri (string-append "mirror://sourceforge/dfu-programmer/dfu-programmer/"
162 version "/dfu-programmer-" version ".tar.gz"))
2a9a4fb8
MR
163 (sha256
164 (base32
702675c5 165 "15gr99y1z9vbvhrkd25zqhnzhg6zjmaam3vfjzf2mazd39mx7d0x"))
fc1adab1 166 (patches (search-patches "dfu-programmer-fix-libusb.patch"))))
2a9a4fb8 167 (build-system gnu-build-system)
702675c5
DT
168 (native-inputs
169 `(("pkg-config" ,pkg-config)))
2a9a4fb8
MR
170 (inputs
171 `(("libusb" ,libusb)))
68ad2a78 172 (home-page "https://dfu-programmer.github.io/")
2a9a4fb8
MR
173 (synopsis "Device firmware update programmer for Atmel chips")
174 (description
7c125ce0
AK
175 "Dfu-programmer is a multi-platform command-line programmer for
176Atmel (8051, AVR, XMEGA & AVR32) chips with a USB bootloader supporting
177ISP.")
f282aa53 178 (license license:gpl2+)))
af3166c3
HG
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
200intended to download and upload firmware to devices connected over USB. It
201ranges from small devices like micro-controller boards up to mobile phones.
202With dfu-util you are able to download firmware to your device or upload
203firmware from it.")
204 (home-page "http://dfu-util.sourceforge.net/")
f282aa53 205 (license license:gpl2+)))
d3a858cb
HG
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")
02191009 214 (version (git-version "2.1" "1" commit))
d3a858cb
HG
215 (source
216 (origin
02191009
EF
217 (method git-fetch)
218 (uri (git-reference
b0e7b699 219 (url "https://github.com/PaulStoffregen/teensy_loader_cli")
02191009
EF
220 (commit commit)))
221 (sha256 (base32 "0sssim56pwsxp5cp5dlf6mi9h5fx2592m6j1g7abnm0s09b0lpdx"))
222 (file-name (git-file-name name version))
d3a858cb
HG
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
252HalfKay bootloader is running, so you can upload new programs and run them.
253
254You need to add the udev rules to make the Teensy update available for
255non-root users.")
256 (home-page "https://www.pjrc.com/teensy/loader_cli.html")
f282aa53 257 (license license:gpl3))))
7526edb9
EF
258
259(define-public rkflashtool
64ed7c22 260 (let ((commit "8966c4e277de8148290554aaaa4146a3a84a3c53")
7526edb9
EF
261 (revision "1"))
262 (package
263 (name "rkflashtool")
64ed7c22 264 (version (git-version "5.2" revision commit))
7526edb9
EF
265 (source
266 (origin
267 (method git-fetch)
268 (uri (git-reference
b0e7b699 269 (url "https://github.com/linux-rockchip/rkflashtool")
7526edb9 270 (commit commit)))
64ed7c22 271 (file-name (git-file-name name version))
7526edb9
EF
272 (sha256
273 (base32
64ed7c22 274 "1ndyzg1zlgg20dd8js9kfqm5kq19k005vddkvf65qj20w0pcyahn"))))
7526edb9
EF
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.
289The list of currently supported devices is: RK2818, RK2918, RK2928, RK3026,
290RK3036, RK3066, RK312X, RK3168, RK3188, RK3288, RK3368.")
f282aa53
JL
291 (license license:bsd-2))))
292
293(define-public heimdall
294 (package
295 (name "heimdall")
296 (version "1.4.2")
297 (source (origin
e9e83626
EF
298 (method git-fetch)
299 (uri (git-reference
8d449c25 300 (url "https://gitlab.com/BenjaminDobell/Heimdall.git")
e9e83626
EF
301 (commit (string-append "v" version))))
302 (file-name (git-file-name name version))
f282aa53
JL
303 (sha256
304 (base32
e9e83626 305 "1ygn4snvcmi98rgldgxf5hwm7zzi1zcsihfvm6awf9s6mpcjzbqz"))))
f282aa53
JL
306 (build-system cmake-build-system)
307 (arguments
3def739d
TGR
308 `(#:build-type "Release"
309 #:tests? #f ; no tests
f282aa53
JL
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)))
e9e83626 332 (home-page "https://glassechidna.com.au/heimdall/")
f282aa53
JL
333 (synopsis "Flash firmware onto Samsung mobile devices")
334 (description "@command{heimdall} is a tool suite used to flash firmware (aka
335ROMs) onto Samsung mobile devices. Heimdall connects to a mobile device over
336USB and interacts with low-level software running on the device, known as Loke.
337Loke and Heimdall communicate via the custom Samsung-developed protocol typically
338referred to as the \"Odin 3 protocol\".")
339 (license license:expat)))
501e1847
DM
340
341(define-public ifdtool
342 (package
343 (name "ifdtool")
7d4cbd99 344 (version "4.9")
501e1847
DM
345 (source (origin
346 (method git-fetch)
347 (uri (git-reference
b0e7b699 348 (url "https://github.com/coreboot/coreboot")
501e1847
DM
349 (commit version)))
350 (file-name (git-file-name name version))
351 (sha256
352 (base32
7d4cbd99 353 "0jidj29jh6p65d17k304wlzhxvp4p3c2namgcdwg2sxq8jfr0zlm"))))
501e1847
DM
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
7d4cbd99
TGR
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
501e1847
DM
368 (home-page "https://github.com/corna/me_cleaner/")
369 (synopsis "Intel Firmware Descriptor dumper")
ec0f3d0a 370 (description "This package provides @command{ifdtool}, a program to
501e1847
DM
371dump Intel Firmware Descriptor data of an image file.")
372 (license license:gpl2)))
9721c0b6
DM
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")
8e60743d 405 (synopsis "Intel Management Engine tools")
9721c0b6
DM
406 (description "This package provides tools for working with Intel
407Management 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.")
ca1499ce
LC
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"))))
0297a160
DM
414
415(define-public me-cleaner
416 (package
417 (name "me-cleaner")
9be26611 418 (version "1.2")
0297a160 419 (source (origin
db9b61bf
EF
420 (method git-fetch)
421 (uri (git-reference
b0e7b699 422 (url "https://github.com/corna/me_cleaner")
db9b61bf 423 (commit (string-append "v" version))))
0297a160
DM
424 (sha256
425 (base32
db9b61bf
EF
426 "1bdj2clm13ir441vn7sv860xsc5gh71ja5lc2wn0gggnff0adxj4"))
427 (file-name (git-file-name name version))))
0297a160
DM
428 (build-system python-build-system)
429 (arguments
430 `(#:phases
431 (modify-phases %standard-phases
9be26611
TGR
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))))))
0297a160
DM
438 (home-page "https://github.com/corna/me_cleaner")
439 (synopsis "Intel ME cleaner")
440 (description "This package provides tools for disabling Intel
441ME as far as possible (it only edits ME firmware image files).")
ca1499ce
LC
442 (license license:gpl3+)
443
444 ;; This is an Intel thing.
445 (supported-systems '("x86_64-linux" "i686-linux"))))
347bc151
DM
446
447(define-public uefitool
448 (package
449 (name "uefitool")
f6516d79 450 (version "0.27.0")
347bc151 451 (source (origin
1f4021b0
EF
452 (method git-fetch)
453 (uri (git-reference
b0e7b699 454 (url "https://github.com/LongSoft/UEFITool")
1f4021b0 455 (commit version)))
347bc151
DM
456 (sha256
457 (base32
f6516d79 458 "1i1p823qld927p4f1wcphqcnivb9mq7fi5xmzibxc3g9zzgnyc2h"))
1f4021b0 459 (file-name (git-file-name name version))))
347bc151
DM
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
477Unifinished Extensible Firmware Interface (UEFI) images.")
478 (license license:bsd-2)))