From 27f355c1e3dcbcceea8556cced38193f0746e76f Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Wed, 25 Mar 2015 14:44:19 -0700 Subject: [PATCH] microcode-amd: Update to early loading --- pkgs/os-specific/linux/microcode/amd.nix | 35 ++++++++++++++---------- pkgs/top-level/all-packages.nix | 3 +- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/pkgs/os-specific/linux/microcode/amd.nix b/pkgs/os-specific/linux/microcode/amd.nix index 0ca33fa31f04..76a340529910 100644 --- a/pkgs/os-specific/linux/microcode/amd.nix +++ b/pkgs/os-specific/linux/microcode/amd.nix @@ -1,25 +1,30 @@ -{ stdenv, fetchurl }: +{ stdenv, fetchurl, firmwareLinuxNonfree, libarchive }: stdenv.mkDerivation rec { - name = "amd-ucode-2012-09-10"; + name = "amd-ucode-${firmwareLinuxNonfree.version}"; - src = fetchurl { - urls = - [ "http://pkgs.fedoraproject.org/repo/pkgs/microcode_ctl/${name}.tar/559bc355d3799538584add80df2996f0/${name}.tar" - "http://www.amd64.org/pub/microcode/${name}.tar" - ]; - sha256 = "065phvhx5hx5ssdd1x2p5m1yv26ak7l5aaw6yk6h95x9mxn5r111"; - }; + src = firmwareLinuxNonfree; - installPhase = '' - mkdir -p $out/lib/firmware/amd-ucode $out/share/doc/amd-ucode - mv microcode_amd_fam15h.bin microcode_amd.bin $out/lib/firmware/amd-ucode/ - mv LICENSE $out/share/doc/amd-ucode + sourceRoot = "."; + + buildInputs = [ libarchive ]; + + buildPhase = '' + mkdir -p kernel/x86/microcode + find ${firmwareLinuxNonfree}/lib/firmware/amd-ucode -name \*.bin \ + -exec sh -c 'cat {} >> kernel/x86/microcode/AuthenticAMD.bin' \; ''; - meta = { + installPhase = '' + mkdir -p $out + echo kernel/x86/microcode/AuthenticAMD.bin | bsdcpio -o -H newc -R 0:0 > $out/amd-ucode.img + ''; + + meta = with stdenv.lib; { description = "AMD Processor microcode patch"; homepage = http://www.amd64.org/support/microcode.html; - license = stdenv.lib.licenses.unfreeRedistributableFirmware; + license = licenses.unfreeRedistributableFirmware; + maintainers = with maintainers; [ wkennington ]; + platforms = platforms.linux; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7b2560d04c1c..c77593e027a7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8595,8 +8595,6 @@ let afuse = callPackage ../os-specific/linux/afuse { }; - amdUcode = callPackage ../os-specific/linux/microcode/amd.nix { }; - autofs5 = callPackage ../os-specific/linux/autofs/autofs-v5.nix { }; _915resolution = callPackage ../os-specific/linux/915resolution { }; @@ -8626,6 +8624,7 @@ let alsaUtils = callPackage ../os-specific/linux/alsa-utils { }; alsaOss = callPackage ../os-specific/linux/alsa-oss { }; + microcodeAmd = callPackage ../os-specific/linux/microcode/amd.nix { }; microcodeIntel = callPackage ../os-specific/linux/microcode/intel.nix { };