]> git.proxmox.com Git - mirror_ovs.git/commitdiff
ovs container build: Make kernel module configurable
authorAliasgar Ginwala <aginwala@ebay.com>
Fri, 20 Dec 2019 00:50:47 +0000 (16:50 -0800)
committerBen Pfaff <blp@ovn.org>
Fri, 20 Dec 2019 20:53:06 +0000 (12:53 -0800)
--with-linux can be made configurable while building containers
for leveraging kernel modules installed on host.
KERNEL_VERSION=host should be used in env variable for the same.

Signed-off-by: Aliasgar Ginwala <aginwala@ebay.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
utilities/docker/Makefile
utilities/docker/debian/build-kernel-modules.sh
utilities/docker/start-ovs

index 8c2f7810e70feb01c3ed952fd5af7ef948d59040..d8b08a3c972f23c1d1877d7b49751ca9a1e520eb 100644 (file)
@@ -10,7 +10,7 @@
 #   make push
 
 REPO = ${DOCKER_REPO}
-tag = ${OVS_VERSION}_${KERNEL_VERSION}
+tag = ${OVS_VERSION}_${DISTRO}_${KERNEL_VERSION}
 
 build: ;docker build -t ${REPO}:${tag} --build-arg DISTRO=${DISTRO} \
 --build-arg OVS_BRANCH=${OVS_BRANCH} \
index 47788a68447c3a2abe66a2f15a2d3402796b8550..872ba1eb8302c2140d2400b1c7a9ea20a09b5ac4 100755 (executable)
@@ -17,12 +17,16 @@ OVS_BRANCH=$2
 GITHUB_SRC=$3
 
 # Install deps
-linux="linux-image-$KERNEL_VERSION linux-headers-$KERNEL_VERSION"
 build_deps="apt-utils libelf-dev build-essential libssl-dev python3 \
 wget gdb autoconf libtool git automake bzip2 debhelper dh-autoreconf openssl"
 
 apt-get update
-apt-get install -y ${linux} ${build_deps}
+if [ $KERNEL_VERSION != "host" ]; then
+    linux="linux-image-$KERNEL_VERSION linux-headers-$KERNEL_VERSION"
+    apt-get install -y ${linux}
+fi
+
+apt-get install -y ${build_deps}
 
 # get the source
 mkdir /build; cd /build
@@ -31,8 +35,17 @@ cd ovs
 
 # build and install
 ./boot.sh
-./configure --localstatedir="/var" --sysconfdir="/etc" --prefix="/usr" \
---with-linux=/lib/modules/$KERNEL_VERSION/build --enable-ssl
+
+config="./configure --localstatedir="/var" --sysconfdir="/etc" --prefix="/usr"
+--enable-ssl"
+
+if [ $KERNEL_VERSION = "host" ]; then
+   eval $config
+else
+    withlinux=" --with-linux=/lib/modules/$KERNEL_VERSION/build"
+    eval $config$withlinux
+fi
+
 make -j8; make install; make modules_install
 
 # remove deps to make the container light weight.
index 4a1a16cd14775a911aca391f45e6591781fe994c..516b5d91c3b157488fac8d9efde41995663172cf 100755 (executable)
@@ -38,5 +38,12 @@ case $1 in
                         -vfile:info --mlockall --no-chdir \
                         --log-file=/var/log/openvswitch/ovs-vswitchd.log
         ;;
-        *) echo "$0 [ovsdb-server|ovs-vswitchd]"
-esac
+        "ovs-vswitchd-host") /usr/share/openvswitch/scripts/ovs-ctl \
+                             --no-ovsdb-server start
+                             /usr/share/openvswitch/scripts/ovs-ctl stop
+                             ovs-vswitchd --pidfile -vconsole:emer \
+                             -vsyslog:err -vfile:info --mlockall --no-chdir \
+                             --log-file=/var/log/openvswitch/ovs-vswitchd.log
+        ;;
+        *) echo "$0 [ovsdb-server|ovs-vswitchd|ovs-vswitchd-host]"
+esac
\ No newline at end of file