Merge pull request #210569 from Artturin/detunamekernel

This commit is contained in:
Artturi 2023-01-22 15:06:11 +02:00 committed by GitHub
commit f910c6dace
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 13 additions and 29 deletions

View File

@ -31,7 +31,6 @@ stdenv.mkDerivation {
preBuild = ''
substituteInPlace Makefile \
--replace "\$(shell uname -r)" "${kernel.modDirVersion}" \
--replace "/lib/modules" "${kernel.dev}/lib/modules"
'';

View File

@ -57,8 +57,12 @@ let
hasAttr getAttr optional optionals optionalString optionalAttrs maintainers platforms;
# Dependencies that are required to build kernel modules
moduleBuildDependencies = [ perl libelf ]
++ optional (lib.versionAtLeast version "5.13") zstd;
moduleBuildDependencies = [
perl
libelf
# module makefiles often run uname commands to find out the kernel version
(buildPackages.deterministic-uname.override { inherit modDirVersion; })
] ++ optional (lib.versionAtLeast version "5.13") zstd;
drvAttrs = config_: kernelConf: kernelPatches: configfile:
let

View File

@ -11,9 +11,9 @@ stdenv.mkDerivation rec {
version = mxu_version + "-${kernel.version}";
nativeBuildInputs = kernel.moduleBuildDependencies;
preBuild = ''
sed -i -e "s/\$(uname -r).*/${kernel.modDirVersion}/g" driver/mxconf
sed -i -e "s/\$(shell uname -r).*/${kernel.modDirVersion}/g" driver/Makefile
sed -i -e 's|/lib/modules|${kernel.dev}/lib/modules|' driver/mxconf
sed -i -e 's|/lib/modules|${kernel.dev}/lib/modules|' driver/Makefile
'';

View File

@ -14,7 +14,6 @@ stdenv.mkDerivation {
prePatch = ''
substituteInPlace ./Makefile \
--replace /lib/modules/ "${kernel.dev}/lib/modules/" \
--replace '$(shell uname -r)' "${kernel.modDirVersion}" \
--replace /sbin/depmod \# \
--replace '$(MODDESTDIR)' "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
'';
@ -30,9 +29,7 @@ stdenv.mkDerivation {
enableParallelBuilding = true;
nativeBuildInputs = [ bc ];
buildInputs = kernel.moduleBuildDependencies;
nativeBuildInputs = [ bc ] ++ kernel.moduleBuildDependencies;
preInstall = ''
mkdir -p "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"

View File

@ -17,7 +17,6 @@ stdenv.mkDerivation rec {
prePatch = ''
substituteInPlace ./Makefile --replace /lib/modules/ "${kernel.dev}/lib/modules/"
substituteInPlace ./Makefile --replace '$(shell uname -r)' "${kernel.modDirVersion}"
substituteInPlace ./Makefile --replace /sbin/depmod \#
substituteInPlace ./Makefile --replace '$(MODDESTDIR)' "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
'';

View File

@ -13,8 +13,7 @@ stdenv.mkDerivation {
hardeningDisable = [ "pic" ];
nativeBuildInputs = [ bc ];
buildInputs = kernel.moduleBuildDependencies;
nativeBuildInputs = [ bc ] ++ kernel.moduleBuildDependencies;
makeFlags = [
"ARCH=${stdenv.hostPlatform.linuxArch}"
@ -25,7 +24,6 @@ stdenv.mkDerivation {
postPatch = ''
substituteInPlace ./Makefile \
--replace /lib/modules/ "${kernel.dev}/lib/modules/" \
--replace '$(shell uname -r)' "${kernel.modDirVersion}" \
--replace "/sbin/depmod" "#" \
--replace '$(MODDESTDIR)' "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
'';

View File

@ -11,21 +11,18 @@ stdenv.mkDerivation rec {
sha256 = "sha256-BHC1DpWHv/1UvSfj6S5fo/ODZ1VDgLQO2A9EC+BR1JE=";
};
nativeBuildInputs = [ bc nukeReferences ];
buildInputs = kernel.moduleBuildDependencies;
nativeBuildInputs = [ bc nukeReferences ] ++ kernel.moduleBuildDependencies;
hardeningDisable = [ "pic" "format" ];
prePatch = ''
substituteInPlace ./Makefile \
--replace /lib/modules/ "${kernel.dev}/lib/modules/" \
--replace '$(shell uname -r)' "${kernel.modDirVersion}" \
--replace /sbin/depmod \# \
--replace '$(MODDESTDIR)' "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
'';
makeFlags = [
"ARCH=${stdenv.hostPlatform.linuxArch}"
"KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
("CONFIG_PLATFORM_I386_PC=" + (if stdenv.hostPlatform.isx86 then "y" else "n"))
("CONFIG_PLATFORM_ARM_RPI=" + (if stdenv.hostPlatform.isAarch then "y" else "n"))
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [

View File

@ -21,7 +21,6 @@ stdenv.mkDerivation {
prePatch = ''
substituteInPlace ./Makefile \
--replace /lib/modules/ "${kernel.dev}/lib/modules/" \
--replace '$(shell uname -r)' "${kernel.modDirVersion}" \
--replace /sbin/depmod \# \
--replace '$(MODDESTDIR)' "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
'';

View File

@ -11,8 +11,7 @@ stdenv.mkDerivation rec {
sha256 = "sha256-wx7xQBCfLu3UWB7ghp8dZ7OB2MFd5i8X0/ygyvW2K50=";
};
nativeBuildInputs = [ bc nukeReferences ];
buildInputs = kernel.moduleBuildDependencies;
nativeBuildInputs = [ bc nukeReferences ] ++ kernel.moduleBuildDependencies;
hardeningDisable = [ "pic" "format" ];
@ -20,7 +19,6 @@ stdenv.mkDerivation rec {
makeFlags = [
"ARCH=${stdenv.hostPlatform.linuxArch}"
"KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
("CONFIG_PLATFORM_I386_PC=" + (if stdenv.hostPlatform.isx86 then "y" else "n"))
("CONFIG_PLATFORM_ARM_RPI=" + (if (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) then "y" else "n"))
] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
@ -30,7 +28,6 @@ stdenv.mkDerivation rec {
prePatch = ''
substituteInPlace ./Makefile \
--replace /lib/modules/ "${kernel.dev}/lib/modules/" \
--replace '$(shell uname -r)' "${kernel.modDirVersion}" \
--replace /sbin/depmod \# \
--replace '$(MODDESTDIR)' "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
'';

View File

@ -30,7 +30,6 @@ stdenv.mkDerivation rec {
prePatch = ''
substituteInPlace ./Makefile \
--replace /lib/modules/ "${kernel.dev}/lib/modules/" \
--replace '$(shell uname -r)' "${kernel.modDirVersion}" \
--replace /sbin/depmod \# \
--replace '$(MODDESTDIR)' "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
'';

View File

@ -19,7 +19,6 @@ stdenv.mkDerivation rec {
prePatch = ''
substituteInPlace ./Makefile \
--replace /lib/modules/ "${kernel.dev}/lib/modules/" \
--replace '$(shell uname -r)' "${kernel.modDirVersion}" \
--replace /sbin/depmod \# \
--replace '$(MODDESTDIR)' "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
'';

View File

@ -19,7 +19,6 @@ stdenv.mkDerivation rec {
prePatch = ''
substituteInPlace ./Makefile \
--replace /lib/modules/ "${kernel.dev}/lib/modules/" \
--replace '$(shell uname -r)' "${kernel.modDirVersion}" \
--replace /sbin/depmod \# \
--replace '$(MODDESTDIR)' "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
'';

View File

@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
sha256 = "sha256-TpmpueKAaCe7Nlmv8pMvgMXGVmXVa/1mBwtEoy4JyCY=";
};
buildInputs = kernel.moduleBuildDependencies;
nativeBuildInputs = kernel.moduleBuildDependencies;
hardeningDisable = [ "pic" ];
@ -23,7 +23,6 @@ stdenv.mkDerivation rec {
prePatch = ''
substituteInPlace ./Makefile \
--replace /lib/modules/ "${kernel.dev}/lib/modules/" \
--replace '$(shell uname -r)' "${kernel.modDirVersion}" \
--replace /sbin/depmod \# \
--replace '$(MODDESTDIR)' "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
'';

View File

@ -20,14 +20,12 @@ stdenv.mkDerivation rec {
postPatch = ''
substituteInPlace Makefile \
--replace '/lib/modules/$(VM_UNAME)/misc' "$out/lib/modules/${kernel.modDirVersion}/misc" \
--replace '$(shell uname -r)' "${kernel.modDirVersion}" \
--replace /sbin/modinfo "${kmod}/bin/modinfo" \
--replace 'test -z "$(DESTDIR)"' "0"
for module in "vmmon-only" "vmnet-only"; do
substituteInPlace "./$module/Makefile" \
--replace '/lib/modules/' "${kernel.dev}/lib/modules/" \
--replace '$(shell uname -r)' "${kernel.modDirVersion}" \
--replace /bin/grep "${gnugrep}/bin/grep"
done
'';