summaryrefslogtreecommitdiffstats
path: root/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/build_ovs_dpdk.erb
blob: 215d0b1a4cad039836f3f629aaf2680890852c3b (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
#!/usr/bin/env	bash

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