summaryrefslogtreecommitdiffstats
path: root/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/build_ovs_dpdk.erb
blob: 89232d0d72c2467e6d68a74c53ec3d9cad89591e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env	bash

# Copyright (c) 2016 Open Platform for NFV Project, Inc. and its contributors
#
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

set -o xtrace

if [  -e <%= @ovs_dir %>/BUILD_COMPLETE ]; then
   echo "Build already done."
   cd <%= @ovs_dir %>
   sudo make install
else
   cd <%= @ovs_dpdk_dir %>
   make config T=<%= @rte_target %>

   if [ -e <%= @ovs_dpdk_dir %>/<%= @rte_target %> ]; then
      rm <%= @rte_target %>
   fi

   # block of code with more strict error handling
   set -o errexit
   ln -s -f build <%= @rte_target %>
   sed "s/CONFIG_RTE_BUILD_COMBINE_LIBS=n/CONFIG_RTE_BUILD_COMBINE_LIBS=y/" -i <%= @ovs_dpdk_dir %>/build/.config
   sed "s/CONFIG_RTE_MAX_MEMSEG=.*$/CONFIG_RTE_MAX_MEMSEG=<%= @ovs_dpdk_mem_segments %>/" -i <%= @ovs_dpdk_dir %>/build/.config
   sed "s/CONFIG_RTE_LIBRTE_VHOST=.*$/CONFIG_RTE_LIBRTE_VHOST=<%= @ovs_dpdk_rte_librte_vhost %>/" -i <%= @ovs_dpdk_dir %>/build/.config
   sed "s/CONFIG_RTE_LIBRTE_VHOST_DEBUG=.*$/CONFIG_RTE_LIBRTE_VHOST_DEBUG=<%= @ovs_dpdk_vhost_user_debug %>/" -i <%= @ovs_dpdk_dir %>/build/.config
   make -j `nproc`
   sudo cp <%= @ovs_dpdk_dir %>/build/lib/*dpdk.* /lib
   cd <%= @ovs_dir %>
   ./boot.sh
   ./configure --with-dpdk=<%= @ovs_dpdk_dir %>/<%= @rte_target %> --prefix=/usr --with-dbdir=<%= @ovs_db_conf_dir %> --with-rundir=<%= @ovs_db_socket_dir %>
   make -j `nproc` CFLAGS='-O3 -march=native'
   touch <%= @ovs_dir %>/BUILD_COMPLETE
   sudo make install
   set +o errexit
fi


set +o xtrace