amd-ucodegen: init at 0-unstable-2017-06-07

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