Jackie Huang | 8a3c213 | 2020-05-25 16:42:16 +0800 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2019 Wind River Systems, Inc. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
Bin Yang | ada32bb | 2020-04-16 12:55:29 +0000 | [diff] [blame] | 16 | DESCRIPTION = "Intel(r) Data Plane Development Kit" |
| 17 | HOMEPAGE = "http://dpdk.org" |
| 18 | |
| 19 | STABLE = "" |
| 20 | BRANCH = "master" |
| 21 | S = "${WORKDIR}/git" |
| 22 | |
| 23 | SRC_URI = "git://dpdk.org/dpdk${STABLE};branch=${BRANCH} \ |
| 24 | file://dpdk-16.04-add-RTE_KERNELDIR_OUT-to-split-kernel-bu.patch \ |
| 25 | file://dpdk-16.07-add-sysroot-option-within-app-makefile.patch \ |
| 26 | " |
| 27 | |
| 28 | COMPATIBLE_MACHINE = "null" |
| 29 | COMPATIBLE_HOST_libc-musl_class-target = "null" |
| 30 | COMPATIBLE_HOST_linux-gnux32 = "null" |
| 31 | |
| 32 | # dpdk example apps dpdk_qat and vhost have dependancy on fuse and qat. |
| 33 | # fuse is in meta-filesystems and qat is not yet upstreamed. |
| 34 | # So adding mechanism to explicitly disable the use of fuse and qat. |
| 35 | # To enable, uncomment the below line or include in .bbappend. |
| 36 | # PACKAGECONFIG ?= " dpdk_qat vhost libvirt" |
| 37 | |
| 38 | PACKAGECONFIG[dpdk_qat] = ",,virtual/qat" |
| 39 | PACKAGECONFIG[vhost] = ",,fuse" |
| 40 | PACKAGECONFIG[libvirt] = ",,libvirt" |
| 41 | PACKAGECONFIG[numa] = ",,numactl" |
| 42 | |
| 43 | export CONFIG_EXAMPLE_DPDK_QAT = "${@bb.utils.contains('PACKAGECONFIG', 'dpdk_qat', 'y', 'n', d)}" |
| 44 | export CONFIG_EXAMPLE_VM_POWER_MANAGER = "${@bb.utils.contains('PACKAGECONFIG', 'libvirt', 'y', 'n', d)}" |
| 45 | export CONFIG_VHOST_ENABLED = "${@bb.utils.contains('PACKAGECONFIG', 'vhost', 'y', 'n', d)}" |
| 46 | export CONFIG_HAVE_NUMA = "${@bb.utils.contains('PACKAGECONFIG', 'numa', 'y', 'n', d)}" |
| 47 | |
| 48 | # Don't use the default value of datadir and let the dpdk set it to a dpdk |
| 49 | # specific directory |
| 50 | datadir[unexport] = "1" |
| 51 | |
| 52 | RDEPENDS_${PN} += "python-subprocess" |
| 53 | DEPENDS = "virtual/kernel" |
| 54 | do_configure[depends] += "virtual/kernel:do_shared_workdir" |
| 55 | |
| 56 | inherit module |
| 57 | |
| 58 | export MODULE_DIR="/lib/modules/${KERNEL_VERSION}/kernel/drivers/net" |
| 59 | export RTE_SDK = "${S}" |
| 60 | |
| 61 | export ICP_ROOT = "${PKG_CONFIG_SYSROOT_DIR}/usr/include" |
| 62 | export ICP_LIB_ROOT= "${PKG_CONFIG_SYSROOT_DIR}/usr/lib" |
| 63 | export RTE_KERNELDIR = "${STAGING_KERNEL_DIR}" |
| 64 | export RTE_KERNELDIR_OUT = "${STAGING_KERNEL_BUILDDIR}" |
| 65 | export INSTALL_PATH = "${prefix}/share/dpdk" |
| 66 | export RTE_OUTPUT = "${S}/${RTE_TARGET}" |
| 67 | export ETHTOOL_LIB_PATH = "${S}/examples/ethtool/lib/${RTE_TARGET}/" |
| 68 | export SYSROOTPATH = "--sysroot=${STAGING_DIR_HOST}" |
| 69 | export DPDK_TARGET_MACH = "${@get_dpdk_target_mach(bb,d)}" |
| 70 | export ICP_LAC_API_DIR = "${STAGING_DIR_TARGET}${includedir}/lac" |
| 71 | |
| 72 | export EXAMPLES_BUILD_DIR = "${RTE_TARGET}" |
| 73 | export ARCHDIR = "generic" |
| 74 | |
| 75 | DPDK_RTE_TARGET_x86-64 = "x86_64-native-linuxapp-gcc" |
| 76 | DPDK_RTE_TARGET_x86 = "i686-native-linuxapp-gcc" |
| 77 | DPDK_RTE_TARGET_aarch64 = "arm64-${DPDK_TARGET_MACH}-linuxapp-gcc" |
| 78 | export RTE_TARGET = "${DPDK_RTE_TARGET}" |
| 79 | |
| 80 | # The list of intel Comms platforms and their target machine |
| 81 | # process mapping. The supported target machine is listed under |
| 82 | # dpdk/mk/machine |
| 83 | def get_dpdk_target_mach(bb, d): |
| 84 | target_arch = d.getVar('DPDK_TARGET_MACHINE', True) |
| 85 | if target_arch: |
| 86 | return target_arch |
| 87 | return "default" |
| 88 | |
| 89 | do_configure () { |
| 90 | ############################################################# |
| 91 | ### default value for prefix is "usr", unsetting it, so it |
| 92 | ### will not be concatenated in ${RTE_TARGET}/Makefile |
| 93 | ### which will cause compilation failure |
| 94 | ############################################################# |
| 95 | unset prefix |
| 96 | |
| 97 | # Fix-up CONFIG_RTE_MACHINE based on target machine |
| 98 | sed -e "s#CONFIG_RTE_MACHINE=\"native\"#CONFIG_RTE_MACHINE=\"${DPDK_TARGET_MACH}\"#" -i ${S}/config/defconfig_${RTE_TARGET} |
| 99 | |
| 100 | # Fix-up vhost configs based on package config |
| 101 | sed -e "s#CONFIG_RTE_KNI_VHOST=n#CONFIG_RTE_KNI_VHOST=${CONFIG_VHOST_ENABLED}#" -i ${S}/config/common_linux |
| 102 | sed -e "s#CONFIG_RTE_KNI_VHOST_VNET_HDR_EN=n#CONFIG_RTE_KNI_VHOST_VNET_HDR_EN=${CONFIG_VHOST_ENABLED}#" -i ${S}/config/common_linux |
| 103 | sed -e "s#CONFIG_RTE_LIBRTE_VHOST=n#CONFIG_RTE_LIBRTE_VHOST=${CONFIG_VHOST_ENABLED}#" -i ${S}/config/common_linux |
| 104 | sed -e "s#CONFIG_RTE_LIBRTE_VHOST_NUMA=.*#CONFIG_RTE_LIBRTE_VHOST_NUMA=${CONFIG_HAVE_NUMA}#" -i ${S}/config/common_linux |
| 105 | sed -e "s#CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=.*#CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=${CONFIG_HAVE_NUMA}#" -i ${S}/config/common_linux |
| 106 | |
| 107 | # Fix-up CONFIG_RTE_LIBRTE_POWER based on package config for libvirt |
| 108 | sed -e "s#CONFIG_RTE_LIBRTE_POWER=y#CONFIG_RTE_LIBRTE_POWER=${CONFIG_EXAMPLE_VM_POWER_MANAGER}#" -i ${S}/config/common_linux |
| 109 | |
| 110 | make O=$RTE_TARGET T=$RTE_TARGET config |
| 111 | } |
| 112 | |
| 113 | do_compile () { |
| 114 | unset LDFLAGS TARGET_LDFLAGS BUILD_LDFLAGS |
| 115 | |
| 116 | cd ${S}/${RTE_TARGET} |
| 117 | oe_runmake EXTRA_LDFLAGS="-L${STAGING_LIBDIR} --hash-style=gnu" \ |
| 118 | EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} -I${STAGING_INCDIR}" \ |
| 119 | CROSS="${TARGET_PREFIX}" \ |
| 120 | prefix="" LDFLAGS="${TUNE_LDARGS}" WERROR_FLAGS="-w" V=1 |
| 121 | |
| 122 | cd ${S}/examples/ |
| 123 | oe_runmake EXTRA_LDFLAGS="-L${STAGING_LIBDIR} --hash-style=gnu -fuse-ld=bfd" \ |
| 124 | EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} -I${STAGING_INCDIR}" \ |
| 125 | CROSS="${TARGET_PREFIX}" O="${S}/examples/$@/" |
| 126 | |
| 127 | cd ${S}/app/test |
| 128 | oe_runmake EXTRA_LDFLAGS="-L${STAGING_LIBDIR} --hash-style=gnu -fuse-ld=bfd" \ |
| 129 | EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} -I${STAGING_INCDIR}" \ |
| 130 | CROSS="${TARGET_PREFIX}" O="${S}/app/test/$@/" |
| 131 | } |
| 132 | |
| 133 | do_install () { |
| 134 | oe_runmake O=${RTE_OUTPUT} T= install-runtime DESTDIR=${D} |
| 135 | oe_runmake O=${RTE_OUTPUT} T= install-kmod DESTDIR=${D} kerneldir=${MODULE_DIR} |
| 136 | oe_runmake O=${RTE_OUTPUT} T= install-sdk DESTDIR=${D} |
| 137 | |
| 138 | # Install examples |
| 139 | for dirname in ${S}/examples/* |
| 140 | do |
| 141 | install -m 0755 -d ${D}/${INSTALL_PATH}/examples/`basename ${dirname}` |
| 142 | |
| 143 | for appname in `find ${dirname} -regex ".*${EXAMPLES_BUILD_DIR}\/app\/[-0-9a-zA-Z0-9/_]*$"` |
| 144 | do |
| 145 | install -m 755 ${appname} ${D}/${INSTALL_PATH}/examples/`basename ${dirname}`/ |
| 146 | done |
| 147 | done |
| 148 | |
| 149 | # Install test |
| 150 | for dirname in ${S}/app/test/app/* |
| 151 | do |
| 152 | install -m 0755 -d ${D}/${INSTALL_PATH}/test |
| 153 | |
| 154 | for appname in `find ${dirname} -regex ".*test\/app\/[-0-9a-zA-Z0-9/_]*$"` |
| 155 | do |
| 156 | install -m 755 ${appname} ${D}/${INSTALL_PATH}/test |
| 157 | done |
| 158 | done |
| 159 | |
| 160 | cp -r ${S}/mk ${D}${INSTALL_PATH}/ |
| 161 | } |
| 162 | |
| 163 | PACKAGES += "${PN}-examples ${PN}-test" |
| 164 | |
| 165 | FILES_${PN}-dbg += " \ |
| 166 | ${INSTALL_PATH}/.debug \ |
| 167 | ${INSTALL_PATH}/examples/*/.debug \ |
| 168 | " |
| 169 | |
| 170 | FILES_${PN}-doc += "\ |
| 171 | ${INSTALL_PATH}/doc \ |
| 172 | " |
| 173 | |
| 174 | FILES_${PN}-dev += " \ |
| 175 | ${INSTALL_PATH}/${RTE_TARGET}/.config \ |
| 176 | ${includedir} \ |
| 177 | ${includedir}/${ARCHDIR} \ |
| 178 | ${includedir}/exec-env \ |
| 179 | ${INSTALL_PATH}/buildtools/ \ |
| 180 | ${INSTALL_PATH}/${RTE_TARGET}/include \ |
| 181 | ${INSTALL_PATH}/${RTE_TARGET}/lib \ |
| 182 | ${INSTALL_PATH}/mk \ |
| 183 | " |
| 184 | |
| 185 | FILES_${PN} += " ${INSTALL_PATH}/usertools/ \ |
| 186 | ${prefix}/sbin/ \ |
| 187 | ${prefix}/bin/ \ |
| 188 | ${libdir}/ \ |
| 189 | " |
| 190 | FILES_${PN}-examples += " \ |
| 191 | ${INSTALL_PATH}/examples/* \ |
| 192 | " |
| 193 | |
| 194 | FILES_${PN}-test += " \ |
| 195 | ${INSTALL_PATH}/test \ |
| 196 | " |