]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: BuildDPDK: do not build kernel modules
authorKefu Chai <kchai@redhat.com>
Wed, 15 Nov 2017 18:10:25 +0000 (02:10 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 18 Nov 2017 02:44:56 +0000 (10:44 +0800)
see also http://pkgs.fedoraproject.org/cgit/rpms/dpdk.git/tree/dpdk.spec

Signed-off-by: Kefu Chai <kchai@redhat.com>
cmake/modules/BuildDPDK.cmake
cmake/modules/patch-dpdk-conf.sh [new file with mode: 0755]

index 4ae38caa20aee1d7a721d52739120ddaf9f52cf9..1b824ae5b927aaed8e10146af2f5d21e8c34af52 100644 (file)
@@ -62,32 +62,11 @@ function(do_build_dpdk dpdk_dir)
       "unsupported target \"${target}\"")
   endif()
 
-  if(WITH_KERNEL_DIR)
-    if(NOT IS_DIRECTORY ${WITH_KERNEL_DIR})
-      message(FATAL "not able to build DPDK support: "
-        "WITH_KERNEL_DIR=\"${WITH_KERNEL_DIR}\" does not exist")
-    endif()
-  else()
-    execute_process(
-      COMMAND uname -r
-      OUTPUT_VARIABLE kernel_release
-      OUTPUT_STRIP_TRAILING_WHITESPACE)
-    set(kernel_header_dir "/lib/modules/${kernel_release}/build")
-    if(NOT IS_DIRECTORY ${kernel_header_dir})
-      message(FATAL "not able to build DPDK support: "
-        "\"${kernel_header_dir}\" does not exist. DPDK uses it for building "
-        "kernel modules. Please either disable WITH_DPDK and WITH_SPDK, "
-        "or install linux-headers of the kernel version of the target machine, "
-        "and specify \"-DWITH_RTE_KERNEL_DIR=<the-path-to-the-linux-headers-dir> "
-        "when running \"cmake\"")
-    endif()
-    set(WITH_KERNEL_DIR ${kernel_header_dir})
-  endif(WITH_KERNEL_DIR)
   include(ExternalProject)
   ExternalProject_Add(dpdk-ext
     SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/spdk/dpdk
     CONFIGURE_COMMAND $(MAKE) config O=${dpdk_dir} T=${target}
-    BUILD_COMMAND env CC=${CMAKE_C_COMPILER} $(MAKE) O=${dpdk_dir} EXTRA_CFLAGS=-fPIC RTE_KERNELDIR=${WITH_KERNEL_DIR}
+    BUILD_COMMAND env CC=${CMAKE_C_COMPILER} $(MAKE) O=${dpdk_dir} EXTRA_CFLAGS=-fPIC
     BUILD_IN_SOURCE 1
     INSTALL_COMMAND "true")
   ExternalProject_Add_Step(dpdk-ext patch-config
diff --git a/cmake/modules/patch-dpdk-conf.sh b/cmake/modules/patch-dpdk-conf.sh
new file mode 100755 (executable)
index 0000000..a339938
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/sh
+# -*- mode:sh; tab-width:4; indent-tabs-mode:nil -*
+
+setconf() {
+    local key=$1
+    local val=$2
+    if grep -q ^$key= ${conf}; then
+        sed -i "s:^$key=.*$:$key=$val:g" ${conf}
+    else
+        echo $key=$val >> ${conf}
+    fi
+}
+
+conf=$1/.config
+shift
+machine=$1
+shift
+
+setconf CONFIG_RTE_MACHINE "${machine}"
+# Disable experimental features
+setconf CONFIG_RTE_NEXT_ABI n
+setconf CONFIG_RTE_LIBRTE_MBUF_OFFLOAD n
+# Disable unmaintained features
+setconf CONFIG_RTE_LIBRTE_POWER n
+
+setconf CONFIG_RTE_EAL_IGB_UIO n
+setconf CONFIG_RTE_LIBRTE_KNI n
+setconf CONFIG_RTE_KNI_KMOD n
+setconf CONFIG_RTE_KNI_PREEMPT_DEFAULT n
+
+# no pdump
+setconf CONFIG_RTE_LIBRTE_PDUMP n
+
+# no vm support
+setconf CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT n
+setconf CONFIG_RTE_LIBRTE_VHOST n
+setconf CONFIG_RTE_LIBRTE_VMXNET3_PMD n
+setconf CONFIG_RTE_LIBRTE_PMD_VHOST n
+setconf CONFIG_RTE_APP_EVENTDEV n
+
+# no test
+setconf CONFIG_RTE_APP_TEST n
+setconf CONFIG_RTE_TEST_PMD n
+
+# async/dpdk does not like it
+setconf CONFIG_RTE_MBUF_REFCNT_ATOMIC n