diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2014-06-26 13:48:23 +0200 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2014-06-26 13:48:23 +0200 |
commit | 1b6242fc583a6b871304fb995af6dc211b58f69b (patch) | |
tree | b5d434d90dedae24792906aa304897c23a134386 /recipes-networking/openvswitchdpdk/openvswitchdpdk_0.10.0.bb | |
download | meta-ip-1b6242fc583a6b871304fb995af6dc211b58f69b.tar.gz |
initial commit for Enea Linux 4.0daisy-enea
Migrated from the internal git server on the daisy-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'recipes-networking/openvswitchdpdk/openvswitchdpdk_0.10.0.bb')
-rw-r--r-- | recipes-networking/openvswitchdpdk/openvswitchdpdk_0.10.0.bb | 248 |
1 files changed, 248 insertions, 0 deletions
diff --git a/recipes-networking/openvswitchdpdk/openvswitchdpdk_0.10.0.bb b/recipes-networking/openvswitchdpdk/openvswitchdpdk_0.10.0.bb new file mode 100644 index 0000000..d6cde8d --- /dev/null +++ b/recipes-networking/openvswitchdpdk/openvswitchdpdk_0.10.0.bb | |||
@@ -0,0 +1,248 @@ | |||
1 | SUMMARY = "DPDK vSwitch" | ||
2 | DESCRIPTION = "DPDK vSwitch is a fork of Open vSwitch. It re-creates the kernel forwarding module (data plane) \ | ||
3 | by building the switching logic on top of the DPDK library to significantly boost packet switching throughput" | ||
4 | HOMEPAGE = "https://01.org/packet-processing" | ||
5 | SECTION = "networking" | ||
6 | LICENSE = "Apache-2 & GPLv2 & LGPLv2.1 & BSD" | ||
7 | LIC_FILES_CHKSUM = "file://openvswitch/COPYING;md5=eef486aeb68ddde5446062140eeda540 \ | ||
8 | file://qemu/COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \ | ||
9 | file://qemu/COPYING.LIB;md5=79ffa0ec772fa86740948cb7327a0cc7 \ | ||
10 | file://guest/ovs_client/ovs_client.c;beginline=1;endline=33;md5=8485efe01bb0513caf69f8bbec5617a0 \ | ||
11 | " | ||
12 | PV = "0.10.0" | ||
13 | |||
14 | PACKAGES =+ "${PN}-controller ${PN}-switch ${PN}-pki ${PN}-qemu" | ||
15 | |||
16 | DEPENDS += "dpdk virtual/kernel libtool glib-2.0 expect fuse python perl" | ||
17 | |||
18 | RDEPENDS_${PN} += "util-linux-uuidgen util-linux-libuuid coreutils \ | ||
19 | python perl perl-module-strict sed gawk grep ${PN}-switch ${PN}-controller" | ||
20 | RRECOMMENDS_${PN} += "kernel-module-openvswitch kernel-module-uio kernel-module-pci-stub" | ||
21 | |||
22 | RDEPENDS_${PN}-ptest += "python-logging python-syslog python-argparse python-io \ | ||
23 | python-fcntl python-shell python-lang python-xml python-math \ | ||
24 | python-datetime python-netclient python sed ${PN}" | ||
25 | |||
26 | RDEPENDS_${PN}-pki = "${PN}" | ||
27 | ALLOW_EMPTY_${PN}-pki = "1" | ||
28 | |||
29 | RDEPENDS_${PN}-controller += "${PN} lsb ${PN}-pki" | ||
30 | RDEPENDS_${PN}-switch = "${PN} openssl procps util-linux-uuidgen" | ||
31 | |||
32 | OVS_PREFIX = "/opt/${PN}" | ||
33 | |||
34 | FILES_${PN}-controller = "${sysconfdir}/init.d/openvswitchdpdk-controller \ | ||
35 | ${sysconfdir}/default/openvswitchdpdk-controller \ | ||
36 | ${OVS_PREFIX}/bin/ovs-controller \ | ||
37 | " | ||
38 | |||
39 | FILES_${PN}-doc += "/share/man" | ||
40 | |||
41 | FILES_${PN} += "/share" | ||
42 | |||
43 | FILES_${PN}-switch = "${sysconfdir}/init.d/openvswitchdpdk-switch \ | ||
44 | ${sysconfdir}/default/openvswitchdpdk-switch" | ||
45 | |||
46 | FILES_${PN}-qemu = "${QEMU_INSTALL_PATH}" | ||
47 | |||
48 | inherit module-base update-rc.d | ||
49 | |||
50 | INITSCRIPT_PACKAGES = "${PN}-switch ${PN}-controller" | ||
51 | INITSCRIPT_NAME_${PN}-switch = "openvswitchdpdk-switch" | ||
52 | #to enable at startup use bbappend recipe with INITSCRIPT_PARAMS_${PN}-switch = "defaults 71" | ||
53 | INITSCRIPT_PARAMS_${PN}-switch = "stop 20 5 2 . stop 20 0 1 6 ." | ||
54 | |||
55 | INITSCRIPT_NAME_${PN}-controller = "openvswitchdpdk-controller" | ||
56 | #to enable at startup use bbappend recipe with INITSCRIPT_PARAMS_${PN}-controller = "defaults 72" | ||
57 | INITSCRIPT_PARAMS_${PN}-controller = "stop 20 5 2 . stop 20 0 1 6 ." | ||
58 | |||
59 | # Release 0.10.0 | ||
60 | SRCREV = "28318e4004a9010b8bc15ff7e8ac5d886ea47857" | ||
61 | SRC_URI = "git://github.com/01org/dpdk-ovs;branch=master \ | ||
62 | file://configure-fix.patch \ | ||
63 | file://makefile-install-rule.patch \ | ||
64 | file://qemu-makefile.patch \ | ||
65 | file://openvswitchdpdk-switch \ | ||
66 | file://openvswitchdpdk-switch-setup \ | ||
67 | file://openvswitchdpdk-controller \ | ||
68 | file://openvswitchdpdk-controller-setup \ | ||
69 | file://qemu-pixman-config.patch \ | ||
70 | file://qemu-options-hx.patch \ | ||
71 | file://0001-openvswitchdpdk-enabled-ptest.patch \ | ||
72 | file://run-ptest \ | ||
73 | file://ovs-ctl-dpdk.patch \ | ||
74 | " | ||
75 | |||
76 | S = "${WORKDIR}/git" | ||
77 | B = "${S}" | ||
78 | OVS_S_DIR = "${S}/openvswitch" | ||
79 | QEMU_S_DIR = "${S}/qemu" | ||
80 | |||
81 | # Install this modified qemu to a different place than the normal qemu | ||
82 | QEMU_INSTALL_PATH = "/opt/dpdk-ovs-qemu" | ||
83 | |||
84 | SRC_URI[md5sum] = "8d354e5f730292f126f29f85448cfc2d" | ||
85 | SRC_URI[sha256sum] = "6256f9ca96716686030e4456e97eacc2f31b3169e65a1455f73ffafd78f7828a" | ||
86 | |||
87 | export RTE_SDK = "${STAGING_DIR_HOST}/opt/dpdk" | ||
88 | export RTE_TARGET = "x86_64-ivshmem-linuxapp-gcc" | ||
89 | |||
90 | OVS_CONFIG_OPTS = "--build=${BUILD_SYS} \ | ||
91 | --host=${HOST_SYS} \ | ||
92 | --target=${TARGET_SYS} \ | ||
93 | --prefix=${OVS_PREFIX} \ | ||
94 | --disable-silent-rules \ | ||
95 | --disable-ssl \ | ||
96 | " | ||
97 | |||
98 | QEMU_CONFIG_OPTS = "--prefix=${QEMU_INSTALL_PATH} \ | ||
99 | --with-confsuffix="" \ | ||
100 | --mandir=${QEMU_INSTALL_PATH}/share/man \ | ||
101 | --docdir=${QEMU_INSTALL_PATH}/share/doc \ | ||
102 | --datadir=${QEMU_INSTALL_PATH}/share \ | ||
103 | --sysconfdir=${QEMU_INSTALL_PATH}/usr/etc \ | ||
104 | --bindir=${QEMU_INSTALL_PATH}/bin \ | ||
105 | --libdir=${QEMU_INSTALL_PATH}/lib \ | ||
106 | --libexecdir=${QEMU_INSTALL_PATH}/libexec \ | ||
107 | --includedir=${QEMU_INSTALL_PATH}/include \ | ||
108 | --localstatedir=${QEMU_INSTALL_PATH}/var \ | ||
109 | --enable-kvm \ | ||
110 | --dpdkdir=${RTE_SDK} \ | ||
111 | --extra-cflags="-Wno-poison-system-directories" \ | ||
112 | --target-list=x86_64-softmmu \ | ||
113 | --disable-strip \ | ||
114 | " | ||
115 | |||
116 | PACKAGESPLITFUNCS_prepend = "split_ovs_packages " | ||
117 | |||
118 | #append OVS_PREFIX to all FILES_* in PACKAGES except for ptest, qemu, switch | ||
119 | # and controller(includes exception, see FILES_${PN}-controller) packages | ||
120 | python split_ovs_packages () { | ||
121 | pkgs = d.getVar('PACKAGES', True) | ||
122 | for pkg in pkgs.split(): | ||
123 | if (pkg.endswith('-ptest') or pkg.endswith('-qemu') or | ||
124 | pkg.endswith('-switch') or pkg.endswith('-controller')): | ||
125 | continue | ||
126 | files = d.getVar('FILES_%s' % pkg, True) | ||
127 | if files is None: | ||
128 | continue | ||
129 | files = [d.getVar('OVS_PREFIX', True) + file for file in files.split()] | ||
130 | files = ' '.join(files) | ||
131 | d.setVar('FILES_%s' % pkg, files) | ||
132 | } | ||
133 | |||
134 | do_configure () { | ||
135 | cd ${OVS_S_DIR} && ./boot.sh && ./configure ${OVS_CONFIG_OPTS} | ||
136 | cd ${QEMU_S_DIR} && ./configure ${QEMU_CONFIG_OPTS} | ||
137 | } | ||
138 | |||
139 | do_compile () { | ||
140 | cd ${OVS_S_DIR} && oe_runmake | ||
141 | cd ${S}/guest/ovs_client && oe_runmake | ||
142 | cd ${S}/guest/kni/kni_client && oe_runmake | ||
143 | |||
144 | # unset the environment variables, so that oe_runmake will not override them | ||
145 | unset bindir mandir docdir sysconfdir datadir libdir libexecdir includedir localstatedir | ||
146 | cd ${QEMU_S_DIR} && oe_runmake | ||
147 | } | ||
148 | |||
149 | #use simple quotes in the definition of the following "OVS_" prefixed variables | ||
150 | OVS_DPDK_PARAMS_DEFAULT = "-c 0x0f -n 4 --proc-type=primary --huge-dir /mnt/huge -- -p 0x03 -k 2 -n 4 --stats=1 --vswitchd=1 --client_switching_core=0 --config='(0,0,2),(1,0,3)'" | ||
151 | OVS_VSWITCHD_PARAMS_DEFAULT = "-c 0x10 -n 4 --proc-type=secondary" | ||
152 | #for debugging redirect to a regular file - this should be done temporary | ||
153 | #if permanent logging is required a service like logrotate is recommended to limit the size of the log file | ||
154 | OVS_DPDK_LOG_DEFAULT = "/dev/null" | ||
155 | |||
156 | do_install () { | ||
157 | cd ${OVS_S_DIR} && oe_runmake DESTDIR=${D} install | ||
158 | install ${OVS_S_DIR}/datapath/dpdk/build/app/ovs_dpdk ${D}/${OVS_PREFIX}${base_bindir} | ||
159 | install -d ${D}/${OVS_PREFIX}/share/${PN}/kmod | ||
160 | install -m 644 ${OVS_S_DIR}/datapath/dpdk/fd_link/fd_link.ko ${D}/${OVS_PREFIX}/share/${PN}/kmod | ||
161 | install -m 644 ${RTE_SDK}/${RTE_TARGET}/kmod/*.ko ${D}/${OVS_PREFIX}/share/${PN}/kmod | ||
162 | install ${S}/guest/kni/kni_client/build/kni_client ${D}/${OVS_PREFIX}${base_bindir} | ||
163 | install ${S}/guest/ovs_client/build/ovs_client ${D}/${OVS_PREFIX}${base_bindir} | ||
164 | |||
165 | install -d ${D}/${sysconfdir}/default/ | ||
166 | install -m 660 ${WORKDIR}/openvswitchdpdk-switch-setup ${D}/${sysconfdir}/default/openvswitchdpdk-switch | ||
167 | install -m 660 ${WORKDIR}/openvswitchdpdk-controller-setup ${D}/${sysconfdir}/default/openvswitchdpdk-controller | ||
168 | |||
169 | install -d ${D}/${sysconfdir}/init.d/ | ||
170 | install -m 755 ${WORKDIR}/openvswitchdpdk-controller ${D}/${sysconfdir}/init.d/openvswitchdpdk-controller | ||
171 | sed -i 's|INSTALLPREFIX=|INSTALLPREFIX=${OVS_PREFIX}|g' ${D}/${sysconfdir}/init.d/openvswitchdpdk-controller | ||
172 | install -m 755 ${WORKDIR}/openvswitchdpdk-switch ${D}/${sysconfdir}/init.d/openvswitchdpdk-switch | ||
173 | sed -i 's|INSTALLPREFIX=|INSTALLPREFIX=${OVS_PREFIX}|g' ${D}/${sysconfdir}/init.d/openvswitchdpdk-switch | ||
174 | |||
175 | # Add DPDK default parameters to /etc/default/openvswitchdpdk-switch | ||
176 | sed -i "s|@OVS_DPDK_PARAMS_DEFAULT|${OVS_DPDK_PARAMS_DEFAULT}|g" ${D}/${sysconfdir}/default/openvswitchdpdk-switch | ||
177 | sed -i "s|@OVS_VSWITCHD_PARAMS_DEFAULT|${OVS_VSWITCHD_PARAMS_DEFAULT}|g" ${D}/${sysconfdir}/default/openvswitchdpdk-switch | ||
178 | sed -i "s|@OVS_DPDK_LOG_DEFAULT|${OVS_DPDK_LOG_DEFAULT}|g" ${D}/${sysconfdir}/default/openvswitchdpdk-switch | ||
179 | |||
180 | # Add DPDK default parameters to ovs-ctl | ||
181 | sed -i "s|@OVS_DPDK_PARAMS_DEFAULT|${OVS_DPDK_PARAMS_DEFAULT}|g" ${D}/${OVS_PREFIX}/share/openvswitch/scripts/ovs-ctl | ||
182 | sed -i "s|@OVS_VSWITCHD_PARAMS_DEFAULT|${OVS_VSWITCHD_PARAMS_DEFAULT}|g" ${D}/${OVS_PREFIX}/share/openvswitch/scripts/ovs-ctl | ||
183 | sed -i "s|@OVS_DPDK_LOG_DEFAULT|${OVS_DPDK_LOG_DEFAULT}|g" ${D}/${OVS_PREFIX}/share/openvswitch/scripts/ovs-ctl | ||
184 | |||
185 | install -d ${D}/${OVS_PREFIX}${sysconfdir}/openvswitch-controller | ||
186 | |||
187 | # unset the environment variables, so that oe_runmake will not override them | ||
188 | unset bindir mandir docdir sysconfdir datadir libdir libexecdir includedir localstatedir | ||
189 | |||
190 | export STRIP="true" | ||
191 | install -d ${D}/${QEMU_INSTALL_PATH}/bin | ||
192 | cd ${QEMU_S_DIR} && oe_runmake DESTDIR=${D} install | ||
193 | |||
194 | # silence QA error: architecture did not match | ||
195 | rm -f ${D}/${QEMU_INSTALL_PATH}/share/openbios* | ||
196 | rm -f ${D}/${QEMU_INSTALL_PATH}/share/palcode-clipper | ||
197 | } | ||
198 | |||
199 | pkg_postinst_${PN}-pki () { | ||
200 | # can't do this offline | ||
201 | if [ "x$D" != "x" ]; then | ||
202 | exit 1 | ||
203 | fi | ||
204 | if test ! -d $D/${OVS_PREFIX}/share/${PN}/pki; then | ||
205 | ${OVS_PREFIX}/${base_bindir}/ovs-pki init --dir=$D/${OVS_PREFIX}/share/${PN}/pki | ||
206 | fi | ||
207 | } | ||
208 | |||
209 | pkg_postinst_${PN}-controller () { | ||
210 | # can't do this offline | ||
211 | if [ "x$D" != "x" ]; then | ||
212 | exit 1 | ||
213 | fi | ||
214 | |||
215 | if test ! -d $D/${OVS_PREFIX}/share/${PN}/pki; then | ||
216 | ${OVS_PREFIX}/${base_bindir}/ovs-pki init --dir=$D/${OVS_PREFIX}/share/${PN}/pki | ||
217 | fi | ||
218 | |||
219 | cd $D/${OVS_PREFIX}${sysconfdir}/openvswitch-controller | ||
220 | if ! test -e cacert.pem; then | ||
221 | ln -s $D/${OVS_PREFIX}/share/${PN}/pki/switchca/cacert.pem cacert.pem | ||
222 | fi | ||
223 | if ! test -e privkey.pem || ! test -e cert.pem; then | ||
224 | oldumask=$(umask) | ||
225 | umask 077 | ||
226 | ${OVS_PREFIX}/${base_bindir}/ovs-pki req+sign --dir=$D/${OVS_PREFIX}/share/${PN}/pki tmp controller >/dev/null | ||
227 | mv tmp-privkey.pem privkey.pem | ||
228 | mv tmp-cert.pem cert.pem | ||
229 | mv tmp-req.pem req.pem | ||
230 | chmod go+r cert.pem req.pem | ||
231 | umask $oldumask | ||
232 | fi | ||
233 | } | ||
234 | |||
235 | inherit ptest | ||
236 | |||
237 | EXTRA_OEMAKE += "TEST_DEST=${D}${PTEST_PATH} TEST_ROOT=${PTEST_PATH}" | ||
238 | |||
239 | do_install_ptest() { | ||
240 | cd ${OVS_S_DIR} && oe_runmake test-install | ||
241 | sed -i 's|INSTALLPREFIX=|INSTALLPREFIX=${OVS_PREFIX}|g' ${D}${PTEST_PATH}/run-ptest | ||
242 | } | ||
243 | |||
244 | # for qemu/pixman configuration | ||
245 | export HOST_SYS | ||
246 | |||
247 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" | ||
248 | INSANE_SKIP_${PN} = "installed-vs-shipped" | ||