2022-09-23 09:55:32 +08:00
|
|
|
{ stdenv, lib, kernel }:
|
|
|
|
|
|
|
|
|
|
|
|
let modDestDir = "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/wireless/realtek/r8169";
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "r8169-${kernel.version}-${version}";
|
2022-11-29 10:35:36 +08:00
|
|
|
version = "6.031.00";
|
2022-09-23 09:55:32 +08:00
|
|
|
|
|
|
|
src = ./r8169-${version}.tar.bz2;
|
|
|
|
|
|
|
|
hardeningDisable = [ "pic" ];
|
|
|
|
|
|
|
|
nativeBuildInputs = kernel.moduleBuildDependencies;
|
|
|
|
|
|
|
|
# rename to avoid conflict with totally broken piece of crap from mainline kernel
|
|
|
|
patchPhase =
|
|
|
|
''
|
|
|
|
substituteInPlace src/Makefile --replace r8169.o r8169-vendor.o
|
|
|
|
substituteInPlace src/Makefile --replace r8169-objs r8169-vendor-objs
|
|
|
|
'';
|
|
|
|
|
|
|
|
# avoid using the Makefile directly -- it doesn't understand
|
|
|
|
# any kernel but the current.
|
|
|
|
# based on the ArchLinux pkgbuild: https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/r8168
|
|
|
|
makeFlags = kernel.makeFlags ++ [
|
|
|
|
"-C ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
|
|
|
|
"M=$(PWD)/src"
|
|
|
|
"modules"
|
|
|
|
];
|
|
|
|
preBuild = ''
|
|
|
|
makeFlagsArray+=("EXTRA_CFLAGS=-DCONFIG_R8169_NAPI -DCONFIG_R8169_VLAN -DCONFIG_ASPM -DENABLE_S5WOL -DENABLE_EEE")
|
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p ${modDestDir}
|
|
|
|
find . -name '*.ko' -exec cp --parents '{}' ${modDestDir} \;
|
|
|
|
find ${modDestDir} -name '*.ko' -exec xz -f '{}' \;
|
|
|
|
'';
|
|
|
|
}
|