1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
{
lib,
stdenv,
fetchgit,
pkg-config,
zlib,
pciutils,
openssl,
coreutils,
acpica-tools,
makeWrapper,
go,
gnugrep,
gnused,
file,
buildEnv,
}:
let
version = "26.03";
commonMeta = {
description = "Various coreboot-related tools";
homepage = "https://www.coreboot.org";
license = with lib.licenses; [
gpl2Only
gpl2Plus
];
maintainers = with lib.maintainers; [
felixsinger
jmbaur
];
platforms = lib.platforms.linux;
};
generic =
{
pname,
path ? "util/${pname}",
...
}@args:
stdenv.mkDerivation (
finalAttrs:
{
inherit pname version;
src = fetchgit {
url = "https://review.coreboot.org/coreboot";
rev = finalAttrs.version;
hash = "sha256-gaJ9AP7g0KxOzZfg1dyNatC8/pl83pypeq5Lg+Qp1ys=";
};
enableParallelBuilding = true;
postPatch = ''
substituteInPlace 3rdparty/vboot/Makefile --replace 'ar qc ' '$$AR qc '
cd ${path}
patchShebangs .
'';
makeFlags = [
"INSTALL=install"
"PREFIX=${placeholder "out"}"
];
meta = commonMeta // args.meta;
}
// (removeAttrs args [ "meta" ])
);
utils = {
msrtool = generic {
pname = "msrtool";
meta.description = "Dump chipset-specific MSR registers";
meta.platforms = [
"x86_64-linux"
"i686-linux"
];
buildInputs = [
pciutils
zlib
];
preConfigure = "export INSTALL=install";
};
cbmem = generic {
pname = "cbmem";
meta.description = "Coreboot console log reader";
};
ifdtool = generic {
pname = "ifdtool";
meta.description = "Extract and dump Intel Firmware Descriptor information";
};
intelmetool = generic {
pname = "intelmetool";
meta.description = "Dump interesting things about Management Engine";
meta.platforms = [
"x86_64-linux"
"i686-linux"
];
buildInputs = [
pciutils
zlib
];
};
cbfstool = generic {
pname = "cbfstool";
meta.description = "Management utility for CBFS formatted ROM images";
};
nvramtool = generic {
pname = "nvramtool";
meta.description = "Read and write coreboot parameters and display information from the coreboot table in CMOS/NVRAM";
meta.mainProgram = "nvramtool";
meta.platforms = [
"x86_64-linux"
"i686-linux"
];
};
superiotool = generic {
pname = "superiotool";
meta.description = "User-space utility to detect Super I/O of a mainboard and provide detailed information about the register contents of the Super I/O";
meta.platforms = [
"x86_64-linux"
"i686-linux"
];
buildInputs = [
pciutils
zlib
];
};
ectool = generic {
pname = "ectool";
meta.description = "Dump the RAM of a laptop's Embedded/Environmental Controller (EC)";
meta.platforms = [
"x86_64-linux"
"i686-linux"
];
preInstall = "mkdir -p $out/sbin";
};
inteltool = generic {
pname = "inteltool";
meta.description = "Provides information about Intel CPU/chipset hardware configuration (register contents, MSRs, etc)";
meta.platforms = [
"x86_64-linux"
"i686-linux"
];
buildInputs = [
pciutils
zlib
];
};
amdfwtool = generic {
pname = "amdfwtool";
meta.description = "Create AMD firmware combination";
buildInputs = [ openssl ];
nativeBuildInputs = [ pkg-config ];
installPhase = ''
runHook preInstall
install -Dm755 amdfwtool $out/bin/amdfwtool
runHook postInstall
'';
};
acpidump-all = generic {
pname = "acpidump-all";
path = "util/acpi";
meta.description = "Walk through all ACPI tables with their addresses";
nativeBuildInputs = [ makeWrapper ];
dontBuild = true;
installPhase = ''
runHook preInstall
install -Dm755 acpidump-all $out/bin/acpidump-all
runHook postInstall
'';
postFixup = ''
wrapProgram $out/bin/acpidump-all \
--set PATH ${
lib.makeBinPath [
coreutils
acpica-tools
gnugrep
gnused
file
]
}
'';
};
# buildGoModule for some reason does not generate a binary
intelp2m = generic {
pname = "intelp2m";
version = "2.5";
env = {
VERSION = "2.5-${version}";
GOCACHE = "/tmp/go-cache";
};
nativeBuildInputs = [ go ];
installPhase = ''
runHook preInstall
install -Dm755 intelp2m $out/bin/intelp2m
runHook postInstall
'';
meta.description = "Convert the inteltool register dump to gpio.h with GPIO configuration for porting coreboot";
};
};
in
utils
// {
coreboot-utils = (
buildEnv {
pname = "coreboot-utils";
inherit version;
meta = commonMeta;
paths = lib.filter (lib.meta.availableOn stdenv.hostPlatform) (lib.attrValues utils);
postBuild = "rm -rf $out/sbin";
}
);
}
|