linuxManualConfig: expose moduleMakeFlags for out-of-tree module builds

This commit is contained in:
K900
2025-01-23 13:55:25 +03:00
parent 276af645fd
commit c805021f3a
+25 -12
View File
@@ -421,18 +421,9 @@ let
timeout = 14400; # 4 hours
} // extraMeta;
};
in
stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.linux-kernel kernelPatches configfile) // {
inherit pname version;
enableParallelBuilding = true;
hardeningDisable = [ "bindnow" "format" "fortify" "stackprotector" "pic" "pie" ];
# Absolute paths for compilers avoid any PATH-clobbering issues.
makeFlags = [
"O=$(buildRoot)"
commonMakeFlags = [
"ARCH=${stdenv.hostPlatform.linuxArch}"
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
] ++ lib.optionals (stdenv.isx86_64 && stdenv.cc.bintools.isLLVM) [
@@ -444,5 +435,27 @@ stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.linux-kernel kernelPat
] ++ (stdenv.hostPlatform.linux-kernel.makeFlags or [])
++ extraMakeFlags;
karch = stdenv.hostPlatform.linuxArch;
} // (optionalAttrs (pos != null) { inherit pos; })))
finalKernel = stdenv.mkDerivation (
builtins.foldl' lib.recursiveUpdate {} [
(drvAttrs config stdenv.hostPlatform.linux-kernel kernelPatches configfile)
{
inherit pname version;
enableParallelBuilding = true;
hardeningDisable = [ "bindnow" "format" "fortify" "stackprotector" "pic" "pie" ];
makeFlags = [
"O=$(buildRoot)"
] ++ commonMakeFlags;
passthru.moduleMakeFlags = [
"KBUILD_OUTPUT=${finalKernel.dev}/lib/modules/${finalKernel.modDirVersion}/build"
] ++ commonMakeFlags;
karch = stdenv.hostPlatform.linuxArch;
}
(optionalAttrs (pos != null) { inherit pos; })
]
);
in finalKernel)