From 5ab992b43add5fd936804ce863cf7d3c2aa53914 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Mon, 17 Jan 2022 15:50:14 +0300 Subject: [PATCH 1/4] dpdk: wrap python scripts --- pkgs/os-specific/linux/dpdk/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/os-specific/linux/dpdk/default.nix b/pkgs/os-specific/linux/dpdk/default.nix index 7592be483f53..1ec3d552fb36 100644 --- a/pkgs/os-specific/linux/dpdk/default.nix +++ b/pkgs/os-specific/linux/dpdk/default.nix @@ -37,6 +37,7 @@ in stdenv.mkDerivation rec { numactl openssl.dev zlib + python3 ] ++ lib.optionals mod kernel.moduleBuildDependencies; # Propagated to support current DPDK users in nixpkgs which statically link From d15130584f974f9d8a7680f4da713d0889599040 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Tue, 25 Jan 2022 23:28:25 +0900 Subject: [PATCH 2/4] dpdk: move libbsd to propagated inputs It is required in pkgconfig file. --- pkgs/os-specific/linux/dpdk/default.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/linux/dpdk/default.nix b/pkgs/os-specific/linux/dpdk/default.nix index 1ec3d552fb36..86049eca01d3 100644 --- a/pkgs/os-specific/linux/dpdk/default.nix +++ b/pkgs/os-specific/linux/dpdk/default.nix @@ -31,7 +31,6 @@ in stdenv.mkDerivation rec { buildInputs = [ jansson libbpf - libbsd libelf libpcap numactl @@ -40,10 +39,12 @@ in stdenv.mkDerivation rec { python3 ] ++ lib.optionals mod kernel.moduleBuildDependencies; - # Propagated to support current DPDK users in nixpkgs which statically link - # with the framework (e.g. odp-dpdk). propagatedBuildInputs = [ + # Propagated to support current DPDK users in nixpkgs which statically link + # with the framework (e.g. odp-dpdk). rdma-core + # Requested by pkg-config. + libbsd ]; postPatch = '' From 2c0b4b8510da45085a9f6b332208a3fc0f66e001 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Wed, 26 Jan 2022 00:17:18 +0900 Subject: [PATCH 3/4] dpdk: restore rte_kni module build As a bonus, split doc output. --- pkgs/os-specific/linux/dpdk/default.nix | 19 +++++-------------- pkgs/top-level/linux-kernels.nix | 2 ++ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/pkgs/os-specific/linux/dpdk/default.nix b/pkgs/os-specific/linux/dpdk/default.nix index 86049eca01d3..0c44945620c4 100644 --- a/pkgs/os-specific/linux/dpdk/default.nix +++ b/pkgs/os-specific/linux/dpdk/default.nix @@ -49,6 +49,9 @@ in stdenv.mkDerivation rec { postPatch = '' patchShebangs config/arm buildtools + '' + lib.optionalString mod '' + # kernel_install_dir is hardcoded to `/lib/modules`; patch that. + sed -i "s,kernel_install_dir *= *['\"].*,kernel_install_dir = '$kmod/lib/modules/${kernel.modDirVersion}'," kernel/linux/meson.build ''; mesonFlags = [ @@ -61,21 +64,9 @@ in stdenv.mkDerivation rec { ++ lib.optional (!shared) "-Ddefault_library=static" ++ lib.optional stdenv.isx86_64 "-Dmachine=nehalem" ++ lib.optional stdenv.isAarch64 "-Dmachine=generic" - ++ lib.optional mod "-Dkernel_dir=${placeholder "kmod"}/lib/modules/${kernel.modDirVersion}" + ++ lib.optional mod "-Dkernel_dir=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" ++ lib.optional (withExamples != []) "-Dexamples=${builtins.concatStringsSep "," withExamples}"; - # dpdk meson script does not support separate kernel source and installion - # dirs (except via destdir), so we temporarily link the former into the latter. - preConfigure = lib.optionalString mod '' - mkdir -p $kmod/lib/modules/${kernel.modDirVersion} - ln -sf ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build \ - $kmod/lib/modules/${kernel.modDirVersion} - ''; - - postBuild = lib.optionalString mod '' - rm -f $kmod/lib/modules/${kernel.modDirVersion}/build - ''; - postInstall = '' # Remove Sphinx cache files. Not only are they not useful, but they also # contain store paths causing spurious dependencies. @@ -84,7 +75,7 @@ in stdenv.mkDerivation rec { find examples -type f -executable -exec install {} $out/bin \; ''; - outputs = [ "out" ] ++ lib.optional mod "kmod"; + outputs = [ "out" "doc" ] ++ lib.optional mod "kmod"; meta = with lib; { description = "Set of libraries and drivers for fast packet processing"; diff --git a/pkgs/top-level/linux-kernels.nix b/pkgs/top-level/linux-kernels.nix index 232169ab07d1..8c4b1e9f8101 100644 --- a/pkgs/top-level/linux-kernels.nix +++ b/pkgs/top-level/linux-kernels.nix @@ -288,6 +288,8 @@ in { dpdk-kmods = callPackage ../os-specific/linux/dpdk-kmods { }; + dpdk = pkgs.dpdk.override { inherit kernel; }; + exfat-nofuse = callPackage ../os-specific/linux/exfat { }; evdi = callPackage ../os-specific/linux/evdi { }; From 5aa4697af41090b89a84209043e5193a681df616 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Wed, 26 Jan 2022 23:29:01 +0900 Subject: [PATCH 4/4] dpdk: split examples, wrap dpdk-devbind --- pkgs/os-specific/linux/dpdk/default.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pkgs/os-specific/linux/dpdk/default.nix b/pkgs/os-specific/linux/dpdk/default.nix index 0c44945620c4..1e4f50e42df3 100644 --- a/pkgs/os-specific/linux/dpdk/default.nix +++ b/pkgs/os-specific/linux/dpdk/default.nix @@ -1,9 +1,9 @@ { stdenv, lib , kernel , fetchurl -, pkg-config, meson, ninja +, pkg-config, meson, ninja, makeWrapper , libbsd, numactl, libbpf, zlib, libelf, jansson, openssl, libpcap, rdma-core -, doxygen, python3 +, doxygen, python3, pciutils , withExamples ? [] , shared ? false }: @@ -20,6 +20,7 @@ in stdenv.mkDerivation rec { }; nativeBuildInputs = [ + makeWrapper doxygen meson ninja @@ -71,11 +72,18 @@ in stdenv.mkDerivation rec { # Remove Sphinx cache files. Not only are they not useful, but they also # contain store paths causing spurious dependencies. rm -rf $out/share/doc/dpdk/html/.doctrees + + wrapProgram $out/bin/dpdk-devbind.py \ + --prefix PATH : "${lib.makeBinPath [ pciutils ]}" '' + lib.optionalString (withExamples != []) '' - find examples -type f -executable -exec install {} $out/bin \; + mkdir -p $examples/bin + find examples -type f -executable -exec install {} $examples/bin \; ''; - outputs = [ "out" "doc" ] ++ lib.optional mod "kmod"; + outputs = + [ "out" "doc" ] + ++ lib.optional mod "kmod" + ++ lib.optional (withExamples != []) "examples"; meta = with lib; { description = "Set of libraries and drivers for fast packet processing";