From e54ef8bb1679fe9fcd7acc92781f3697d54a6eca Mon Sep 17 00:00:00 2001 From: Ruslan Babayev Date: Wed, 1 Jun 2016 16:30:25 -0700 Subject: [PATCH 1/6] dpdk: add dependencies for vm_power_mgr example --- pkgs/os-specific/linux/dpdk/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/dpdk/default.nix b/pkgs/os-specific/linux/dpdk/default.nix index 479188b365f2..e414f4a1aa3e 100644 --- a/pkgs/os-specific/linux/dpdk/default.nix +++ b/pkgs/os-specific/linux/dpdk/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, kernel, fetchurl }: +{ stdenv, lib, kernel, fetchurl, pkgconfig, libvirt }: assert lib.versionAtLeast kernel.version "3.18"; @@ -11,6 +11,8 @@ stdenv.mkDerivation rec { sha256 = "0yrz3nnhv65v2jzz726bjswkn8ffqc1sr699qypc9m78qrdljcfn"; }; + buildInputs = [ pkgconfig libvirt ]; + RTE_KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"; RTE_TARGET = "x86_64-native-linuxapp-gcc"; From 6a7f257e88eb770a6dfd53174bc0cc3d9f1c88ad Mon Sep 17 00:00:00 2001 From: Ruslan Babayev Date: Tue, 31 May 2016 22:11:06 -0700 Subject: [PATCH 2/6] dpdk: install examples to bin --- pkgs/os-specific/linux/dpdk/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/dpdk/default.nix b/pkgs/os-specific/linux/dpdk/default.nix index e414f4a1aa3e..5781fee7ec45 100644 --- a/pkgs/os-specific/linux/dpdk/default.nix +++ b/pkgs/os-specific/linux/dpdk/default.nix @@ -32,8 +32,8 @@ stdenv.mkDerivation rec { mkdir $out cp -pr x86_64-native-linuxapp-gcc/{app,lib,include,kmod} $out/ - mkdir $examples - cp -pr examples/* $examples/ + mkdir -p $examples/bin + find examples -type f -executable -exec cp {} $examples/bin \; ''; meta = with stdenv.lib; { From 9f3c0f971650ce729df817916fa27e9138573931 Mon Sep 17 00:00:00 2001 From: Ruslan Babayev Date: Tue, 31 May 2016 22:27:36 -0700 Subject: [PATCH 3/6] dpdk: move apps to examples output --- pkgs/os-specific/linux/dpdk/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/dpdk/default.nix b/pkgs/os-specific/linux/dpdk/default.nix index 5781fee7ec45..a2657682f5d0 100644 --- a/pkgs/os-specific/linux/dpdk/default.nix +++ b/pkgs/os-specific/linux/dpdk/default.nix @@ -30,10 +30,10 @@ stdenv.mkDerivation rec { installPhase = '' mkdir $out - cp -pr x86_64-native-linuxapp-gcc/{app,lib,include,kmod} $out/ + cp -pr x86_64-native-linuxapp-gcc/{lib,include,kmod} $out/ mkdir -p $examples/bin - find examples -type f -executable -exec cp {} $examples/bin \; + find examples ${RTE_TARGET}/app -type f -executable -exec cp {} $examples/bin \; ''; meta = with stdenv.lib; { From 7334e925b44c7427d94fbc4959f04d654c14da9c Mon Sep 17 00:00:00 2001 From: Ruslan Babayev Date: Wed, 1 Jun 2016 16:35:35 -0700 Subject: [PATCH 4/6] dpdk: separate kernel modules --- pkgs/os-specific/linux/dpdk/default.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/dpdk/default.nix b/pkgs/os-specific/linux/dpdk/default.nix index a2657682f5d0..e90e8585776f 100644 --- a/pkgs/os-specific/linux/dpdk/default.nix +++ b/pkgs/os-specific/linux/dpdk/default.nix @@ -20,7 +20,7 @@ stdenv.mkDerivation rec { NIX_CFLAGS_COMPILE = [ "-march=core2" ]; enableParallelBuilding = true; - outputs = [ "out" "examples" ]; + outputs = [ "out" "kmod" "examples" ]; buildPhase = '' make T=x86_64-native-linuxapp-gcc config @@ -30,7 +30,10 @@ stdenv.mkDerivation rec { installPhase = '' mkdir $out - cp -pr x86_64-native-linuxapp-gcc/{lib,include,kmod} $out/ + cp -pr x86_64-native-linuxapp-gcc/{lib,include} $out/ + + mkdir -p $kmod/lib/modules/${kernel.modDirVersion}/kernel/drivers/net + cp ${RTE_TARGET}/kmod/*.ko $kmod/lib/modules/${kernel.modDirVersion}/kernel/drivers/net mkdir -p $examples/bin find examples ${RTE_TARGET}/app -type f -executable -exec cp {} $examples/bin \; From 49b985b241353663717c36e0f62a11a0d545a59f Mon Sep 17 00:00:00 2001 From: Ruslan Babayev Date: Tue, 31 May 2016 22:39:40 -0700 Subject: [PATCH 5/6] dpdk: make primary output usable as RTE_SDK --- pkgs/os-specific/linux/dpdk/default.nix | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/dpdk/default.nix b/pkgs/os-specific/linux/dpdk/default.nix index e90e8585776f..b346554c9c65 100644 --- a/pkgs/os-specific/linux/dpdk/default.nix +++ b/pkgs/os-specific/linux/dpdk/default.nix @@ -29,8 +29,25 @@ stdenv.mkDerivation rec { ''; installPhase = '' - mkdir $out - cp -pr x86_64-native-linuxapp-gcc/{lib,include} $out/ + install -m 0755 -d $out/lib + install -m 0644 ${RTE_TARGET}/lib/*.a $out/lib + + install -m 0755 -d $out/include + install -m 0644 ${RTE_TARGET}/include/*.h $out/include + + install -m 0755 -d $out/include/generic + install -m 0644 ${RTE_TARGET}/include/generic/*.h $out/include/generic + + install -m 0755 -d $out/include/exec-env + install -m 0644 ${RTE_TARGET}/include/exec-env/*.h $out/include/exec-env + + install -m 0755 -d $out/${RTE_TARGET} + install -m 0644 ${RTE_TARGET}/.config $out/${RTE_TARGET} + + install -m 0755 -d $out/${RTE_TARGET}/include + install -m 0644 ${RTE_TARGET}/include/rte_config.h $out/${RTE_TARGET}/include + + cp -pr mk scripts $out/ mkdir -p $kmod/lib/modules/${kernel.modDirVersion}/kernel/drivers/net cp ${RTE_TARGET}/kmod/*.ko $kmod/lib/modules/${kernel.modDirVersion}/kernel/drivers/net From 6d3fcd33d79b0a66b84912d1b7d36fcfc8656946 Mon Sep 17 00:00:00 2001 From: Ruslan Babayev Date: Wed, 1 Jun 2016 16:41:25 -0700 Subject: [PATCH 6/6] pktgen: init at 3.0.00 --- lib/maintainers.nix | 1 + pkgs/os-specific/linux/pktgen/default.nix | 38 +++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 3 files changed, 41 insertions(+) create mode 100644 pkgs/os-specific/linux/pktgen/default.nix diff --git a/lib/maintainers.nix b/lib/maintainers.nix index 198bb93c6be3..55b09925b5f6 100644 --- a/lib/maintainers.nix +++ b/lib/maintainers.nix @@ -11,6 +11,7 @@ abaldeau = "Andreas Baldeau "; abbradar = "Nikolay Amiantov "; aboseley = "Adam Boseley "; + abuibrahim = "Ruslan Babayev "; adev = "Adrien Devresse "; Adjective-Object = "Maxwell Huang-Hobbs "; adnelson = "Allen Nelson "; diff --git a/pkgs/os-specific/linux/pktgen/default.nix b/pkgs/os-specific/linux/pktgen/default.nix new file mode 100644 index 000000000000..56ef935920b8 --- /dev/null +++ b/pkgs/os-specific/linux/pktgen/default.nix @@ -0,0 +1,38 @@ +{ stdenv, fetchurl, dpdk, libpcap, utillinux }: + +stdenv.mkDerivation rec { + name = "pktgen-${version}"; + version = "3.0.00"; + + src = fetchurl { + url = "http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/pktgen-${version}.tar.gz"; + sha256 = "703f8bd615aa4ae3a3085055483f9889dda09d082abb58afd33c1ba7c766ea65"; + }; + + buildInputs = [ dpdk libpcap ]; + + RTE_SDK = "${dpdk}"; + RTE_TARGET = "x86_64-native-linuxapp-gcc"; + + enableParallelBuilding = true; + + patchPhase = '' + sed -i -e s:/usr/local:$out:g lib/lua/src/luaconf.h + sed -i -e s:/usr/bin/lscpu:${utillinux}/bin/lscpu:g lib/common/wr_lscpu.h + ''; + + installPhase = '' + install -d $out/bin + install -m 0755 app/app/${RTE_TARGET}/app/pktgen $out/bin + install -d $out/lib/lua/5.3 + install -m 0644 Pktgen.lua $out/lib/lua/5.3 + ''; + + meta = with stdenv.lib; { + description = "Traffic generator powered by DPDK"; + homepage = http://dpdk.org/; + license = licenses.bsdOriginal; + platforms = [ "x86_64-linux" ]; + maintainers = [ maintainers.abuibrahim ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1091807486be..1fd798503f3f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10844,6 +10844,8 @@ in dpdk = callPackage ../os-specific/linux/dpdk { }; + pktgen = callPackage ../os-specific/linux/pktgen { }; + e1000e = callPackage ../os-specific/linux/e1000e {}; v4l2loopback = callPackage ../os-specific/linux/v4l2loopback { };