tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
amd-ucodegen: init at 0-unstable-2017-06-07
d-brasher
2 years ago
69aeeff2
2731b928
+100
2 changed files
expand all
collapse all
unified
split
pkgs
by-name
am
amd-ucodegen
package.nix
test-platomav.nix
+60
pkgs/by-name/am/amd-ucodegen/package.nix
···
1
1
+
{
2
2
+
lib,
3
3
+
stdenv,
4
4
+
fetchFromGitHub,
5
5
+
fetchpatch,
6
6
+
nix-update-script,
7
7
+
callPackage,
8
8
+
}:
9
9
+
10
10
+
stdenv.mkDerivation (finalAttrs: {
11
11
+
pname = "amd-ucodegen";
12
12
+
version = "0-unstable-2017-06-07";
13
13
+
14
14
+
src = fetchFromGitHub {
15
15
+
owner = "AndyLavr";
16
16
+
repo = "amd-ucodegen";
17
17
+
rev = "0d34b54e396ef300d0364817e763d2c7d1ffff02";
18
18
+
hash = "sha256-pgmxzd8tLqdQ8Kmmhl05C5tMlCByosSrwx2QpBu3UB0=";
19
19
+
};
20
20
+
21
21
+
strictDeps = true;
22
22
+
23
23
+
patches = [
24
24
+
# Extract get_family function and validate processor family
25
25
+
# instead of processor ID
26
26
+
(fetchpatch {
27
27
+
name = "validate-family-not-id.patch";
28
28
+
url = "https://github.com/AndyLavr/amd-ucodegen/compare/0d34b54e396ef300d0364817e763d2c7d1ffff02...dobo90:amd-ucodegen:7a3c51e821df96910ecb05b22f3e4866b4fb85b2.patch";
29
29
+
hash = "sha256-jvsvu9QgXikwsxjPiTaRff+cOg/YQmKg1MYKyBoMRQI=";
30
30
+
})
31
31
+
];
32
32
+
33
33
+
installPhase = ''
34
34
+
runHook preInstall
35
35
+
36
36
+
install -Dm755 amd-ucodegen $out/bin/amd-ucodegen
37
37
+
38
38
+
runHook postInstall
39
39
+
'';
40
40
+
41
41
+
passthru = {
42
42
+
updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };
43
43
+
tests.platomav = callPackage ./test-platomav.nix { amd-ucodegen = finalAttrs.finalPackage; };
44
44
+
};
45
45
+
46
46
+
meta = {
47
47
+
description = "Tool to generate AMD microcode files";
48
48
+
longDescription = ''
49
49
+
This tool can be used to generate AMD microcode containers as used by the
50
50
+
Linux kernel. It accepts raw AMD microcode files such as those generated
51
51
+
by [MCExtractor](https://github.com/platomav/MCExtractor.git) as input.
52
52
+
The generated output file can be installed in /lib/firmware/amd-ucode.
53
53
+
'';
54
54
+
homepage = "https://github.com/AndyLavr/amd-ucodegen";
55
55
+
license = lib.licenses.gpl2Only;
56
56
+
platforms = lib.platforms.unix;
57
57
+
mainProgram = "amd-ucodegen";
58
58
+
maintainers = with lib.maintainers; [ d-brasher ];
59
59
+
};
60
60
+
})
+40
pkgs/by-name/am/amd-ucodegen/test-platomav.nix
···
1
1
+
{
2
2
+
stdenvNoCC,
3
3
+
fetchFromGitHub,
4
4
+
amd-ucodegen,
5
5
+
}:
6
6
+
7
7
+
stdenvNoCC.mkDerivation {
8
8
+
name = "amd-ucodegen-test-platomav";
9
9
+
meta.timeout = 60;
10
10
+
11
11
+
# Repository of dumped CPU microcodes
12
12
+
src = fetchFromGitHub {
13
13
+
owner = "platomav";
14
14
+
repo = "CPUMicrocodes";
15
15
+
rev = "dfc37d654cbe294acb0ec0274763321507dd7838";
16
16
+
hash = "sha256-Va+ErKID5iyKEee61tlrZwSpujxwMYPC+MAgZKUkrrM=";
17
17
+
};
18
18
+
19
19
+
nativeBuildInputs = [ amd-ucodegen ];
20
20
+
buildPhase = ''
21
21
+
runHook preBuild
22
22
+
23
23
+
echo -n "Test normal behavior with single input... "
24
24
+
[ "$(amd-ucodegen AMD/cpu00B40F40_ver0B40401A_2024-06-14_544DFCB8.bin)" \
25
25
+
== "CPU type 0xb40f40 [0xb440], file AMD/cpu00B40F40_ver0B40401A_2024-06-14_544DFCB8.bin" ]
26
26
+
echo "OK"
27
27
+
echo -n "Check output hash... "
28
28
+
[ "$(sha256sum microcode_amd_fam1ah.bin)" \
29
29
+
== "17f25ec78fa677803684e77ce01a21344b4b33463a964f61bae51b173543b190 microcode_amd_fam1ah.bin" ]
30
30
+
echo "OK"
31
31
+
echo -n "Ensure fail when bad processor ID... "
32
32
+
[ "$(amd-ucodegen AMD/cpu00000F00_ver02000008_2007-06-14_C3A923BB.bin 2>&1)" \
33
33
+
== "Bad processor ID 0x0n" ]
34
34
+
echo "OK"
35
35
+
36
36
+
touch $out
37
37
+
38
38
+
runHook postBuild
39
39
+
'';
40
40
+
}