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