microcode-intel: enable building on platforms other than x86_64-linux

iucode_tool is ran on x86_64-linux, so we must use an emulator to run
it.
This commit is contained in:
Jared Baur
2025-02-09 12:56:08 -08:00
parent 0c07f630e1
commit 9c20cc62cf
+3 -5
View File
@@ -4,6 +4,7 @@
fetchFromGitHub,
libarchive,
iucode-tool,
buildPackages,
}:
stdenv.mkDerivation rec {
@@ -17,16 +18,13 @@ stdenv.mkDerivation rec {
hash = "sha256-dvXt4SX/90oFM4GR9R7C2udhZ+plxnabOZpbtwN3V8Q=";
};
nativeBuildInputs = [
iucode-tool
libarchive
];
nativeBuildInputs = [ libarchive ];
installPhase = ''
runHook preInstall
mkdir -p $out kernel/x86/microcode
iucode_tool -w kernel/x86/microcode/GenuineIntel.bin intel-ucode/
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe iucode-tool} -w kernel/x86/microcode/GenuineIntel.bin intel-ucode/
touch -d @$SOURCE_DATE_EPOCH kernel/x86/microcode/GenuineIntel.bin
echo kernel/x86/microcode/GenuineIntel.bin | bsdtar --uid 0 --gid 0 -cnf - -T - | bsdtar --null -cf - --format=newc @- > $out/intel-ucode.img