blob: 7a949ff66d4818c114b19c55ffbce329598988e0 [file] [log] [blame]
Bin Yangada32bb2020-04-16 12:55:29 +00001DESCRIPTION = "Intel(r) Data Plane Development Kit"
2HOMEPAGE = "http://dpdk.org"
3
4STABLE = ""
5BRANCH = "master"
6S = "${WORKDIR}/git"
7
8SRC_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
13COMPATIBLE_MACHINE = "null"
14COMPATIBLE_HOST_libc-musl_class-target = "null"
15COMPATIBLE_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
23PACKAGECONFIG[dpdk_qat] = ",,virtual/qat"
24PACKAGECONFIG[vhost] = ",,fuse"
25PACKAGECONFIG[libvirt] = ",,libvirt"
26PACKAGECONFIG[numa] = ",,numactl"
27
28export CONFIG_EXAMPLE_DPDK_QAT = "${@bb.utils.contains('PACKAGECONFIG', 'dpdk_qat', 'y', 'n', d)}"
29export CONFIG_EXAMPLE_VM_POWER_MANAGER = "${@bb.utils.contains('PACKAGECONFIG', 'libvirt', 'y', 'n', d)}"
30export CONFIG_VHOST_ENABLED = "${@bb.utils.contains('PACKAGECONFIG', 'vhost', 'y', 'n', d)}"
31export 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
35datadir[unexport] = "1"
36
37RDEPENDS_${PN} += "python-subprocess"
38DEPENDS = "virtual/kernel"
39do_configure[depends] += "virtual/kernel:do_shared_workdir"
40
41inherit module
42
43export MODULE_DIR="/lib/modules/${KERNEL_VERSION}/kernel/drivers/net"
44export RTE_SDK = "${S}"
45
46export ICP_ROOT = "${PKG_CONFIG_SYSROOT_DIR}/usr/include"
47export ICP_LIB_ROOT= "${PKG_CONFIG_SYSROOT_DIR}/usr/lib"
48export RTE_KERNELDIR = "${STAGING_KERNEL_DIR}"
49export RTE_KERNELDIR_OUT = "${STAGING_KERNEL_BUILDDIR}"
50export INSTALL_PATH = "${prefix}/share/dpdk"
51export RTE_OUTPUT = "${S}/${RTE_TARGET}"
52export ETHTOOL_LIB_PATH = "${S}/examples/ethtool/lib/${RTE_TARGET}/"
53export SYSROOTPATH = "--sysroot=${STAGING_DIR_HOST}"
54export DPDK_TARGET_MACH = "${@get_dpdk_target_mach(bb,d)}"
55export ICP_LAC_API_DIR = "${STAGING_DIR_TARGET}${includedir}/lac"
56
57export EXAMPLES_BUILD_DIR = "${RTE_TARGET}"
58export ARCHDIR = "generic"
59
60DPDK_RTE_TARGET_x86-64 = "x86_64-native-linuxapp-gcc"
61DPDK_RTE_TARGET_x86 = "i686-native-linuxapp-gcc"
62DPDK_RTE_TARGET_aarch64 = "arm64-${DPDK_TARGET_MACH}-linuxapp-gcc"
63export 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
68def 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
74do_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
98do_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
118do_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
148PACKAGES += "${PN}-examples ${PN}-test"
149
150FILES_${PN}-dbg += " \
151 ${INSTALL_PATH}/.debug \
152 ${INSTALL_PATH}/examples/*/.debug \
153 "
154
155FILES_${PN}-doc += "\
156 ${INSTALL_PATH}/doc \
157 "
158
159FILES_${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
170FILES_${PN} += " ${INSTALL_PATH}/usertools/ \
171 ${prefix}/sbin/ \
172 ${prefix}/bin/ \
173 ${libdir}/ \
174 "
175FILES_${PN}-examples += " \
176 ${INSTALL_PATH}/examples/* \
177 "
178
179FILES_${PN}-test += " \
180 ${INSTALL_PATH}/test \
181 "