Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
102 changes: 101 additions & 1 deletion base/comps/kernel/kernel.comp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ without = [

[components.kernel.build.defines]
# RPM release number for the Azure Linux kernel package
azl_pkgrelease = "5"
azl_pkgrelease = "6"
# 4th version component from the AZL kernel source (6.18.31.1). Included in specrelease so it appears
# in the RPM Release tag, uname -r, and /lib/modules/ path (e.g. 6.18.31-1.1.azl4.aarch64).
kextraversion = "1"
# NVIDIA open GPU kernel module version (built as a subpackage of the kernel)
nvidia_open_version = "595.58.03"
mlnx_ofa_version = "26.04"
mlnx_ofa_release = "OFED.26.04.0.8.5.1"
mlnx_ofa_bundle_release = "0.8.5.0"

# Download the source tarball from the AzureLinux kernel repo
[[components.kernel.source-files]]
Expand All @@ -35,6 +38,15 @@ hash = "a422b6935209d590f57fa6766f59bb207d9130f8a6777af9245c4ff8cd0f4c4ccef4602a
hash-type = "SHA512"
origin = { type = "download", uri = "https://github.com/NVIDIA/open-gpu-kernel-modules/archive/refs/tags/595.58.03.tar.gz" }

# Download the NVIDIA MLNX_OFED source bundle. We don't need the entire bundle
# — only the mlnx-ofa_kernel SRPM (and its inner tarball) inside it — but NVIDIA
# does not host mlnx-ofa_kernel as a standalone download.
[[components.kernel.source-files]]
filename = "MLNX_OFED_SRC-26.04-0.8.5.0.tgz"
hash = "1829d190f84f6d54597b98c40e162afa64939e608f7eaf494ac626c454e4d0310e14dedb7108326e9c9a667634eb27cf751dae806249f1783a66c8fc07aacd13"
hash-type = "SHA512"
origin = { type = "download", uri = "https://linux.mellanox.com/public/repo/doca/3.4.0/SOURCES/mlnx_ofed/MLNX_OFED_SRC-26.04-0.8.5.0.tgz" }

# Insert version and release information from the component defines into the spec file, and update the source URL to match the AzureLinux kernel source structure
[[components.kernel.overlays]]
description = "Set specrpmversion to 6.18.31"
Expand Down Expand Up @@ -340,6 +352,91 @@ replacement = """# AZL: kmod subpackage file lists and scriptlets (nvidia-open)

# AZL-KMOD-FILES-ANCHOR"""

# --- kmod-mlnx-ofa_kernel: source file registration ---
[[components.kernel.overlays]]
description = "Add kmod-mlnx-ofa_kernel.inc subpackage definition to sources"
type = "file-add"
file = "kmod-mlnx-ofa_kernel.inc"
source = "kmod-mlnx-ofa_kernel.inc"

[[components.kernel.overlays]]
description = "Register MLNX_OFED_SRC bundle as Source6100. The inner mlnx-ofa_kernel tarball is extracted from the bundle's SRPM in the kmod-mlnx-ofa 'prep' phase — see kmod-mlnx-ofa_kernel.inc."
type = "spec-insert-tag"
tag = "Source6100"
value = "MLNX_OFED_SRC-%{mlnx_ofa_version}-%{mlnx_ofa_bundle_release}.tgz"

[[components.kernel.overlays]]
description = "Register kmod-mlnx-ofa_kernel.inc as Source6101"
type = "spec-insert-tag"
tag = "Source6101"
value = "kmod-mlnx-ofa_kernel.inc"

[[components.kernel.overlays]]
description = "Add conditional Requires for kmod-iser and kmod-isert to base kernel package."
type = "spec-search-replace"
regex = '^Requires:\s*\(\(%\{name\}-modules-extra-uname-r\s*=\s*%\{KVERREL\}\)\s*if\s*%\{name\}-modules-extra-matched\)$'
replacement = """Requires: ((%{name}-modules-extra-uname-r = %{KVERREL}) if %{name}-modules-extra-matched)
%ifarch x86_64 aarch64
Requires: ((kmod-iser-uname-r = %{KVERREL}) if kmod-iser-matched)
Requires: ((kmod-isert-uname-r = %{KVERREL}) if kmod-isert-matched)
%endif"""

# --- kmod-mlnx-ofa_kernel: phase injection ---
[[components.kernel.overlays]]
description = "Run mlnx-ofa_kernel kmod 'package' phase — declares the kmod-mlnx-ofa_kernel subpackage"
type = "spec-search-replace"
regex = '# AZL-KMOD-PACKAGE-ANCHOR'
replacement = """# AZL: kmod subpackage declarations (mlnx-ofa_kernel)
%global _kmod_phase package
%global _kmod_name mlnx-ofa_kernel
%include %{_sourcedir}/kmod-mlnx-ofa_kernel.inc

# AZL-KMOD-PACKAGE-ANCHOR"""

[[components.kernel.overlays]]
description = "Run mlnx-ofa_kernel kmod 'prep' phase — extracts the mlnx-ofa_kernel tarball"
type = "spec-search-replace"
regex = '# AZL-KMOD-PREP-ANCHOR'
replacement = """# AZL: Prepare kmod subpackage sources (mlnx-ofa_kernel)
%global _kmod_phase prep
%global _kmod_name mlnx-ofa_kernel
%include %{_sourcedir}/kmod-mlnx-ofa_kernel.inc

# AZL-KMOD-PREP-ANCHOR"""

[[components.kernel.overlays]]
description = "Run mlnx-ofa_kernel kmod 'build' phase — runs ./configure + make kernel modules against the just-built kernel tree"
type = "spec-search-replace"
regex = '# AZL-KMOD-BUILD-ANCHOR'
replacement = """# AZL: Build kmod subpackage modules (mlnx-ofa_kernel)
%global _kmod_phase build
%global _kmod_name mlnx-ofa_kernel
%include %{_sourcedir}/kmod-mlnx-ofa_kernel.inc

# AZL-KMOD-BUILD-ANCHOR"""

[[components.kernel.overlays]]
description = "Run mlnx-ofa_kernel kmod 'install' phase — make install_modules into /lib/modules/<KVERREL>/extra/mlnx-ofa"
type = "spec-search-replace"
regex = '# AZL-KMOD-INSTALL-ANCHOR'
replacement = """# AZL: Install kmod subpackage files (mlnx-ofa_kernel)
%global _kmod_phase install
%global _kmod_name mlnx-ofa_kernel
%include %{_sourcedir}/kmod-mlnx-ofa_kernel.inc

# AZL-KMOD-INSTALL-ANCHOR"""

[[components.kernel.overlays]]
description = "Run mlnx-ofa_kernel kmod 'files' phase — adds %post/%postun/%files for the mlnx-ofa_kernel kmod subpackage"
type = "spec-search-replace"
regex = '# AZL-KMOD-FILES-ANCHOR'
replacement = """# AZL: kmod subpackage file lists and scriptlets (mlnx-ofa_kernel)
%global _kmod_phase files
%global _kmod_name mlnx-ofa_kernel
%include %{_sourcedir}/kmod-mlnx-ofa_kernel.inc

# AZL-KMOD-FILES-ANCHOR"""

# Prepend AZL changelog entries to the top of %changelog. The kernel uses
# `release.calculation = "manual"` (no rpmautospec), so changelog entries are
# hand-curated here rather than derived from `git log`. Convention: one entry
Expand All @@ -360,6 +457,9 @@ description = "Prepend AZL changelog entries (one per lock-fingerprint change) a
type = "spec-prepend-lines"
section = "%changelog"
lines = [
"* Wed Jun 10 2026 Elaheh Dehghani <edehghani@microsoft.com> - 6.18.31-1.6",
"- feat(kernel): add kmod-mlnx-ofa_kernel subpackage (mlnx-ofa_kernel 26.04, NIC+RDMA+IPoIB)",
"",
"* Wed May 27 2026 Daniel McIlvaney <damcilva@microsoft.com> - 6.18.31-1.5",
"- feat(kernel): add hand-curated changelog entry",
"",
Expand Down
127 changes: 127 additions & 0 deletions base/comps/kernel/kmod-iser.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# kmod-iser.inc — NVIDIA / Mellanox iSER kernel modules
#
# Phases: package, prep, build, install, files
# Activated by: setting _kmod_phase + _kmod_name globals and including this
# file from kernel.comp.toml overlays.
#
# Requires these defines/sources in kernel.spec (injected via comp.toml overlays):
# mlnx_ofa_version — source tag (e.g. 26.04)
# mlnx_ofa_release — vendor release stamp (e.g. OFED.26.04.0.8.5.1)
# SOURCE6100 — MLNX_OFED_SRC-%{mlnx_ofa_version}-%{mlnx_ofa_bundle_release}.tgz bundle

# =========================================================================
# Phase: package — subpackage declaration
# =========================================================================
%if "%{_kmod_phase}" == "package" && %{with_up_base}

%ifarch x86_64 aarch64
%package -n kmod-%{_kmod_name}-%{mlnx_ofa_version}
Summary: iser Driver
AutoReq: no
Provides: kmod-%{_kmod_name} = %{version}-%{release}
Provides: iser-modules = %{version}-%{release}
Provides: kmod-iser = %{version}-%{release}
Provides: kmod-iser-uname-r = %{KVERREL}
Obsoletes: kmod-iser < %{version}-%{release}
Provides: installonlypkg(kernel-module)
Requires: kmod-mlnx-ofa_kernel-%{mlnx_ofa_version} = %{version}-%{release}
Requires: %{name}-core-uname-r = %{KVERREL}
Requires: kmod-iser-matched = %{version}-%{release}
Requires(post): kmod
Requires(postun): kmod

%description -n kmod-%{_kmod_name}-%{mlnx_ofa_version}
Mellanox iSER kernel modules built from iser %{mlnx_ofa_version}
(%{mlnx_ofa_release}) against kernel %{KVERREL}.

%package -n kmod-iser-matched
Summary: Meta package to ensure kmod-iser is installed for all kernels

%description -n kmod-iser-matched
This meta package provides a single reference that other packages can Require
to have kmod-iser installed for all kernels. When installed, the kernel
package automatically pulls in the version-matched kmod-iser for each kernel
version on this machine (x86_64 and aarch64 only).

%endif

%endif

# =========================================================================
# Phase: prep — extract iser tarball from MLNX_OFED_SRC bundle
# =========================================================================
%if "%{_kmod_phase}" == "prep" && %{with_up_base}

%ifarch x86_64 aarch64
pushd %{_builddir}
tar -xf %{SOURCE6100}
_iser_srpm=$(find MLNX_OFED_SRC-* -path '*/SRPMS/iser-*.src.rpm' -print -quit)
if [ -z "$_iser_srpm" ]; then
echo "ERROR: iser SRPM not found inside %{SOURCE6100}" >&2
exit 1
fi
rpm2cpio "$_iser_srpm" | cpio -idm '*iser-%{mlnx_ofa_version}.tgz'
tar -xf iser-%{mlnx_ofa_version}.tgz
rm -rf MLNX_OFED_SRC-* iser-%{mlnx_ofa_version}.tgz
popd
%endif

%endif

# =========================================================================
# Phase: build — compile iser kernel modules
# =========================================================================
%if "%{_kmod_phase}" == "build" && %{with_up_base}

%ifarch x86_64 aarch64
%{log_msg "Building iser %{mlnx_ofa_version} modules for %{KVERREL}"}
pushd %{_builddir}/iser-%{mlnx_ofa_version}
export K_BUILD=%{_builddir}/kernel-%{tarfile_release}/linux-%{KVERREL}
export KVER=%{KVERREL}
export OFA_DIR=%{_builddir}/mlnx-ofa_kernel-%{mlnx_ofa_version}
export INSTALL_MOD_DIR=extra/iser
make
popd
%endif

%endif

# =========================================================================
# Phase: install — install iser modules
# =========================================================================
%if "%{_kmod_phase}" == "install" && %{with_up_base}

%ifarch x86_64 aarch64
%{log_msg "Installing iser modules for %{KVERREL}"}
pushd %{_builddir}/iser-%{mlnx_ofa_version}
export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR=extra/iser
export K_BUILD=%{_builddir}/kernel-%{tarfile_release}/linux-%{KVERREL}
export KVER=%{KVERREL}
export OFA_DIR=%{_builddir}/mlnx-ofa_kernel-%{mlnx_ofa_version}
make install KERNELRELEASE=%{KVERREL}
popd
%endif

%endif

# =========================================================================
# Phase: files — scriptlets and file list
# =========================================================================
%if "%{_kmod_phase}" == "files" && %{with_up_base}

%ifarch x86_64 aarch64
%post -n kmod-%{_kmod_name}-%{mlnx_ofa_version}
%{_sbindir}/depmod -a %{KVERREL} || :

%postun -n kmod-%{_kmod_name}-%{mlnx_ofa_version}
%{_sbindir}/depmod -a %{KVERREL} || :

%files -n kmod-%{_kmod_name}-%{mlnx_ofa_version}
/lib/modules/%{KVERREL}/extra/iser/

%files -n kmod-iser-matched
# empty sentinel package — no files
%endif

%endif
127 changes: 127 additions & 0 deletions base/comps/kernel/kmod-isert.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# kmod-isert.inc — NVIDIA / Mellanox iSERT kernel modules
#
# Phases: package, prep, build, install, files
# Activated by: setting _kmod_phase + _kmod_name globals and including this
# file from kernel.comp.toml overlays.
#
# Requires these defines/sources in kernel.spec (injected via comp.toml overlays):
# mlnx_ofa_version — source tag (e.g. 26.04)
# mlnx_ofa_release — vendor release stamp (e.g. OFED.26.04.0.8.5.1)
# SOURCE6100 — MLNX_OFED_SRC-%{mlnx_ofa_version}-%{mlnx_ofa_bundle_release}.tgz bundle

# =========================================================================
# Phase: package — subpackage declaration
# =========================================================================
%if "%{_kmod_phase}" == "package" && %{with_up_base}

%ifarch x86_64 aarch64
%package -n kmod-%{_kmod_name}-%{mlnx_ofa_version}
Summary: isert Driver
AutoReq: no
Provides: kmod-%{_kmod_name} = %{version}-%{release}
Provides: isert-modules = %{version}-%{release}
Provides: kmod-isert = %{version}-%{release}
Provides: kmod-isert-uname-r = %{KVERREL}
Obsoletes: kmod-isert < %{version}-%{release}
Provides: installonlypkg(kernel-module)
Requires: kmod-mlnx-ofa_kernel-%{mlnx_ofa_version} = %{version}-%{release}
Requires: %{name}-core-uname-r = %{KVERREL}
Requires: kmod-isert-matched = %{version}-%{release}
Requires(post): kmod
Requires(postun): kmod

%description -n kmod-%{_kmod_name}-%{mlnx_ofa_version}
Mellanox iSERT kernel modules built from isert %{mlnx_ofa_version}
(%{mlnx_ofa_release}) against kernel %{KVERREL}.

%package -n kmod-isert-matched
Summary: Meta package to ensure kmod-isert is installed for all kernels

%description -n kmod-isert-matched
This meta package provides a single reference that other packages can Require
to have kmod-isert installed for all kernels. When installed, the kernel
package automatically pulls in the version-matched kmod-isert for each kernel
version on this machine (x86_64 and aarch64 only).

%endif

%endif

# =========================================================================
# Phase: prep — extract isert tarball from MLNX_OFED_SRC bundle
# =========================================================================
%if "%{_kmod_phase}" == "prep" && %{with_up_base}

%ifarch x86_64 aarch64
pushd %{_builddir}
tar -xf %{SOURCE6100}
_isert_srpm=$(find MLNX_OFED_SRC-* -path '*/SRPMS/isert-*.src.rpm' -print -quit)
if [ -z "$_isert_srpm" ]; then
echo "ERROR: isert SRPM not found inside %{SOURCE6100}" >&2
exit 1
fi
rpm2cpio "$_isert_srpm" | cpio -idm '*isert-%{mlnx_ofa_version}.tgz'
tar -xf isert-%{mlnx_ofa_version}.tgz
rm -rf MLNX_OFED_SRC-* isert-%{mlnx_ofa_version}.tgz
popd
%endif

%endif

# =========================================================================
# Phase: build — compile isert kernel modules
# =========================================================================
%if "%{_kmod_phase}" == "build" && %{with_up_base}

%ifarch x86_64 aarch64
%{log_msg "Building isert %{mlnx_ofa_version} modules for %{KVERREL}"}
pushd %{_builddir}/isert-%{mlnx_ofa_version}
export K_BUILD=%{_builddir}/kernel-%{tarfile_release}/linux-%{KVERREL}
export KVER=%{KVERREL}
export OFA_DIR=%{_builddir}/mlnx-ofa_kernel-%{mlnx_ofa_version}
export INSTALL_MOD_DIR=extra/isert
make
popd
%endif

%endif

# =========================================================================
# Phase: install — install isert modules
# =========================================================================
%if "%{_kmod_phase}" == "install" && %{with_up_base}

%ifarch x86_64 aarch64
%{log_msg "Installing isert modules for %{KVERREL}"}
pushd %{_builddir}/isert-%{mlnx_ofa_version}
export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR=extra/isert
export K_BUILD=%{_builddir}/kernel-%{tarfile_release}/linux-%{KVERREL}
export KVER=%{KVERREL}
export OFA_DIR=%{_builddir}/mlnx-ofa_kernel-%{mlnx_ofa_version}
make install KERNELRELEASE=%{KVERREL}
popd
%endif

%endif

# =========================================================================
# Phase: files — scriptlets and file list
# =========================================================================
%if "%{_kmod_phase}" == "files" && %{with_up_base}

%ifarch x86_64 aarch64
%post -n kmod-%{_kmod_name}-%{mlnx_ofa_version}
%{_sbindir}/depmod -a %{KVERREL} || :

%postun -n kmod-%{_kmod_name}-%{mlnx_ofa_version}
%{_sbindir}/depmod -a %{KVERREL} || :

%files -n kmod-%{_kmod_name}-%{mlnx_ofa_version}
/lib/modules/%{KVERREL}/extra/isert/

%files -n kmod-isert-matched
# empty sentinel package — no files
%endif

%endif
Loading