Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bphilip/add mofed and dependencies #11479

Open
wants to merge 24 commits into
base: 3.0-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 32 additions & 1 deletion LICENSES-AND-NOTICES/SPECS/data/licenses.json
Original file line number Diff line number Diff line change
Expand Up @@ -2455,13 +2455,44 @@
"NVIDIA": {
"license": "[ASL 2.0 License and spec specific licenses](http://www.apache.org/licenses/LICENSE-2.0)",
"specs": [
"fwctl",
"fwctl-signed",
"ibarr",
"ibsim",
"iser",
"iser-signed",
"isert",
"isert-signed",
"knem",
"knem-modules-signed",
"libnvidia-container",
"mft_kernel",
"mft_kernel-signed",
"mlnx-ethtool",
"mlnx-iproute2",
"mlnx-nfsrdma",
"mlnx-nfsrdma-signed",
"mlnx-ofa_kernel",
"mlnx-ofa_kernel-modules-signed",
"mlnx-tools",
"mlx-bootctl",
"mlx-steering-dump",
"multiperf",
"nvidia-container-toolkit",
"ofed-docs",
"ofed-scripts",
"perftest"
"perftest",
"rshim",
"srp",
"xpmem",
"xpmem-lib",
"xpmem-modules-signed"
]
},
"NVIDIA (BSD)": {
"license": "[BSD](https://github.com/Mellanox/sockperf/blob/sockperf_v2/copying)",
"specs": [
"sockperf"
]
},
"OpenEuler": {
Expand Down
142 changes: 142 additions & 0 deletions SPECS-SIGNED/fwctl-signed/fwctl-signed.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a bunch of comments into this spec but they apply to most/all other signed spec files.

# Copyright (c) 2024 Nvidia Inc. All rights reserved.
#
# This software is available to you under a choice of one of two
# licenses. You may choose to be licensed under the terms of the GNU
# General Public License (GPL) Version 2, available from the file
# COPYING in the main directory of this source tree, or the
# OpenIB.org BSD license below:
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# - Redistributions of source code must retain the above
# copyright notice, this list of conditions and the following
# disclaimer.
#
# - Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#

%{!?_name: %define _name fwctl}
%{!?_version: %define _version 24.10}
%{!?_release: %define _release OFED.24.10.0.6.7.1}
Comment on lines +33 to +35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why define these _version separately? Won't the %{version} work? Similar question for _name. And what's the logic behind _release? I see it trickles down to _kmp_rel for instance but I don't see _kmp_rel used anywhere?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version is defined from MOFED SPECS for alignment. Hence keeping it same for furture updates.


%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers))
%global target_azurelinux_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers))
%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1)

%global KVERSION %{target_kernel_version_full}
%global K_SRC /lib/modules/%{target_kernel_version_full}/build

# KMP is disabled by default
%{!?KMP: %global KMP 0}

%{!?KVERSION: %global KVERSION %{target_kernel_version_full}}
%global kernel_version %{KVERSION}
%global krelver %(echo -n %{KVERSION} | sed -e 's/-/_/g')
# take path to kernel sources if provided, otherwise look in default location (for non KMP rpms).
%{!?K_SRC: %global K_SRC /lib/modules/%{KVERSION}/build}

# define release version
%{!?src_release: %global src_release %{_release}_%{krelver}}
%if "%{KMP}" != "1"
%global _release1 %{src_release}
%else
%global _release1 %{_release}
%endif
%global _kmp_rel %{_release1}%{?_kmp_build_num}%{?_dist}

Summary: %{_name} Driver
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the specs done, please also update the version_release_matching_groups inside toolkit/scripts/check_entangled_specs.py. This is part of the PR check, which makes sure "entangled" specs get updated in lockstep within one PR. In case of (regular, signed) spec pairs, if you only update the regular one and forget about this one here, we'd end up either publishing a newer version without the signed .ko files or not publishing the new version at all (I'd need to check the details).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign pipeline changes are coming from another PR. Is this can be done with signing pipeline changes for signed SPECs?

Name: %{_name}
Version: %{_version}
Release: 1%{?dist}
License: GPLv2
jslobodzian marked this conversation as resolved.
Show resolved Hide resolved
Url: http://nvidia.com
Group: System Environment/Base

# This package's "version" and "release" must reflect the unsigned version that
# was signed.
# An important consequence is that when making a change to this package, the
# unsigned version/release must be increased to keep the two versions consistent.
# Ideally though, this spec will not change much or at all, so the version will
# just track the unsigned package's version/release.
Comment on lines +70 to +75
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for the comment - the specs entanglement PR check will handle that for you. Just make sure to update the set of spec pairs, which need to be kept in sync.

#
# To populate these sources:
# 1. Build the unsigned packages as normal
# 2. Sign the desired binary
# 3. Place the unsigned package and signed binary in this spec's folder
# 4. Build this spec

Source0: %{name}-%{version}-%{release}.%{_arch}.rpm
Source1: fwctl.ko
Source2: mlx5_fwctl.ko

BuildRoot: /var/tmp/%{name}-%{version}-build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a need to define BuildRoot explicitly here instead of using the default?

Vendor: Microsoft Corporation
Distribution: Azure Linux
ExclusiveArch: x86_64

BuildRequires: gcc
BuildRequires: make
BuildRequires: kernel-devel = %{target_kernel_version_full}
BuildRequires: kernel-headers = %{target_kernel_version_full}
BuildRequires: binutils
BuildRequires: systemd
BuildRequires: kmod
BuildRequires: mlnx-ofa_kernel-devel = %{_version}
BuildRequires: mlnx-ofa_kernel-source = %{_version}
Comment on lines +92 to +100
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General comment for all signed specs: they don't need most BuildRequires, since they only expand already built RPMs and replace a few files. The packages providing rpm2cpio and cpio are part of the default build chroot but to be on the safe side, I'd add them to BuildRequires.


Requires: mlnx-ofa_kernel = %{_version}
Requires: mlnx-ofa_kernel-modules = %{_version}
Requires: kernel = %{target_kernel_version_full}
Requires: kmod

%description
fwctl signed kernel modules
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the description, that the published package will have, so I'd suggest something, that gives users more information about the package.


%prep

%build
rpm2cpio %{Source0} | cpio -idmv -D %{buildroot}

%install
cp %{Source1} %{buildroot}/lib/modules/%{KVERSION}/updates/fwctl/fwctl.ko
jslobodzian marked this conversation as resolved.
Show resolved Hide resolved
cp %{Source2} %{buildroot}/lib/modules/%{KVERSION}/updates/fwctl/mlx5/mlx5_fwctl.ko
gjswalling marked this conversation as resolved.
Show resolved Hide resolved

%clean
rm -rf %{buildroot}

%post
if [ $1 -ge 1 ]; then # 1 : This package is being installed or reinstalled
/sbin/depmod %{KVERSION}
fi # 1 : closed
# END of post

%postun
/sbin/depmod %{KVERSION}

%if "%{KMP}" != "1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure KMP makes much sense in the signed spec, since its only purpose is to repackage the unsigned RPM. Also, with the way it's written right now, if KMP ever was equal to 1, we'd end up with an invalid spec file (no %files section).

%files
%defattr(-,root,root,-)
/lib/modules/%{KVERSION}/%{install_mod_dir}/
%config(noreplace) %{_sysconfdir}/depmod.d/zz02-%{name}-*.conf
%endif

%changelog
* Tue Dec 16 2024 Binu Jose Philip <[email protected]> - 24.10.0.6.7.1
- Creating signed spec
- Initial Azure Linux import from NVIDIA (license: GPLv2)
- License verified
138 changes: 138 additions & 0 deletions SPECS-SIGNED/iser-signed/iser-signed.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
#
# Copyright (c) 2014 Mellanox Technologies. All rights reserved.
#
# This Software is licensed under one of the following licenses:
#
# 1) under the terms of the "Common Public License 1.0" a copy of which is
# available from the Open Source Initiative, see
# http://www.opensource.org/licenses/cpl.php.
#
# 2) under the terms of the "The BSD License" a copy of which is
# available from the Open Source Initiative, see
# http://www.opensource.org/licenses/bsd-license.php.
#
# 3) under the terms of the "GNU General Public License (GPL) Version 2" a
# copy of which is available from the Open Source Initiative, see
# http://www.opensource.org/licenses/gpl-license.php.
#
# Licensee has the right to choose one of the above licenses.
#
# Redistributions of source code must retain the above copyright
# notice and one of the license notices.
#
# Redistributions in binary form must reproduce both the above copyright
# notice, one of the license notices in the documentation
# and/or other materials provided with the distribution.
#
#

%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers))
%global target_azurelinux_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers))
%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1)

%global KVERSION %{target_kernel_version_full}
%global K_SRC /lib/modules/%{target_kernel_version_full}/build

%{!?_name: %define _name iser}
%{!?_version: %define _version 24.10}
%{!?_release: %define _release OFED.24.10.0.6.7.1}

# KMP is disabled by default
%{!?KMP: %global KMP 0}

# take kernel version or default to uname -r
# %{!?KVERSION: %global KVERSION %(uname -r)}
%{!?KVERSION: %global KVERSION %{target_kernel_version_full}}
%global kernel_version %{KVERSION}
%global krelver %(echo -n %{KVERSION} | sed -e 's/-/_/g')
# take path to kernel sources if provided, otherwise look in default location (for non KMP rpms).
# %{!?K_SRC: %global K_SRC /lib/modules/%{KVERSION}/build}

# define release version
%{!?src_release: %global src_release %{_release}_%{krelver}}
%if "%{KMP}" != "1"
%global _release1 %{src_release}
%else
%global _release1 %{_release}
%endif
%global _kmp_rel %{_release1}%{?_kmp_build_num}%{?_dist}

Summary: %{_name} Driver
Name: %{_name}
Version: %{_version}
Release: 1%{?dist}
License: GPLv2
jslobodzian marked this conversation as resolved.
Show resolved Hide resolved
Url: http://www.mellanox.com
Group: System Environment/Base

# This package's "version" and "release" must reflect the unsigned version that
# was signed.
# An important consequence is that when making a change to this package, the
# unsigned version/release must be increased to keep the two versions consistent.
# Ideally though, this spec will not change much or at all, so the version will
# just track the unsigned package's version/release.
#
# To populate these sources:
# 1. Build the unsigned packages as normal
# 2. Sign the desired binary
# 3. Place the unsigned package and signed binary in this spec's folder
# 4. Build this spec

Source0: %{name}-%{version}-%{release}.%{_arch}.rpm
Source1: ib_iser.ko

BuildRoot: /var/tmp/%{name}-%{version}-build
Vendor: Microsoft Corporation
Distribution: Azure Linux
ExclusiveArch: x86_64

BuildRequires: gcc
BuildRequires: make
BuildRequires: kernel-devel = %{target_kernel_version_full}
BuildRequires: kernel-headers = %{target_kernel_version_full}
BuildRequires: binutils
BuildRequires: systemd
BuildRequires: kmod
BuildRequires: mlnx-ofa_kernel-devel = %{_version}
BuildRequires: mlnx-ofa_kernel-source = %{_version}

Requires: mlnx-ofa_kernel = %{_version}
Requires: mlnx-ofa_kernel-modules = %{_version}
Requires: kernel = %{target_kernel_version_full}
Requires: kmod

%description
iser signed kernel modules

%prep

%build
rpm2cpio %{Source0} | cpio -idmv -D %{buildroot}

%install
cp %{Source1} %{buildroot}/lib/modules/%{KVERSION}/updates/iser/ib_iser.ko

%clean
rm -rf %{buildroot}

%post
if [ $1 -ge 1 ]; then # 1 : This package is being installed or reinstalled
/sbin/depmod %{KVERSION}
fi # 1 : closed
# END of post

%postun
/sbin/depmod %{KVERSION}

%if "%{KMP}" != "1"
jslobodzian marked this conversation as resolved.
Show resolved Hide resolved
%files
%defattr(-,root,root,-)
/lib/modules/%{KVERSION}/%{install_mod_dir}/
%config(noreplace) %{_sysconfdir}/depmod.d/zz02-%{name}-*.conf
%endif

%changelog
* Tue Dec 16 2024 Binu Jose Philip <[email protected]> - 24.10.0.6.7.1
- Creating signed spec
- License verified
- Initial Azure Linux import from NVIDIA (license: GPLv2)
Loading
Loading