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
6
cd ${OVS_DIR}
7
./boot.sh
8
# 如果启用DPDK,还需要加上--with-dpdk=/usr/local/share/dpdk/x86_64-native-linuxapp-gcc
9
./configure --prefix=${OVS_INSTALL_DIR} --localstatedir=/var --enable-ssl --with-linux=/lib/modules/$(uname -r)/build
10
make -j `nproc`
11
make install
12
make modules_install
Copied!
更新内核模块
1
cat > /etc/depmod.d/openvswitch.conf << EOF
2
override openvswitch * extra
3
override vport-* * extra
4
EOF
5
6
depmod -a
7
cp debian/openvswitch-switch.init /etc/init.d/openvswitch-switch
8
/etc/init.d/openvswitch-switch force-reload-kmod
Copied!

编译RPM包

1
make rpm-fedora RPMBUILD_OPT="--without check"
Copied!
启用DPDK
1
make rpm-fedora RPMBUILD_OPT="--with dpdk --without check"
Copied!
编译内核模块
1
make rpm-fedora-kmod
Copied!

编译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
Copied!

参考文档

最近更新 3yr ago