gnu: Add memtest86+.
[jackhill/guix/guix.git] / gnu / packages / hardware.scm
CommitLineData
aadd1d24
TGR
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (gnu packages hardware)
20 #:use-module (gnu packages compression)
5eff4380 21 #:use-module (gnu packages gcc)
aadd1d24
TGR
22 #:use-module (gnu packages glib)
23 #:use-module (gnu packages libusb)
24 #:use-module (gnu packages linux)
25 #:use-module (gnu packages pkg-config)
26 #:use-module (gnu packages xdisorg)
27 #:use-module (gnu packages xorg)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix download)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix packages))
32
33;; This is a module for packages related to physical hardware that don't (yet)
34;; have a more specific home like gps.scm, security-token.scm, &c.
35
36(define-public ddcutil
37 (package
38 (name "ddcutil")
39 (version "0.9.1")
40 (source
41 (origin
42 (method url-fetch)
43 (uri (string-append "https://www.ddcutil.com/tarballs/"
44 name "-" version ".tar.gz"))
45 (sha256
46 (base32 "1b4bm3zhk5vnad6fxf0mn8nrlj3fngifl7nzxgxw0n56hlv7ccv0"))))
47 (build-system gnu-build-system)
48 (native-inputs
49 `(("pkg-config" ,pkg-config)))
50 (inputs
51 `(("eudev" ,eudev)
52 ("glib" ,glib)
53 ("libdrm" ,libdrm) ; enhanced diagnostics
54 ("libusb" ,libusb) ; support USB monitors
55 ("libx11" ,libx11) ; enhanced diagnostics
56 ("libxrandr" ,libxrandr)
57 ("zlib" ,zlib)))
58 (home-page "https://www.ddcutil.com/")
59 (synopsis "Control external monitor settings")
60 (description
61 "ddcutil can query and modify most external monitors' settings, such as
62brightness, colour levels, and input sources. Generally speaking, any setting
63that can be changed by pressing buttons on the monitor can be modified by
64ddcutil.
65
66ddcutil communicates directly with monitors implementing the Monitor Control
67Command Set (@dfn{MCCS}). It usually does so through the the Display Data
68Channel Command Interface (@dfn{DDC/CI}) protocol on the I2C bus, but can also
69communicate over USB as per the USB Monitor Control Class Specification.
70
71One particular use case is in colour profile management. Monitor calibration
72is relative to the monitor colour settings currently in effect, e.g. red gain.
73ddcutil allows colour-related settings to be saved at the time a monitor is
74calibrated, and restored when the calibration is applied.")
75 (license (list license:bsd-3 ; FindDDCUtil.cmake
76 license:gpl2+)))) ; everything else
6e8c75b8 77
5eff4380
TGR
78;; Distinct from memtest86, which is obsolete.
79(define-public memtest86+
80 (package
81 (name "memtest86+")
82 ;; Update the description when/if UEFI support is released.
83 (version "5.01")
84 (source
85 (origin
86 (method url-fetch)
87 (uri (string-append "https://www.memtest.org/download/5.01/memtest86+-"
88 version ".tar.gz"))
89 (sha256
90 (base32 "0fch1l55753y6jkk0hj8f6vw4h1kinkn9ysp22dq5g9zjnvjf88l"))))
91 (build-system gnu-build-system)
92 (arguments
93 `(#:system "i686-linux" ; the result runs outside of any OS
94 #:tests? #f ; no way to test this
95 #:phases
96 (modify-phases %standard-phases
97 (delete 'configure) ; no configure script
98 (replace 'build
99 ;; The default 'make all' does wonderful things, like scp(1) a file to
100 ;; 192.168.0.12. Build the bootable images and nothing more.
101 (lambda _
102 (invoke "make"
103 "memtest" ; ELF executable
104 "memtest.bin"))) ; DOS/MBR boot sector
105 (replace 'install
106 (lambda* (#:key outputs #:allow-other-keys)
107 (let* ((out (assoc-ref outputs "out"))
108 (lib (string-append out "/lib/memtest86+"))
109 (doc (string-append out "/share/doc/memtest86+-" ,version)))
110 (for-each
111 (lambda (file)
112 (install-file file lib))
113 (list "memtest"
114 "memtest.bin"))
115 (for-each
116 (lambda (file)
117 (install-file file doc))
118 (list "FAQ"
119 "README"))))))))
120 (native-inputs
121 ;; Newer GCCs fail with a deluge of "multiple definition of `__foo'" errors.
122 `(("gcc" ,gcc-4.9)))
123 (supported-systems (list "i686-linux" "x86_64-linux"))
124 (home-page "https://www.memtest.org/")
125 (synopsis "Thorough real-mode memory tester")
126 (description
127 "Memtest86+ is a thorough, stand-alone memory test for x86 systems. It
128repeatedly writes different patterns to all memory locations, reads them back
129again, and verifies whether the result is the same as what was written. This
130can help debug even intermittent and non-deterministic errors.
131
132It runs independently of any operating system, at computer boot-up, so that it
133can scan as much of your RAM as possible for hardware defects.
134
135Memtest86+ cannot currently be used on computers booted with UEFI.")
136 (license license:gpl2)))
137
6e8c75b8
TGR
138(define-public msr-tools
139 (package
140 (name "msr-tools")
141 (version "1.3")
142 (source
143 (origin
144 (method url-fetch)
145 (uri (string-append "https://01.org/sites/default/files/downloads/"
146 name "/" name "-" version ".zip"))
147 (sha256
148 (base32 "07hxmddg0l31kjfmaq84ni142lbbvgq6391r8bd79wpm819pnigr"))))
149 (build-system gnu-build-system)
150 (arguments
151 `(#:make-flags
152 (list (string-append "sbindir=" (assoc-ref %outputs "out") "/sbin"))
153 #:phases
154 (modify-phases %standard-phases
155 (delete 'configure) ; no configure script
156 (add-before 'install 'create-output-directory
157 (lambda* (#:key outputs #:allow-other-keys)
158 ;; 'make install' assumes that sbindir exists.
159 (let* ((out (assoc-ref outputs "out"))
160 (sbin (string-append out "/sbin")))
161 (mkdir-p sbin)
162 #t))))
163 #:tests? #f)) ; no test suite
164 (native-inputs
165 `(("unzip" ,unzip)))
166 ;; These registers and the CPUID instruction only exist on (most) x86 chips.
167 (supported-systems (list "i686-linux" "x86_64-linux"))
168 (home-page "https://01.org/msr-tools/")
169 (synopsis "Read and write Model-Specific Registers (@dfn{MSR})")
170 (description
171 "The MSR Tools project provides console utilities to directly access the
172Model-Specific Registers (@dfn{MSR}s) and CPU ID of Intel-compatible processors:
173
174@itemize
175@item @command{cpuid}: show identification and feature information of any CPU
176@item @command{rdmsr}: read MSRs from any CPU or all CPUs
177@item @command{wrmsr}: write to MSRs on any CPU or all CPUs
178@end itemize
179
180These tools can be used to query and modify certain low-level CPU parameters,
181such as the Turbo Boost ratio and Thermal Design Power (@dfn{TDP}) limits.
182
183MSR addresses differ (greatly) between processors, and any such modification can
184be dangerous and may void your CPU or system board's warranty.")
185 (license license:gpl2))) ; cpuid.c is gpl2, {rd,wr}msr.c are gpl2+