syzkaller: use cross compilation in build

This doesn't change anything if targetSystem==hostSystem, but it
allows fuzzing e.g. a x86_64-linux guest on aarch64-darwin.
This commit is contained in:
George Huebner
2025-07-22 19:40:57 +02:00
committed by Jörg Thalheim
parent 03e72fc2f4
commit f08d5fcc17
+18 -1
View File
@@ -5,6 +5,17 @@
go,
ncurses,
}:
let
cpus = {
"x86_64" = "amd64";
"i686" = "386";
"aarch64" = "arm64";
};
targetSystem = lib.systems.parse.mkSystemFromString stdenv.targetPlatform.system;
targetOS = targetSystem.kernel.name;
targetArch = cpus.${targetSystem.cpu.name};
targetVMArch = cpus.${(lib.systems.parse.mkSystemFromString stdenv.hostPlatform.system).cpu.name};
in
stdenv.mkDerivation (finalAttrs: {
pname = "syzkaller";
version = "0-unstable-2024-01-09";
@@ -47,6 +58,12 @@ stdenv.mkDerivation (finalAttrs: {
runHook postConfigure
'';
makeFlags = [
"TARGETOS=${targetOS}"
"TARGETVMARCH=${targetVMArch}"
"TARGETARCH=${targetArch}"
];
dontInstall = true;
meta = {
@@ -54,7 +71,7 @@ stdenv.mkDerivation (finalAttrs: {
homepage = "https://github.com/google/syzkaller";
license = lib.licenses.asl20;
maintainers = [ lib.maintainers.msanft ];
platforms = lib.platforms.linux;
platforms = lib.platforms.unix;
mainProgram = "syz-manager";
};
})