2022-01-13 20:06:32 +00:00
|
|
|
{ lib, stdenv, linux-firmware, libarchive }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2022-01-25 03:21:06 +00:00
|
|
|
pname = "amd-ucode";
|
|
|
|
version = linux-firmware.version;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
src = linux-firmware;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
sourceRoot = ".";
|
|
|
|
|
|
|
|
buildInputs = [ libarchive ];
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
mkdir -p kernel/x86/microcode
|
2022-04-15 01:41:22 +00:00
|
|
|
find ${linux-firmware}/lib/firmware/amd-ucode -name \*.bin -print0 | sort -z |\
|
|
|
|
xargs -0 -I{} sh -c 'cat {} >> kernel/x86/microcode/AuthenticAMD.bin'
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
2022-04-15 01:41:22 +00:00
|
|
|
touch -d @$SOURCE_DATE_EPOCH kernel/x86/microcode/AuthenticAMD.bin
|
|
|
|
echo kernel/x86/microcode/AuthenticAMD.bin | bsdtar --uid 0 --gid 0 -cnf - -T - | bsdtar --null -cf - --format=newc @- > $out/amd-ucode.img
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "AMD Processor microcode patch";
|
2020-09-25 04:45:31 +00:00
|
|
|
homepage = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.unfreeRedistributableFirmware;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|