utilize RTE_EAL_PMD_PATH 05/3205/1
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>
Thu, 29 Sep 2016 07:57:13 +0000 (09:57 +0200)
committerChristian Ehrhardt <christian.ehrhardt@canonical.com>
Thu, 29 Sep 2016 12:40:49 +0000 (14:40 +0200)
This sets RTE_EAL_PMD_PATH to /usr/lib/$(shell dpkg-architecture
-qDEB_HOST_MULTIARCH)/dpdk-pmds.
On creating the pmd library packages those get a symlink from that dir.
This allows DPDK applications to autoload pmd drivers and only rely on
the EAL -d option for those provided in other places (e.g. custom
drivers).
By that one can use testpmd/l2fwd/openvswitch-dpdk and others without
passing -d <full-path-to-pmd.so> to EAL.

Each lib gets an extra relative symlink from the RTE_EAL_PMD_PATH dir to
the lib itself e.g. for librte_vhost:
./usr/lib/x86_64-linux-gnu/dpdk-pmds/
./usr/lib/x86_64-linux-gnu/dpdk-pmds/librte_vhost.so.3 -> ../librte_vhost.so.3

Change-Id: Idf997e58cfa5060961239b3ee0c22de89e0ed1a3
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
debian/rules

index 064ffc3..e468492 100755 (executable)
@@ -129,6 +129,7 @@ ifeq (,$(filter dpdk_config=%,$(DEB_BUILD_OPTIONS)))
                -e 's,(CONFIG_RTE_KNI_KMOD=).*,\1$(DPDK_CONFIG_BUILD_KMOD),' \
                -e 's,(LIBRTE_PMD_PCAP=).*,\1y,' \
                -e 's,(LIBRTE_PMD_XENVIRT=).*,\1y,' \
+               -e 's,(CONFIG_RTE_EAL_PMD_PATH=).*,\1"/usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)/dpdk-pmds/",' \
                $(DPDK_STATIC_DIR)/.config
        # xen not available on ppc64el
 ifneq (,$(filter $(DEB_HOST_ARCH), ppc64el))
@@ -206,9 +207,16 @@ override_dh_auto_install-arch:
          else \
            PKG=$${LN}$${VER}; \
          fi; \
+         LIBF="$$(basename $${lib})"; \
+         LIBD="debian/$${PKG}/$(LIBDIR)"; \
          echo "moving $${lib} for library $${PKG}"; \
-         mkdir -p debian/$${PKG}/$(LIBDIR); \
-         mv $${lib} debian/$${PKG}/$(LIBDIR); \
+         mkdir -p $${LIBD}; \
+         mv $${lib} $${LIBD}; \
+         if [ "$${LIBF#librte_pmd_}x" != "$${LIBF}x" ]; then \
+           mkdir -p $${LIBD}/dpdk-pmds; \
+           echo "PMD: linking $${LIBF} into RTE_EAL_PMD_PATH at $${LIBD}/dpdk-pmds/"; \
+           ln -s --relative --target-directory=$${LIBD}/dpdk-pmds/ $${LIBD}/$${LIBF}; \
+         fi; \
        done
        # pkg-config
        mkdir -p debian/libdpdk-dev/$(LIBDIR)/pkgconfig