Add dpdk development packaging

Change-Id: I6aa2a6709241d99ce734c29e47487eb456907351
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/Makefile b/Makefile
index f1813a3..71eec08 100644
--- a/Makefile
+++ b/Makefile
@@ -30,6 +30,12 @@
 OS_VERSION_ID= $(shell grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
 endif
 
+ifeq ($(OS_ID),ubuntu)
+PKG=deb
+else ifeq ($(OS_ID),centos)
+PKG=rpm
+endif
+
 DEB_DEPENDS  = curl build-essential autoconf automake bison libssl-dev ccache
 DEB_DEPENDS += debhelper dkms git libtool libganglia1-dev libapr1-dev dh-systemd
 DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope pkg-config
@@ -84,6 +90,7 @@
 	@echo " run-vat             - run vpp-api-test tool"
 	@echo " pkg-deb             - build DEB packages"
 	@echo " pkg-rpm             - build RPM packages"
+	@echo " dpdk-install-dev    - install DPDK development packages"
 	@echo " ctags               - (re)generate ctags database"
 	@echo " gtags               - (re)generate gtags database"
 	@echo " cscope              - (re)generate cscope database"
@@ -295,6 +302,9 @@
 pkg-rpm: dist
 	$(call make,$(PLATFORM),install-rpm)
 
+dpdk-install-dev:
+	make -C dpdk install-$(PKG)
+
 ctags: ctags.files
 	@ctags --totals --tag-relative -L $<
 	@rm $<
@@ -340,26 +350,19 @@
 	@echo " "
 endef
 
-verify: install-dep $(BR)/.bootstrap.ok
+verify: install-dep $(BR)/.bootstrap.ok dpdk-install-dev
 	$(call banner,"Building for PLATFORM=vpp using gcc")
 	@make -C build-root PLATFORM=vpp TAG=vpp wipe-all install-packages
 	$(call banner,"Building for PLATFORM=vpp_lite using gcc")
 	@make -C build-root PLATFORM=vpp_lite TAG=vpp_lite wipe-all install-packages
-ifeq ($(OS_ID),ubuntu)
-ifeq ($(OS_VERSION_ID),16.04)
+ifeq ($(OS_ID)-$(OS_VERSION_ID),ubuntu-16.04)
 	$(call banner,"Installing dependencies")
 	@sudo -E apt-get update
 	@sudo -E apt-get $(CONFIRM) $(FORCE) install clang
 	$(call banner,"Building for PLATFORM=vpp using clang")
 	@make -C build-root CC=clang PLATFORM=vpp TAG=vpp_clang wipe-all install-packages
 endif
-	$(call banner,"Building deb packages")
-	@make pkg-deb
-endif
-ifeq ($(OS_ID),centos)
-	$(call banner,"Building rpm packages")
-	@make pkg-rpm
-endif
-	@make test
+	$(call banner,"Building $(PKG) packages")
+	@make pkg-$(PKG)
 
 
diff --git a/build-data/packages/dpdk.mk b/build-data/packages/dpdk.mk
index 2dcf409..6c13682 100644
--- a/build-data/packages/dpdk.mk
+++ b/build-data/packages/dpdk.mk
@@ -42,8 +42,8 @@
 DPDK_MAKE_ARGS += DPDK_MAKE_EXTRA_ARGS="$(DPDK_MAKE_EXTRA_ARGS)"
 endif
 
-dpdk_configure = echo 
+dpdk_configure = echo
 
-dpdk_make_args = $(DPDK_MAKE_ARGS) config
+dpdk_make_args = $(DPDK_MAKE_ARGS) ebuild-build
 
-dpdk_install =  make $(DPDK_MAKE_ARGS) build
+dpdk_install =  make $(DPDK_MAKE_ARGS) ebuild-install
diff --git a/build-data/packages/vpp.mk b/build-data/packages/vpp.mk
index fe68cd8..81aeab6 100644
--- a/build-data/packages/vpp.mk
+++ b/build-data/packages/vpp.mk
@@ -19,8 +19,9 @@
 vpp_LDFLAGS += -L$($(PLATFORM)_dpdk_lib_dir)
 else
 vpp_configure_depend += dpdk-install
-vpp_CPPFLAGS += $(call installed_includes_fn, dpdk)
+vpp_CPPFLAGS += $(call installed_includes_fn, dpdk)/dpdk
 vpp_LDFLAGS += $(call installed_libs_fn, dpdk)
+vpp_CPPFLAGS += -I/usr/include/dpdk
 endif
 ifeq ($($(PLATFORM)_uses_dpdk_cryptodev),yes)
 vpp_configure_args += --with-dpdk-crypto
diff --git a/build-data/platforms.mk b/build-data/platforms.mk
index 4183675..2351898 100644
--- a/build-data/platforms.mk
+++ b/build-data/platforms.mk
@@ -63,10 +63,6 @@
 	./scripts/find-vpp-api-python-contents $(INSTALL_PREFIX)$(ARCH)	\
 	 deb/debian/vpp-api-python.install ;				\
 									\
-	: dpdk headers ;						\
-	./scripts/find-dpdk-contents $(INSTALL_PREFIX)$(ARCH)		\
-	 deb/debian/vpp-dpdk-dev.install ;				\
-									\
 	: bin package needs startup config ; 				\
 	echo ../../src/vpp/conf/startup.conf /etc/vpp 			\
 	   >> deb/debian/vpp.install ;					\
diff --git a/build-root/Makefile b/build-root/Makefile
index 6e26e90..8b83990 100644
--- a/build-root/Makefile
+++ b/build-root/Makefile
@@ -1167,5 +1167,4 @@
 	rm -rf $(MU_BUILD_ROOT_DIR)/python
 	if [ -e /usr/bin/dh ];then (cd $(MU_BUILD_ROOT_DIR)/deb/;debian/rules clean); fi
 	rm -f $(MU_BUILD_ROOT_DIR)/deb/debian/*.install
-	rm -f $(MU_BUILD_ROOT_DIR)/deb/debian/*.dkms
 	rm -f $(MU_BUILD_ROOT_DIR)/deb/debian/changelog
diff --git a/build-root/deb/debian/.gitignore b/build-root/deb/debian/.gitignore
index c5e915a..7b1028d 100644
--- a/build-root/deb/debian/.gitignore
+++ b/build-root/deb/debian/.gitignore
@@ -3,12 +3,9 @@
 *debhelper*
 *.substvars
 *.install
-vpp-dpdk-dkms*
 vpp/
 vpp-dev/
 vpp-lib/
-vpp-dpdk-dev/
-vpp-dpdk-dkms/
 vpp-dbg/
 vppctl/
 vpp-api-lua/
diff --git a/build-root/deb/debian/control b/build-root/deb/debian/control
index 6d26266..e90cfca 100644
--- a/build-root/deb/debian/control
+++ b/build-root/deb/debian/control
@@ -2,7 +2,7 @@
 Section: net
 Priority: extra
 Maintainer: Cisco OpenVPP Packaging Team <bogus.address@cisco.com>
-Build-Depends: debhelper (>= 9), dkms, dh-systemd, dh-python, chrpath
+Build-Depends: debhelper (>= 9), dh-systemd, dh-python, chrpath
 Standards-Version: 3.9.4
 
 Package: vpp
@@ -26,14 +26,6 @@
  This package contains development support files for the VPP libraries
  .
 
-Package: vpp-dpdk-dev
-Architecture: any
-Depends: ${misc:Depends}
-Description: Vector Packet Processing--development support
- This package contains dpdk header files which match the dpdk version
- compiled into the vpp executable
- .
-
 Package: vpp-lib
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}
@@ -41,7 +33,6 @@
  This package contains the VPP shared libraries, including:
  .
  vppinfra - foundation library supporting vectors, hashes, bitmaps, pools, and string formatting.
- dpdk - DPDK library
  svm - vm library
  vlib - vector processing library
  vlib-api - binary API library
@@ -54,12 +45,6 @@
  This package contains VPP plugins
  .
 
-Package: vpp-dpdk-dkms
-Architecture: any
-Depends: ${misc:Depends}
-Description: DPDK 2.1 igb_uio_driver
- This package contains Linux kernel modules distributed with DPDK.
-
 Package: vpp-api-lua
 Architecture: any
 Depends: ${misc:Depends}, vpp (= ${source:Version})
diff --git a/build-root/deb/debian/rules b/build-root/deb/debian/rules
index 4c84fc3..7046105 100755
--- a/build-root/deb/debian/rules
+++ b/build-root/deb/debian/rules
@@ -18,7 +18,7 @@
 
 # main packaging script based on dh7 syntax
 %:
-	dh $@ --with dkms --with systemd,python2
+	dh $@ --with systemd,python2
 
 override_dh_install:
 	dh_install --exclude .git
@@ -31,6 +31,3 @@
 
 override_dh_strip:
 	dh_strip --dbg-package=vpp-dbg
-
-override_dh_dkms:
-	dh_dkms -pvpp-dpdk-dkms
diff --git a/build-root/rpm/vpp.spec b/build-root/rpm/vpp.spec
index b3a337b..9e3ad11 100644
--- a/build-root/rpm/vpp.spec
+++ b/build-root/rpm/vpp.spec
@@ -43,7 +43,6 @@
 %description lib
 This package contains the VPP shared libraries, including:
 vppinfra - foundation library supporting vectors, hashes, bitmaps, pools, and string formatting.
-dpdk - DPDK library
 svm - vm library
 vlib - vector processing library
 vlib-api - binary API library
diff --git a/build-root/scripts/find-dpdk-contents b/build-root/scripts/find-dpdk-contents
deleted file mode 100755
index c706513..0000000
--- a/build-root/scripts/find-dpdk-contents
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-
-# includes
-rm -rf dpdk-includes
-mkdir dpdk-includes
-(cd $1/dpdk/include; tar cfh - . | (cd ../../../dpdk-includes; tar xf -))
-
-# If CDPATH is set, the "Change Directory" builtin (cd) will output the
-# destination directory when a relative path is passed as an argument.
-# In this case, this has the negative side effect of polluting the "paths"
-# variable with the destination directory, breaking the package generation.
-#
-#   Patient:  Doctor!  Doctor!  It hurts when I do this...
-#    Doctor:  Don't do that!
-#
-unset CDPATH
-paths=`cd dpdk-includes; find . -type f -print`
-rm -f $2
-
-for path in $paths
-do
-    dir=`dirname $path`
-    if [ $dir = "." ] ; then
-        echo ../dpdk-includes/$path /usr/include/vpp-dpdk >> $2
-    else
-        echo ../dpdk-includes/$path /usr/include/vpp-dpdk/$dir >> $2
-    fi
-done        
-
diff --git a/dpdk/Makefile b/dpdk/Makefile
index 82804f2..f6f90e0 100644
--- a/dpdk/Makefile
+++ b/dpdk/Makefile
@@ -27,6 +27,7 @@
 B := $(DPDK_BUILD_DIR)
 I := $(DPDK_INSTALL_DIR)
 DPDK_VERSION ?= 16.11
+PKG_SUFFIX ?= vpp1
 DPDK_BASE_URL ?= http://fast.dpdk.org/rel
 DPDK_TARBALL := dpdk-$(DPDK_VERSION).tar.xz
 DPDK_TAR_URL := $(DPDK_BASE_URL)/$(DPDK_TARBALL)
@@ -81,11 +82,11 @@
 DPDK_MAKE_ARGS := -C $(DPDK_SOURCE) -j $(JOBS) \
 	T=$(DPDK_TARGET) \
 	RTE_CONFIG_TEMPLATE=../custom-config \
-	RTE_OUTPUT=$(I) \
 	EXTRA_CFLAGS="$(DPDK_EXTRA_CFLAGS)" \
 	EXTRA_LDFLAGS="$(DPDK_EXTRA_LDFLAGS)" \
 	CPU_CFLAGS="$(DPDK_CPU_CFLAGS)" \
 	CPU_LDFLAGS="$(DPDK_CPU_LDFLAGS)" \
+	DESTDIR=$(I) \
         $(DPDK_MAKE_EXTRA_ARGS)
 
 DPDK_SOURCE_FILES := $(shell  [ -e $(DPDK_SOURCE) ] && find $(DPDK_SOURCE) -name "*.[chS]")  
@@ -140,7 +141,6 @@
 	@rm -f .config.ok
 
 $(CURDIR)/$(DPDK_TARBALL):
-	@mkdir -p $(B)
 	@if [ -e $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) ] ; \
 		then cp $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) $(CURDIR) ; \
 		else curl -o $(CURDIR)/$(DPDK_TARBALL) -LO $(DPDK_TAR_URL) ; \
@@ -148,6 +148,7 @@
 	@rm -f $(B)/.download.ok
 
 $(B)/.download.ok: $(CURDIR)/$(DPDK_TARBALL)
+	@mkdir -p $(B)
 	@openssl md5 $< | cut -f 2 -d " " - > $(B)/$(DPDK_TARBALL).md5sum
 	@([ "$$(<$(B)/$(DPDK_TARBALL).md5sum)" = "$(DPDK_$(DPDK_VERSION)_TARBALL_MD5_CKSUM)" ] || \
 	( echo "Bad Checksum! Please remove $< and retry" && \
@@ -168,7 +169,7 @@
 $(B)/.patch.ok: $(B)/.extract.ok
 ifneq ($(wildcard $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch),)
 	@echo --- patching ---
-	for f in $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch ; do \
+	@for f in $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch ; do \
 		echo Applying patch: $$(basename $$f) ; \
 		patch -p1 -d $(DPDK_SOURCE) < $$f ; \
 	done
@@ -188,13 +189,130 @@
 $(B)/.build.ok: $(DPDK_SOURCE_FILES)
 	@if [ ! -e $(B)/.config.ok ] ; then echo 'Please run "make config" first' && false ; fi
 	@make $(DPDK_MAKE_ARGS) install
-	@dkms/create_deb_manifest.sh $(DPDK_VERSION) $(subst $(realpath ..)/,,$(B))
 	@touch $@
 
 .PHONY: build
 build: $(B)/.build.ok
 
+.PHONY: install
+install: $(B)/.build.ok
+
 .PHONY: clean
 clean:
 	@rm -rf $(B) $(I)
 
+##############################################################################
+# .deb packaging
+##############################################################################
+
+DEB_ARCH=$(shell dpkg --print-architecture 2> /dev/null)
+DEV_DEB=vpp-dpdk-dev_$(DPDK_VERSION)-$(PKG_SUFFIX)_$(DEB_ARCH).deb
+INSTALLED_DEB_VER=$(shell dpkg-query --showformat='$${Version}' --show vpp-dpdk-dev 2> /dev/null)
+
+.PHONY: build-deb install-deb check-deb
+
+deb/debian/changelog: Makefile
+	@echo "vpp-dpdk ($(DPDK_VERSION)-$(PKG_SUFFIX)) unstable; urgency=low" > $@
+	@echo "" >> $@
+	@echo "  * DPDK Release $(DPDK_VERSION)" >> $@
+	@echo "" >> $@
+	@echo " -- VPP Dev <vpp-dev@lists.fd.io>  $(shell date -R)" >> $@
+
+$(DEV_DEB): deb/debian/changelog
+	@cd deb && dpkg-buildpackage -b -uc -us
+	git clean -fdx deb
+
+build-deb: $(DEV_DEB)
+
+install-deb:
+ifneq ($(INSTALLED_DEB_VER),$(DPDK_VERSION)-$(PKG_SUFFIX))
+	@make $(DEV_DEB)
+	@sudo dpkg -i $(DEV_DEB)
+else
+	@echo "=========================================================="
+	@echo " Up-to-date DPDK package already installed"
+	@echo "=========================================================="
+endif
+
+check-deb:
+ifneq ($(INSTALLED_DEB_VER),$(DPDK_VERSION)-$(PKG_SUFFIX))
+	@echo "=========================================================="
+	@echo " Outdated DPDK package detected:"
+	@echo "  Installed: vpp-dpdk-dev $(INSTALLED_DEB_VER)"
+	@echo "  Current:   vpp-dpdk-dev $(DPDK_VERSION)-$(PKG_SUFFIX)"
+	@echo ""
+	@echo " Please upgrade by invoking 'make dpdk-install-dev'"
+	@echo " from the top level directory."
+	@echo "=========================================================="
+endif
+
+##############################################################################
+# .rpm packaging
+##############################################################################
+
+RPM_ARCH=$(shell rpm --eval "%{_arch}" 2> /dev/null)
+DEV_RPM=vpp-dpdk-devel-$(DPDK_VERSION)-$(PKG_SUFFIX).$(RPM_ARCH).rpm
+INSTALLED_RPM_VER=$(shell rpm -q --queryformat '%{VERSION}-%{RELEASE}' vpp-dpdk-devel | grep -v "not inst")
+
+.PHONY: build-rpm install-rpm check-rpm
+
+$(DEV_RPM): Makefile rpm/vpp-dpdk.spec
+	@rpmbuild -bb \
+	  --define "_topdir $(CURDIR)/rpm" \
+	  --define "_version $(DPDK_VERSION)" \
+	  --define "_release $(PKG_SUFFIX)" \
+	  $(CURDIR)/rpm/vpp-dpdk.spec
+	mv rpm/RPMS/$(RPM_ARCH)/*.rpm .
+	git clean -fdx rpm
+
+build-rpm: $(DEV_RPM)
+
+install-rpm:
+ifneq ($(INSTALLED_RPM_VER),$(DPDK_VERSION)-$(PKG_SUFFIX))
+	@make $(DEV_RPM)
+	sudo rpm -Uih $(DEV_RPM)
+else
+	@echo "=========================================================="
+	@echo " Up-to-date DPDK package already installed"
+	@echo "=========================================================="
+endif
+
+check-rpm:
+ifneq ($(INSTALLED_RPM_VER),$(DPDK_VERSION)-$(PKG_SUFFIX))
+	@echo "=========================================================="
+	@echo " Outdated DPDK package detected:"
+	@echo "  Installed: vpp-dpdk-devel $(INSTALLED_RPM_VER)"
+	@echo "  Current:   vpp-dpdk-devel $(DPDK_VERSION)-$(PKG_SUFFIX)"
+	@echo ""
+	@echo " Please upgrade by invoking 'make dpdk-install-dev'"
+	@echo " from the top level directory."
+	@echo "=========================================================="
+endif
+
+##############################################################################
+# ebuild support
+##############################################################################
+
+.PHONY: ebuild-build ebuild-install
+
+ebuild-build:
+ifeq ($(INSTALLED_DEB_VER)$(INSTALLED_RPM_VER),)
+	@echo "=========================================================="
+	@echo "Building DPDK from source. Consider installing development"
+	@echo "package by invoking 'make dpdk-install-dev' from the"
+	@echo "top level directory"
+	@echo "=========================================================="
+	make config
+else
+ifneq ($(INSTALLED_DEB_VER),)
+	make check-deb
+endif
+ifneq ($(INSTALLED_RPM_VER),)
+	make check-rpm
+endif
+endif
+
+ebuild-install:
+ifeq ($(INSTALLED_DEB_VER)$(INSTALLED_RPM_VER),)
+	make install
+endif
diff --git a/dpdk/deb/debian/compat b/dpdk/deb/debian/compat
new file mode 100755
index 0000000..ec63514
--- /dev/null
+++ b/dpdk/deb/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/dpdk/deb/debian/control b/dpdk/deb/debian/control
new file mode 100644
index 0000000..9ffa1a0
--- /dev/null
+++ b/dpdk/deb/debian/control
@@ -0,0 +1,18 @@
+Source: vpp-dpdk
+Section: net
+Priority: extra
+Maintainer: vpp-dev@lists.fd.io
+Build-Depends: debhelper (>= 9), dkms
+Standards-Version: 3.9.4
+
+Package: vpp-dpdk-dev
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: DPDK Development Package for VPP
+Conflicts: dpdk, dpdk-dev, libdpdk-dev
+
+Package: vpp-dpdk-dkms
+Architecture: any
+Depends: ${misc:Depends}
+Description: DPDK Development Package for VPP - Kernel Modules
+Conflicts: dpdk-igb-uio-dkms
diff --git a/dpdk/dkms/Makefile b/dpdk/deb/debian/dkms/Makefile
similarity index 100%
rename from dpdk/dkms/Makefile
rename to dpdk/deb/debian/dkms/Makefile
diff --git a/dpdk/deb/debian/rules b/dpdk/deb/debian/rules
new file mode 100755
index 0000000..98b1048
--- /dev/null
+++ b/dpdk/deb/debian/rules
@@ -0,0 +1,38 @@
+#!/usr/bin/make -f
+DH_VERBOSE = 1
+PKG=vpp-dpdk
+
+VERSION = $(shell dpkg-parsechangelog | sed -nr '/^Version:/s/Version: //p')
+BASE_VER = $(word 1, $(subst -, ,$(VERSION)))
+
+export DPDK_BUILD_DIR=$(CURDIR)/_build
+export DPDK_INSTALL_DIR=$(CURDIR)/debian/tmp/usr
+
+SRC=_build/dpdk-$(BASE_VER)
+
+MAKE_ARGS=-C ..
+
+include /usr/share/dpkg/default.mk
+
+%:
+	dh $@ --with dkms
+
+override_dh_clean:
+	make $(MAKE_ARGS) clean
+
+override_dh_auto_configure:
+	make $(MAKE_ARGS) config
+
+override_dh_install:
+	make $(MAKE_ARGS) install
+	dh_install -p$(PKG)-dkms \
+	  $(SRC)/lib/librte_eal/common/include/rte_pci_dev_feature_defs.h \
+	  $(SRC)/lib/librte_eal/common/include/rte_pci_dev_features.h     \
+	  $(SRC)/lib/librte_eal/linuxapp/igb_uio/igb_uio.c                \
+	  $(SRC)/lib/librte_eal/linuxapp/igb_uio/compat.h                 \
+	  debian/dkms/Makefile                                            \
+	  /usr/src/$(PKG)-dkms-$(VERSION)
+	dh_install -p$(PKG)-dev --autodest /usr
+
+override_dh_dkms:
+	dh_dkms -p$(PKG)-dkms -V $(VERSION)
diff --git a/dpdk/deb/debian/vpp-dpdk-dkms.dkms b/dpdk/deb/debian/vpp-dpdk-dkms.dkms
new file mode 100644
index 0000000..a166c31
--- /dev/null
+++ b/dpdk/deb/debian/vpp-dpdk-dkms.dkms
@@ -0,0 +1,8 @@
+PACKAGE_VERSION=#MODULE_VERSION#
+PACKAGE_NAME="vpp-dpdk-dkms"
+CLEAN="make clean"
+BUILT_MODULE_NAME[0]="igb_uio"
+BUILT_MODULE_LOCATION[0]="./"
+DEST_MODULE_LOCATION[0]="/kernel/net"
+MAKE[1]="make"
+AUTOINSTALL="yes"
diff --git a/dpdk/dkms/create_deb_manifest.sh b/dpdk/dkms/create_deb_manifest.sh
deleted file mode 100755
index f830558..0000000
--- a/dpdk/dkms/create_deb_manifest.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-VER=$1
-DPDK_ROOT=../../$2/dpdk-${VER}
-DEBIAN_DIR=../build-root/deb/debian
-SRC_DIR=/usr/src/vpp-dpdk-dkms-${VER}/
-
-
-cat > ${DEBIAN_DIR}/vpp-dpdk-dkms.install << _EOF_
-${DPDK_ROOT}/lib/librte_eal/common/include/rte_pci_dev_feature_defs.h ${SRC_DIR}
-${DPDK_ROOT}/lib/librte_eal/common/include/rte_pci_dev_features.h     ${SRC_DIR}
-${DPDK_ROOT}/lib/librte_eal/linuxapp/igb_uio/igb_uio.c                ${SRC_DIR}
-${DPDK_ROOT}/lib/librte_eal/linuxapp/igb_uio/compat.h                 ${SRC_DIR}
-../../dpdk/dkms/Makefile ${SRC_DIR}
-_EOF_
-
-
-# dkms config
-cat > ${DEBIAN_DIR}/vpp-dpdk-dkms.dkms << _EOF_
-PACKAGE_VERSION="${VER}"
-PACKAGE_NAME="vpp-dpdk-dkms"
-CLEAN="make clean"
-BUILT_MODULE_NAME[0]="igb_uio"
-BUILT_MODULE_LOCATION[0]="./"
-DEST_MODULE_LOCATION[0]="/kernel/net"
-MAKE[1]="make"
-AUTOINSTALL="yes"
-_EOF_
diff --git a/dpdk/rpm/vpp-dpdk.spec b/dpdk/rpm/vpp-dpdk.spec
new file mode 100644
index 0000000..cc61768
--- /dev/null
+++ b/dpdk/rpm/vpp-dpdk.spec
@@ -0,0 +1,26 @@
+%define _make_args	-C ../.. DPDK_BUILD_DIR=%{_topdir}/tmp DPDK_INSTALL_DIR=%{buildroot}/usr
+
+Name:		vpp-dpdk
+Version:	%{_version}
+Release:	%{_release}
+Summary:	DPDK development packages for VPP
+License:	BSD
+
+%description
+
+%package devel
+Summary: 	DPDK development package for VPP
+Group: 		Development/Libraries
+
+%description devel
+
+%install
+make %{_make_args} config
+make %{_make_args} install
+
+%files devel
+/usr/bin/*
+/usr/include/dpdk
+/usr/lib/*
+/usr/sbin/*
+/usr/share/dpdk