3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #15919 from abuibrahim/master

dpdk: refactor to allow building extapps
This commit is contained in:
Domen Kožar 2016-06-02 17:25:53 +01:00
commit 55b8868baf
4 changed files with 69 additions and 6 deletions

View file

@ -11,6 +11,7 @@
abaldeau = "Andreas Baldeau <andreas@baldeau.net>";
abbradar = "Nikolay Amiantov <ab@fmap.me>";
aboseley = "Adam Boseley <adam.boseley@gmail.com>";
abuibrahim = "Ruslan Babayev <ruslan@babayev.com>";
adev = "Adrien Devresse <adev@adev.name>";
Adjective-Object = "Maxwell Huang-Hobbs <mhuan13@gmail.com>";
adnelson = "Allen Nelson <ithinkican@gmail.com>";

View file

@ -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";
@ -18,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
@ -27,11 +29,31 @@ stdenv.mkDerivation rec {
'';
installPhase = ''
mkdir $out
cp -pr x86_64-native-linuxapp-gcc/{app,lib,include,kmod} $out/
install -m 0755 -d $out/lib
install -m 0644 ${RTE_TARGET}/lib/*.a $out/lib
mkdir $examples
cp -pr examples/* $examples/
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
mkdir -p $examples/bin
find examples ${RTE_TARGET}/app -type f -executable -exec cp {} $examples/bin \;
'';
meta = with stdenv.lib; {

View file

@ -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 ];
};
}

View file

@ -10848,6 +10848,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 { };