Build OVS

直接源码编译安装

  1. export OVS_VERSION="2.6.1"
  2. export OVS_DIR="/usr/src/ovs"
  3. export OVS_INSTALL_DIR="/usr"
  4. curl -sSl http://openvswitch.org/releases/openvswitch-${OVS_VERSION}.tar.gz | tar -xz && mv openvswitch-${OVS_VERSION} ${OVS_DIR}
  5. cd ${OVS_DIR}
  6. ./boot.sh
  7. # 如果启用DPDK,还需要加上--with-dpdk=/usr/local/share/dpdk/x86_64-native-linuxapp-gcc
  8. ./configure --prefix=${OVS_INSTALL_DIR} --localstatedir=/var --enable-ssl --with-linux=/lib/modules/$(uname -r)/build
  9. make -j `nproc`
  10. make install
  11. make modules_install

更新内核模块

  1. cat > /etc/depmod.d/openvswitch.conf << EOF
  2. override openvswitch * extra
  3. override vport-* * extra
  4. EOF
  5. depmod -a
  6. cp debian/openvswitch-switch.init /etc/init.d/openvswitch-switch
  7. /etc/init.d/openvswitch-switch force-reload-kmod

编译RPM包

  1. make rpm-fedora RPMBUILD_OPT="--without check"

启用DPDK

  1. make rpm-fedora RPMBUILD_OPT="--with dpdk --without check"

编译内核模块

  1. make rpm-fedora-kmod

编译deb包

  1. apt-get install build-essential fakeroot
  2. dpkg-checkbuilddeps
  3. # 已经编译过,需要首先clean
  4. # fakeroot debian/rules clean
  5. DEB_BUILD_OPTIONS='parallel=8 nocheck' fakeroot debian/rules binary

参考文档