From patchwork Fri Dec 20 00:50:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: aginwala aginwala X-Patchwork-Id: 1213844 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="DiBuhL/y"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47f9D84vybz9sRd for ; Fri, 20 Dec 2019 11:51:20 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 26BE824C5E; Fri, 20 Dec 2019 00:51:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ulryRg5SpxI3; Fri, 20 Dec 2019 00:51:17 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 8D00E249CF; Fri, 20 Dec 2019 00:51:17 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 77129C1AE8; Fri, 20 Dec 2019 00:51:17 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3BFD6C1D83 for ; Fri, 20 Dec 2019 00:51:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 298FF886A3 for ; Fri, 20 Dec 2019 00:51:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aSP0mwFnerSn for ; Fri, 20 Dec 2019 00:51:01 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by hemlock.osuosl.org (Postfix) with ESMTPS id B523E887C1 for ; Fri, 20 Dec 2019 00:50:52 +0000 (UTC) Received: by mail-pg1-f178.google.com with SMTP id k3so4055752pgc.3 for ; Thu, 19 Dec 2019 16:50:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=T3m40EI9Fh2Dyt4hCYIWQtIB6ci38JiZ9BiTtNhlERs=; b=DiBuhL/yM5t5dH/LjCCJSsCkZ79GO2PQ7+z8ma9g65DuNQke0+16gltwQupLFXUHjQ nCNBXf9rAv5rWAbXfxO8RqhBsMiC5vKMJQwWmyYFI8/k80RyGQK8z7504gHQ5VJRURfV ZlePpQ/xjhnOG/a+7ywE3pI5d8QIxFNGkhhlEaY4yGNZlw78jVS6/ZaXToLQI4cCLeib 6k1SkOR14lbTUDwbDWg8Zhyrx8Lc4HY7L6g8gNbRrGolqzEWMRkXKd4tRjV3Jxxj6swH BTNPEzOHMvnVp+b7jW7nAigvmwR6YFkWlyECw86iPdiyoFvmxUgKPchm94gI6HMVrEn2 kukg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=T3m40EI9Fh2Dyt4hCYIWQtIB6ci38JiZ9BiTtNhlERs=; b=t2oAp3Fo8WplJe4FIXmFzjaoLajXiSYmj8wrokzs2xEE9ffS0ZDm0Cce72d+OBSrGW HGPbieNJcZNoARrVrojTmrFyMfHvwRaXK85Uj+hS2cdy/HnfU0RbNC2lPEZ/ClO8CnwI /R0kcc7tOrYHMV7WS6QlE9pdm5x59sKtM7T5BBKHZr+ZRI0ylhfg7zYAldmOwFHg2EwN hwkCCSnOpzZUFLIFGfxjATLVldlYsWrYA1nMN0mT9OPzoXQJUMW4/wy05g0cnWUGeOYB WmRupsyZMpmiVJ0Yw2lT1y0I9CszvDe/G21+nU9+yOlG1/ODb4a7IQ5CDCgnn3DAQ8UN OeKA== X-Gm-Message-State: APjAAAVVi2LulyWbiVxMu0fahBRhqEB/EUNqU12ETzVGs1M3CGBdaSiG BbLq7XoT/Oz3D+pisWETRPMB1e+p X-Google-Smtp-Source: APXvYqzavWo4na59u45wsTXq0AMu8JXA5q12NDh8GpZIck/SiYTLO19KaL4VkRn1Vj9IM3zlCHfCwg== X-Received: by 2002:a63:444c:: with SMTP id t12mr11637324pgk.433.1576803051210; Thu, 19 Dec 2019 16:50:51 -0800 (PST) Received: from LM-SJC-11015761.corp.ebay.com ([216.113.160.77]) by smtp.gmail.com with ESMTPSA id c26sm3852932pfj.101.2019.12.19.16.50.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Dec 2019 16:50:50 -0800 (PST) From: amginwal@gmail.com To: dev@openvswitch.org Date: Thu, 19 Dec 2019 16:50:47 -0800 Message-Id: <20191220005047.20435-1-amginwal@gmail.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) MIME-Version: 1.0 Cc: Aliasgar Ginwala Subject: [ovs-dev] [PATCH v2] ovs container build: Make kernel module configurable X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Aliasgar Ginwala --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 --- utilities/docker/Makefile | 2 +- .../docker/debian/build-kernel-modules.sh | 21 +++++++++++++++---- utilities/docker/start-ovs | 11 ++++++++-- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/utilities/docker/Makefile b/utilities/docker/Makefile index 8c2f7810e..d8b08a3c9 100644 --- a/utilities/docker/Makefile +++ b/utilities/docker/Makefile @@ -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} \ diff --git a/utilities/docker/debian/build-kernel-modules.sh b/utilities/docker/debian/build-kernel-modules.sh index 18ac35764..db770ed51 100755 --- a/utilities/docker/debian/build-kernel-modules.sh +++ b/utilities/docker/debian/build-kernel-modules.sh @@ -17,13 +17,17 @@ 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 \ python3-six 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 @@ -32,8 +36,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. diff --git a/utilities/docker/start-ovs b/utilities/docker/start-ovs index 4a1a16cd1..516b5d91c 100755 --- a/utilities/docker/start-ovs +++ b/utilities/docker/start-ovs @@ -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