From patchwork Thu Jul 12 17:35:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Xu X-Patchwork-Id: 943149 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.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="fFTZ1R+m"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41RNQr4pc2z9rxs for ; Fri, 13 Jul 2018 03:36:35 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id A7C52DC5; Thu, 12 Jul 2018 17:36:31 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 6D7CFDBC for ; Thu, 12 Jul 2018 17:36:30 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f181.google.com (mail-pf0-f181.google.com [209.85.192.181]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id D2A40772 for ; Thu, 12 Jul 2018 17:36:29 +0000 (UTC) Received: by mail-pf0-f181.google.com with SMTP id l123-v6so20999287pfl.13 for ; Thu, 12 Jul 2018 10:36:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=WKV4nqff5BDMJHD264vTLaCQco9nxwMXXza071eDxhY=; b=fFTZ1R+mVda2/3L85SUC2klIf7EtCJkvklPgnsTN188JXIbC/4WOCwo0L6OPm2pZiP NdWuMbCObpA4VHjOnKjVGb6D49mYFoQ6sY8qxYVsug6dymSZ7XP9uHiPXwwvzxLSQbP6 NSHhsqSF9+9AP7BZIJYfWTBkVKrFVdL5uNP/MpWqJhAAHjhtEECqCIvdiDJn/MpK5HY1 812R9CtOwmWpctDebrZY5TJfSSfYQCwmo+bg46wYcuusD+oHYJMM2hjVPzTXg1+L8mZG V8/x0OGr1Bp2rOQjbiotZua2GOJFvwPFVSnXNlJkZGGzkA0m5P9csHUopTf5zSdUCBI2 iLCQ== 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; bh=WKV4nqff5BDMJHD264vTLaCQco9nxwMXXza071eDxhY=; b=tVzBPSd8Is3sfA16sQ3Gx9BKGhSVSHIEBkwro528gXsM3OfcJQiIdqNaBI+N2RcsYa q0loOBnWf/7rLivSj7TSra6NcUGzYMQXsQa4Vz/ZEITTZE5iLLaRO9aQjpH/GWL8BvU6 qohya5yIWgeUcbivsZ8z0XJ8SrBVOKGT8hw7CgVy0PFm+fnTfVCkSNMM2K2lXiwI2Uoz oqmj5RW1ukQKd7Jc27koeUtzJ+j8IiayTGf+KeRuwWbQD/EskCqGYwatupzv4T4uuFhR jrWDp1w2tVHL7V1bSAmZ3p0UWwWEWSv0hoXv8c/y2n9fK53QmuLSlUHY0SyuVXhUoz78 /Sng== X-Gm-Message-State: AOUpUlHjKXBUnD7jShigHx00BBBoQESI4H983ZR0WY0YRicVbnIMhizg iuRLsc4tfxXCC7eHdrpwa2zHLhg0 X-Google-Smtp-Source: AAOMgpcmiTU4D76TRJzzwZ5UZ6a1WJBN/o06Sx1bKeZ9zywFte44eXV05Jym7iJ2wSSq90FnqLyQww== X-Received: by 2002:a63:3083:: with SMTP id w125-v6mr2885666pgw.369.1531416989357; Thu, 12 Jul 2018 10:36:29 -0700 (PDT) Received: from martinx-a01.vmware.com.com ([208.91.2.1]) by smtp.gmail.com with ESMTPSA id j23-v6sm35500894pfi.137.2018.07.12.10.36.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Jul 2018 10:36:28 -0700 (PDT) From: Martin Xu To: dev@openvswitch.org Date: Thu, 12 Jul 2018 10:35:54 -0700 Message-Id: <20180712173556.40703-1-martinxu9.ovs@gmail.com> X-Mailer: git-send-email 2.15.2 (Apple Git-101.1) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Flavio Leitner Subject: [ovs-dev] [PATCH v3 1/3] rhel: rename openvswitch kmod rhel6 spec file X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org This patch only affects rhel6 spec file. The rhel6 kmod spec file is renamed from openvswitch-kmod-rhel6.spec to kmod-openvswitch-rhel6.spec . This is to prepare for the next patches to support building multiple kernel versions in the main package. The rename makes the spec file consistent with the resulted kmod-openvswitch-.rpm, which is the real package with kernel module files. Signed-off-by: Martin Xu CC: Greg Rose CC: Ben Pfaff CC: Flavio Leitner CC: Aaron Conole --- Documentation/intro/install/rhel.rst | 7 +++---- poc/playbook-centos-builder.yml | 8 ++++---- rhel/.gitignore | 2 +- rhel/automake.mk | 6 +++--- ...nvswitch-kmod-rhel6.spec.in => kmod-openvswitch-rhel6.spec.in} | 0 5 files changed, 11 insertions(+), 12 deletions(-) rename rhel/{openvswitch-kmod-rhel6.spec.in => kmod-openvswitch-rhel6.spec.in} (100%) diff --git a/Documentation/intro/install/rhel.rst b/Documentation/intro/install/rhel.rst index f8b26069f..6f062e894 100644 --- a/Documentation/intro/install/rhel.rst +++ b/Documentation/intro/install/rhel.rst @@ -197,17 +197,16 @@ the unit tests, run:: Kernel Module ~~~~~~~~~~~~~ -On RHEL 6, to build the Open vSwitch kernel module, copy -rhel/openvswitch-kmod.files into the RPM sources directory and run:: +On RHEL 6, to build the Open vSwitch kernel module run:: - $ rpmbuild -bb rhel/openvswitch-kmod-rhel6.spec + $ rpmbuild -bb rhel/kmod-openvswitch-rhel6.spec You might have to specify a kernel version and/or variants, e.g.: $ rpmbuild -bb \ -D "kversion 2.6.32-131.6.1.el6.x86_64" \ -D "kflavors default debug kdump" \ - rhel/openvswitch-kmod-rhel6.spec + rhel/kmod-openvswitch-rhel6.spec This produces an "kmod-openvswitch" RPM for each kernel variant, in this example: "kmod-openvswitch", "kmod-openvswitch-debug", and diff --git a/poc/playbook-centos-builder.yml b/poc/playbook-centos-builder.yml index 71f104010..e902db75d 100644 --- a/poc/playbook-centos-builder.yml +++ b/poc/playbook-centos-builder.yml @@ -41,13 +41,13 @@ chdir: /git/ovs/rhel with_items: - openvswitch.spec - - openvswitch-kmod-rhel6.spec + - kmod-openvswitch-rhel6.spec - name: Install build dependencies specified from spec files shell: echo "y" | yum-builddep /tmp/{{item}} with_items: - openvswitch.spec - - openvswitch-kmod-rhel6.spec + - kmod-openvswitch-rhel6.spec - name: Create rpm dev tree command: rpmdev-setuptree @@ -81,7 +81,7 @@ line: "Release: {{ ansible_local.builder.release }}" with_items: - openvswitch.spec - - openvswitch-kmod-rhel6.spec + - kmod-openvswitch-rhel6.spec - name: Build Open vSwitch user space rpms command: rpmbuild -bb --without check rhel/openvswitch.spec @@ -89,7 +89,7 @@ chdir: "{{SOURCE}}/openvswitch-{{version.stdout}}" - name: Build Open vSwitch kmod rpms (only for currently loaded kernel) - command: rpmbuild -bb --without check rhel/openvswitch-kmod-rhel6.spec + command: rpmbuild -bb --without check rhel/kmod-openvswitch-rhel6.spec args: chdir: "{{SOURCE}}/openvswitch-{{version.stdout}}" diff --git a/rhel/.gitignore b/rhel/.gitignore index e584a1ed0..a9c047f83 100644 --- a/rhel/.gitignore +++ b/rhel/.gitignore @@ -1,6 +1,6 @@ openvswitch-dkms.spec openvswitch-kmod-rhel5.spec -openvswitch-kmod-rhel6.spec +kmod-openvswitch-rhel6.spec openvswitch-kmod-fedora.spec openvswitch.spec openvswitch-fedora.spec diff --git a/rhel/automake.mk b/rhel/automake.mk index 137ff4a39..82a450831 100644 --- a/rhel/automake.mk +++ b/rhel/automake.mk @@ -15,8 +15,8 @@ EXTRA_DIST += \ rhel/etc_sysconfig_network-scripts_ifup-ovs \ rhel/openvswitch-dkms.spec \ rhel/openvswitch-dkms.spec.in \ - rhel/openvswitch-kmod-rhel6.spec \ - rhel/openvswitch-kmod-rhel6.spec.in \ + rhel/kmod-openvswitch-rhel6.spec \ + rhel/kmod-openvswitch-rhel6.spec.in \ rhel/openvswitch-kmod.files \ rhel/openvswitch-kmod-fedora.spec \ rhel/openvswitch-kmod-fedora.spec.in \ @@ -48,7 +48,7 @@ update_rhel_spec = \ $(srcdir)/rhel/openvswitch-dkms.spec: rhel/openvswitch-dkms.spec.in $(top_builddir)/config.status $(update_rhel_spec) -$(srcdir)/rhel/openvswitch-kmod-rhel6.spec: rhel/openvswitch-kmod-rhel6.spec.in $(top_builddir)/config.status +$(srcdir)/rhel/kmod-openvswitch-rhel6.spec: rhel/kmod-openvswitch-rhel6.spec.in $(top_builddir)/config.status $(update_rhel_spec) $(srcdir)/rhel/openvswitch-kmod-fedora.spec: rhel/openvswitch-kmod-fedora.spec.in $(top_builddir)/config.status diff --git a/rhel/openvswitch-kmod-rhel6.spec.in b/rhel/kmod-openvswitch-rhel6.spec.in similarity index 100% rename from rhel/openvswitch-kmod-rhel6.spec.in rename to rhel/kmod-openvswitch-rhel6.spec.in From patchwork Thu Jul 12 17:35:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Xu X-Patchwork-Id: 943150 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.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="Xt1cHVJn"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41RNRQ29yXz9rxs for ; Fri, 13 Jul 2018 03:37:06 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 777B4DCE; Thu, 12 Jul 2018 17:37:01 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id AC70AD81 for ; Thu, 12 Jul 2018 17:37:00 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl0-f41.google.com (mail-pl0-f41.google.com [209.85.160.41]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 238D0773 for ; Thu, 12 Jul 2018 17:37:00 +0000 (UTC) Received: by mail-pl0-f41.google.com with SMTP id s24-v6so10970212plq.6 for ; Thu, 12 Jul 2018 10:37:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WnXhbrbtrbDyixQ3TSifx2ywptcC0SCLaL0T3Bi8hDw=; b=Xt1cHVJnh8KAVbEc7QQK9mYUfNX6Ii15Wp4gWNdNvqcSAOgE1AzJWdLcQfb7udnEsq /Z5/1hmohpJJZCgLU5//JmWA1EvCkmAmO49Jh46EZxGopRwB87uNB5s1Wm2ELrExJ3Gb Tk77JwwJF2h2p3JMoqNXffBPO3ZRk1y16rNx+9GZDGboZtNtLDxMkSzegQnn8oaRYkD1 fvTLx43iXppJYIGEnU3nBgMUxuvNi7PKqdto/j3AUubSghJiqz0JbgYZBCGSKyXLt2NA lijt04UaJXSwFrJRzguGxmrvR1PFm6p1IOJahxXnQFXdKEEMYYW/AxvWOWxHTl0A2by1 iETQ== 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:in-reply-to :references; bh=WnXhbrbtrbDyixQ3TSifx2ywptcC0SCLaL0T3Bi8hDw=; b=Y/ZvQZqrUCocd1Ek8Ev8rmr16h7keAo7mNgOZ2nHvSfPAjD5oqdijQe3w8REFvZH5R VjO7tzRwiXHM4GWm4rTvgOhz6i2w0GLQ6ymICj7U6vDiQz3j9GIc7d8VORIqi0lOvlNT yfoFvAlUr5ovmUSXE+pMR0dJwXIibsQhofHNkpFLGQRNlVTSDbKgdlfauiFbTEtQq8Q3 Jyh5b93AkaI/Hv2CYAyHfa2V6+PH7FogAICFSN9hyEztbGYQVw9yM8EDHg8mihBAu4o1 5cnlDf2ToFmHnDE1EG65m38qQPU1nFsWEsu7GYfCX4i66kIAfzY2Z3kAP2rIFfThWuL0 CsNg== X-Gm-Message-State: AOUpUlEB/lJ1JB+DrQalEtZr3NG9ny64uThVLDwV6aNi8JUk/PIBaTZ9 vprxu1VnixZsDfesZZwkH+nfKZR7 X-Google-Smtp-Source: AAOMgpd9CN5jk6GjtMwGMK5WTvVYqgKD+R07c60sU+qBGH+cli4vEV5Vag4GSmKeOLcZZh9qEMH70w== X-Received: by 2002:a17:902:59da:: with SMTP id d26-v6mr3085004plj.42.1531417019611; Thu, 12 Jul 2018 10:36:59 -0700 (PDT) Received: from martinx-a01.vmware.com.com ([208.91.2.1]) by smtp.gmail.com with ESMTPSA id j23-v6sm35500894pfi.137.2018.07.12.10.36.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Jul 2018 10:36:59 -0700 (PDT) From: Martin Xu To: dev@openvswitch.org Date: Thu, 12 Jul 2018 10:35:55 -0700 Message-Id: <20180712173556.40703-2-martinxu9.ovs@gmail.com> X-Mailer: git-send-email 2.15.2 (Apple Git-101.1) In-Reply-To: <20180712173556.40703-1-martinxu9.ovs@gmail.com> References: <20180712173556.40703-1-martinxu9.ovs@gmail.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Flavio Leitner Subject: [ovs-dev] [PATCH v3 2/3] rhel: remove openvswitch-kmod package from build, rhel6 X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org This patch only affects rhel6 spec file. Previouly the kernel_module_package macro is used to generate spec file template to build kmod-openvswitch RPM. The main package only contains the openvswitch.conf for depmod. The macro is now removed. Everything is built in the main package instead. This effectively removes the redudant openvswitch-kmod package from the build. Signed-off-by: Martin Xu CC: Greg Rose CC: Ben Pfaff CC: Flavio Leitner CC: Aaron Conole --- rhel/automake.mk | 1 - rhel/kmod-openvswitch-rhel6.spec.in | 32 ++++++++++++++++---------------- rhel/openvswitch-kmod.files | 3 --- 3 files changed, 16 insertions(+), 20 deletions(-) delete mode 100644 rhel/openvswitch-kmod.files diff --git a/rhel/automake.mk b/rhel/automake.mk index 82a450831..180419427 100644 --- a/rhel/automake.mk +++ b/rhel/automake.mk @@ -17,7 +17,6 @@ EXTRA_DIST += \ rhel/openvswitch-dkms.spec.in \ rhel/kmod-openvswitch-rhel6.spec \ rhel/kmod-openvswitch-rhel6.spec.in \ - rhel/openvswitch-kmod.files \ rhel/openvswitch-kmod-fedora.spec \ rhel/openvswitch-kmod-fedora.spec.in \ rhel/openvswitch.spec \ diff --git a/rhel/kmod-openvswitch-rhel6.spec.in b/rhel/kmod-openvswitch-rhel6.spec.in index daa3dade1..7b9424968 100644 --- a/rhel/kmod-openvswitch-rhel6.spec.in +++ b/rhel/kmod-openvswitch-rhel6.spec.in @@ -1,7 +1,7 @@ # Spec file for Open vSwitch kernel modules on Red Hat Enterprise # Linux 6. -# Copyright (C) 2011, 2012 Nicira, Inc. +# Copyright (C) 2011, 2012, 2018 Nicira, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright @@ -10,7 +10,7 @@ %define oname openvswitch -Name: %{oname}-kmod +Name: kmod-%{oname} Version: @VERSION@ Release: 1%{?dist} Summary: Open vSwitch kernel module @@ -19,23 +19,22 @@ Group: System/Kernel License: GPLv2 URL: http://openvswitch.org/ Source0: %{oname}-%{version}.tar.gz -Source1: %{oname}-kmod.files BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) -BuildRequires: %kernel_module_package_buildreqs # Without this we get an empty openvswitch-debuginfo package (whose name # conflicts with the openvswitch-debuginfo package for OVS userspace). %undefine _enable_debug_packages +%define kernel_source_extended() /usr/src/kernels/%{2}$([ %{1} = default ] || echo ".%{1}") + +# By default, build against the latest installed kernel-devel +%{!?kversion:%global kversion %(rpm -q --qf '%{VERSION}-%{RELEASE}.%{ARCH}' `rpm -qa | egrep "^kernel(-rt|-aarch64)?-devel" | /usr/lib/rpm/redhat/rpmsort -r | head -n 1` | head -n 1)} # Use -D 'kversion 2.6.32-131.6.1.el6.x86_64' to build package # for specified kernel version. -%{?kversion:%define kernel_version %kversion} # Use -D 'kflavors default debug kdump' to build packages for # specified kernel variants. -%{!?kflavors:%define kflavors default} - -%kernel_module_package -n %{oname} -f %{SOURCE1} %kflavors +%{!?kflavors:%global kflavors default} %description Open vSwitch Linux kernel module. @@ -45,24 +44,24 @@ Open vSwitch Linux kernel module. %setup -n %{oname}-%{version} %build -for flavor in %flavors_to_build; do +for flavor in %{kflavors} ; do mkdir _$flavor - (cd _$flavor && ../configure --with-linux="%{kernel_source $flavor}") + (cd _$flavor && ../configure --with-linux="%{kernel_source_extended $flavor %{kversion}}") %{__make} -C _$flavor/datapath/linux %{?_smp_mflags} done %install export INSTALL_MOD_PATH=$RPM_BUILD_ROOT export INSTALL_MOD_DIR=extra/%{oname} -for flavor in %flavors_to_build ; do - make -C %{kernel_source $flavor} modules_install \ +for flavor in %{kflavors} ; do + make -C %{kernel_source_extended $flavor %{kversion}} modules_install \ M="`pwd`"/_$flavor/datapath/linux # Cleanup unnecessary kernel-generated module dependency files. find $INSTALL_MOD_PATH/lib/modules -iname 'modules.*' -exec rm {} \; done install -d %{buildroot}%{_sysconfdir}/depmod.d/ -for module in %{buildroot}/lib/modules/%{kernel_version}/$INSTALL_MOD_DIR/*.ko; +for module in %{buildroot}/lib/modules/%{kversion}/$INSTALL_MOD_DIR/*.ko; do modname="$(basename ${module})" echo "override ${modname%.ko} * extra/%{oname}" >> %{oname}.conf @@ -78,7 +77,7 @@ done if [ -x "/sbin/weak-modules" ]; then for m in openvswitch vport-gre vport-stt vport-geneve \ vport-lisp vport-vxlan; do - echo "/lib/modules/%{kernel}/extra/$m.ko" + echo "/lib/modules/%{kversion}/extra/$m.ko" done | /sbin/weak-modules --add-modules fi @@ -90,14 +89,15 @@ if [ "$1" = 0 ]; then # Erase, not upgrade if [ -x "/sbin/weak-modules" ]; then for m in openvswitch vport-gre vport-stt vport-geneve \ vport-lisp vport-vxlan; do - echo "/lib/modules/%{kernel}/extra/$m.ko" + echo "/lib/modules/%{kversion}/extra/$m.ko" done | /sbin/weak-modules --remove-modules fi fi %files -%defattr(644,root,root) +%defattr(644,root,root,755) /etc/depmod.d/%{oname}.conf +/lib/modules/ %clean rm -rf $RPM_BUILD_ROOT diff --git a/rhel/openvswitch-kmod.files b/rhel/openvswitch-kmod.files deleted file mode 100644 index 357c2e8b7..000000000 --- a/rhel/openvswitch-kmod.files +++ /dev/null @@ -1,3 +0,0 @@ -%defattr(644,root,root,755) -/lib/modules/%2-%1 -/etc/depmod.d/openvswitch.conf From patchwork Thu Jul 12 17:35:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Xu X-Patchwork-Id: 943152 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.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="ZnTGyYPO"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41RNS52RLyz9rxs for ; Fri, 13 Jul 2018 03:37:41 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 37C64DC1; Thu, 12 Jul 2018 17:37:15 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 1BFB4D4D for ; Thu, 12 Jul 2018 17:37:14 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl0-f44.google.com (mail-pl0-f44.google.com [209.85.160.44]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 326A7772 for ; Thu, 12 Jul 2018 17:37:13 +0000 (UTC) Received: by mail-pl0-f44.google.com with SMTP id z9-v6so10962095plo.1 for ; Thu, 12 Jul 2018 10:37:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Eqg29yGUsNfoLM6Ko88pBvXGR7WODBo6n9OVdanhdgk=; b=ZnTGyYPOqd0Kz1FEZDm5h/ygc8weMpN7P/wBFWpZULN42oJ8CAOITa6nH4k2RvdV0X wyazqSi0s+vi1ckNu9paP42/socV9LdEC31xnj2Ox1tbzSm7q+nPmH72Q7PLvV6l5ELX Kl4HziYik9YQLNsNiKHlZuSA+SQv8uQ2zSql1ihU1i3Z7QbHt4xUPmV88ULZ/LtatHGq DhOFfCBdPfhy7ogIeZLqoRmnjmpxtbFFO3M0y0YBwRom8F54qogeBakyp9rHFrb6RDs7 DaoeH9ysUenNs2jW+mQWWV36LCKoGWK3C8h+WsczypP22Bk7JnvwpEwSDEIIf9PqJd85 Ggsw== 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:in-reply-to :references; bh=Eqg29yGUsNfoLM6Ko88pBvXGR7WODBo6n9OVdanhdgk=; b=VRlr4NnRFUv1FR9BSnespR4U1wMknqjKMZuD3/fizqVai93WM8ORvtCz7AKWaIORf5 ZQbg1Miu2rA5dG3qfeyMgXqWWjNMohJhSvnyYhFl6yEBkm4dxk6f66jwFJ5KqLACgAnW iWVHDcrWgpX7sAwXB7m45iIiJHW20M7A4XzJiULGJqp+x7ubMEI4cO7Cms+CcSa69Reg JnyB3Yq8LjpFyjCV3o7Z7JLJoD6qq2sqP5CvxD7bHUV6ugwyTlOsZK6moUZGxA8rHMtK HMOl+8VxXwQlCCSP8/Byuc+Y4hUJVZQVI6QyYtLV9n0bZ5HuVc89AU1l28cPNWgEkhPv CxTA== X-Gm-Message-State: AOUpUlHn59qyc+EpC3UH+K41/AIZVQ0p6HoQeIZ/aFxu+DvdmxWNPhlI YLfbC6TIgHi1iaEWi9aEsvCiLbnY X-Google-Smtp-Source: AAOMgpd3HKkOM6Dv0E3GUEHdI83D5UiFIpQzLDTu3U3PQF4yvIqg0vdATo2hzVnP3EvJThKvmozEpw== X-Received: by 2002:a17:902:8f96:: with SMTP id z22-v6mr3071953plo.190.1531417032630; Thu, 12 Jul 2018 10:37:12 -0700 (PDT) Received: from martinx-a01.vmware.com.com ([208.91.2.1]) by smtp.gmail.com with ESMTPSA id j23-v6sm35500894pfi.137.2018.07.12.10.37.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Jul 2018 10:37:12 -0700 (PDT) From: Martin Xu To: dev@openvswitch.org Date: Thu, 12 Jul 2018 10:35:56 -0700 Message-Id: <20180712173556.40703-3-martinxu9.ovs@gmail.com> X-Mailer: git-send-email 2.15.2 (Apple Git-101.1) In-Reply-To: <20180712173556.40703-1-martinxu9.ovs@gmail.com> References: <20180712173556.40703-1-martinxu9.ovs@gmail.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Flavio Leitner Subject: [ovs-dev] [PATCH v3 3/3] rhel: support kmod-openvswitch build against multiple kernels, rhel6 X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org This patch only affects rhel6 spec file. RHEL 7.4 introduced backward incompatible changes in the kernel. As a result, prebuilt PRM packages against kernels newer than 693.17.1 will cannot be used on systems with older kernels, vice versa. This patch allows multiple kernel version numbers delimited by whitespace to be passed as variable "kversion". kmod-openvswitch RPM packages the kernel module .ko files from all specified kernel versions. This patch also includes a script to update the weak-update symlinks if the system kernel version is upgraded or downgraded after kmod-openvswitch is installed. Signed-off-by: Martin Xu Co-authored-by: Greg Rose CC: Ben Pfaff CC: Flavio Leitner CC: Aaron Conole --- rhel/automake.mk | 1 + rhel/kmod-openvswitch-rhel6.spec.in | 87 +++++++++++++--------- ...sr_share_openvswitch_scripts_ovs-kmod-manage.sh | 74 ++++++++++++++++++ 3 files changed, 127 insertions(+), 35 deletions(-) create mode 100644 rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh diff --git a/rhel/automake.mk b/rhel/automake.mk index 180419427..7b6c78fd7 100644 --- a/rhel/automake.mk +++ b/rhel/automake.mk @@ -26,6 +26,7 @@ EXTRA_DIST += \ rhel/usr_share_openvswitch_scripts_ovs-systemd-reload \ rhel/usr_share_openvswitch_scripts_sysconfig.template \ rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \ + rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh \ rhel/usr_lib_udev_rules.d_91-vfio.rules \ rhel/usr_lib_systemd_system_openvswitch.service \ rhel/usr_lib_systemd_system_ovsdb-server.service \ diff --git a/rhel/kmod-openvswitch-rhel6.spec.in b/rhel/kmod-openvswitch-rhel6.spec.in index 7b9424968..f5ca134ed 100644 --- a/rhel/kmod-openvswitch-rhel6.spec.in +++ b/rhel/kmod-openvswitch-rhel6.spec.in @@ -27,10 +27,12 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %define kernel_source_extended() /usr/src/kernels/%{2}$([ %{1} = default ] || echo ".%{1}") -# By default, build against the latest installed kernel-devel -%{!?kversion:%global kversion %(rpm -q --qf '%{VERSION}-%{RELEASE}.%{ARCH}' `rpm -qa | egrep "^kernel(-rt|-aarch64)?-devel" | /usr/lib/rpm/redhat/rpmsort -r | head -n 1` | head -n 1)} # Use -D 'kversion 2.6.32-131.6.1.el6.x86_64' to build package # for specified kernel version. +# Use -D 'kversion 3.10.0-693.1.1.el7.x86_64 3.10.0-693.17.1.el7.x86_64' +# to build package for mulitple kernel versions in the same package +# By default, build against the latest installed kernel-devel +%{!?kversion:%global kversion %(rpm -q --qf '%{VERSION}-%{RELEASE}.%{ARCH}' `rpm -qa | egrep "^kernel(-rt|-aarch64)?-devel" | /usr/lib/rpm/redhat/rpmsort -r | head -n 1` | head -n 1)} # Use -D 'kflavors default debug kdump' to build packages for # specified kernel variants. @@ -44,60 +46,75 @@ Open vSwitch Linux kernel module. %setup -n %{oname}-%{version} %build -for flavor in %{kflavors} ; do - mkdir _$flavor - (cd _$flavor && ../configure --with-linux="%{kernel_source_extended $flavor %{kversion}}") - %{__make} -C _$flavor/datapath/linux %{?_smp_mflags} +for kv in %{kversion}; do + for flavor in %{kflavors}; do + mkdir -p _$flavor/_$kv + (cd _$flavor/_$kv && ../../configure --with-linux="%{kernel_source_extended $flavor $kv}") + %{__make} -C _$flavor/_$kv/datapath/linux %{?_smp_mflags} + done done %install export INSTALL_MOD_PATH=$RPM_BUILD_ROOT export INSTALL_MOD_DIR=extra/%{oname} -for flavor in %{kflavors} ; do - make -C %{kernel_source_extended $flavor %{kversion}} modules_install \ - M="`pwd`"/_$flavor/datapath/linux - - # Cleanup unnecessary kernel-generated module dependency files. - find $INSTALL_MOD_PATH/lib/modules -iname 'modules.*' -exec rm {} \; +for kv in %{kversion}; do + for flavor in %{kflavors} ; do + make -C %{kernel_source_extended $flavor $kv} modules_install \ + M="`pwd`"/_$flavor/_$kv/datapath/linux + # Cleanup unnecessary kernel-generated module dependency files. + find $INSTALL_MOD_PATH/lib/modules -iname 'modules.*' -exec rm {} \; + done done install -d %{buildroot}%{_sysconfdir}/depmod.d/ -for module in %{buildroot}/lib/modules/%{kversion}/$INSTALL_MOD_DIR/*.ko; -do - modname="$(basename ${module})" - echo "override ${modname%.ko} * extra/%{oname}" >> %{oname}.conf - echo "override ${modname%.ko} * weak-updates/%{oname}" >> %{oname}.conf +for kv in %{kversion}; do + for module in %{buildroot}/lib/modules/$kv/$INSTALL_MOD_DIR/*.ko; + do + modname="$(basename ${module})" + grep -qsPo "^\s*override ${modname%.ko} \* extra\/%{oname}" %{oname}.conf || \ + echo "override ${modname%.ko} * extra/%{oname}" >> %{oname}.conf + grep -qsPo "^\s*override ${modname%.ko} \* weak-updates\/%{oname}" %{oname}.conf || \ + echo "override ${modname%.ko} * weak-updates/%{oname}" >> %{oname}.conf + done done install -m 644 %{oname}.conf %{buildroot}%{_sysconfdir}/depmod.d/ +install -d -m 0755 $RPM_BUILD_ROOT/usr/share/%{oname}/scripts +install -p -m 0755 rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh \ + $RPM_BUILD_ROOT/usr/share/%{oname}/scripts/ovs-kmod-manage.sh %post -# Ensure that modprobe will find our modules. -for k in $(cd /lib/modules && /bin/ls); do - [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k" -done -if [ -x "/sbin/weak-modules" ]; then - for m in openvswitch vport-gre vport-stt vport-geneve \ - vport-lisp vport-vxlan; do - echo "/lib/modules/%{kversion}/extra/$m.ko" - done | /sbin/weak-modules --add-modules -fi - -%postun -for k in $(cd /lib/modules && /bin/ls); do - [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k" -done -if [ "$1" = 0 ]; then # Erase, not upgrade +current_kernel=$(uname -r) +IFS=. read installed_major installed_minor installed_micro installed_arch \ + installed_build <<<"${current_kernel##*-}" +if [ "$installed_major" = "693" ]; then + # Workaround for RHEL 7.4 + if [ -x "/usr/share/%{oname}/scripts/ovs-kmod-manage.sh" ]; then + /usr/share/%{oname}/scripts/ovs-kmod-manage.sh + fi +else + # Ensure that modprobe will find our modules. + for k in $(cd /lib/modules && /bin/ls); do + [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k" + done if [ -x "/sbin/weak-modules" ]; then for m in openvswitch vport-gre vport-stt vport-geneve \ vport-lisp vport-vxlan; do - echo "/lib/modules/%{kversion}/extra/$m.ko" - done | /sbin/weak-modules --remove-modules + echo "/lib/modules/%{kversion}/extra/%{oname}/$m.ko" + done | /sbin/weak-modules --add-modules fi fi +%postun +for kname in `ls -d /lib/modules/*` +do + rm -rf $kname/weak-updates/openvswitch +done +/sbin/depmod -a + %files %defattr(644,root,root,755) /etc/depmod.d/%{oname}.conf /lib/modules/ +%attr(755,root,root) /usr/share/%{oname}/scripts/ovs-kmod-manage.sh %clean rm -rf $RPM_BUILD_ROOT diff --git a/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh b/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh new file mode 100644 index 000000000..f2cdca48f --- /dev/null +++ b/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh @@ -0,0 +1,74 @@ +#!/bin/sh + +# Copyright (c) 2018 Nicira/VMware, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +script_name=$(basename -- "$0") +current_kernel=$(uname -r) +echo current kernel is $current_kernel + +IFS=. read installed_major installed_minor installed_micro \ + installed_arch installed_build <<<"${current_kernel##*-}" +# echo installed_major=$installed_major installed_minor=$installed_minor \ +# installed_micro=$installed_micro installed_arch=$installed_arch \ +# installed_build=$installed_build + +expected_base_minor="el7" +expected_minor=11 + +found_match=false +for kname in `ls -d /lib/modules/*` +do + IFS=. read major minor micro arch build <<<"${kname##*-}" +# echo major=$major minor=$minor micro=$micro arch=$arch build=$build + if [ "$installed_minor" = "$expected_base_minor" ] || + [ "$installed_minor" -le "$expected_minor" ]; then + if [ "$minor" = "1" ]; then + requested_kernel=$kname + found_match="true" + echo "Installing Openvswitch KMOD from kernel $kname" + break + fi + else + if [ "$minor" = "17" ]; then + requested_kernel=$kname + found_match="true" + echo "Installing Openvswitch KMOD from kernel $kname" + break + fi + fi +done + +if [ "$found_match" = "false" ]; then + echo $script_name: Failed + exit 1 +fi + +if [ "$requested_kernel" != "/lib/modules/$current_kernel" ]; then + if [ -x "/sbin/weak-modules" ]; then + if [ ! -d /lib/modules/$current_kernel/weak-updates/openvswitch ]; then + mkdir -p /lib/modules/$current_kernel/weak-updates + mkdir -p /lib/modules/$current_kernel/weak-updates/openvswitch + fi + for m in openvswitch vport-gre vport-stt vport-geneve \ + vport-lisp vport-vxlan; do + ln -f -s $requested_kernel/extra/openvswitch/$m.ko \ + /lib/modules/$current_kernel/weak-updates/openvswitch/$m.ko + done + fi +else + echo Proper OVS kernel modules already configured +fi +# Always run depmod +/sbin/depmod -a