Skip to content

Commit 0f3665a

Browse files
committed
update rendered kernel spec
1 parent 13959f0 commit 0f3665a

7 files changed

Lines changed: 197 additions & 2 deletions

File tree

base/comps/kernel/kernel.comp.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ without = ["debug"]
1010

1111
[components.kernel.build.defines]
1212
# RPM release number for the Azure Linux kernel package
13-
azl_pkgrelease = "8"
13+
azl_pkgrelease = "9"
1414
# 4th version component from the AZL kernel source (6.18.5.1). Included in specrelease so it appears
1515
# in the RPM Release tag, uname -r, and /lib/modules/ path (e.g. 6.18.5-1.3.azl4.aarch64).
1616
kextraversion = "1"

specs/k/kernel/kernel.azl.macros

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Macros file automatically generated by azldev.
22
# Do not edit manually; changes will be overwritten.
33
%_without_debug 1
4-
%azl_pkgrelease 8
4+
%azl_pkgrelease 9
55
%azurelinux_version 3
66
%kextraversion 1
7+
%nvidia_open_version 595.58.03

specs/k/kernel/kernel.spec

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ Summary: The Linux kernel
198198

199199
#
200200
# End of genspec.sh variables
201+
202+
# AZL: kmod subpackage framework
203+
%include %{_sourcedir}/kmod-macros.inc
201204
#
202205

203206
%define pkg_release %{specrelease}
@@ -1174,6 +1177,10 @@ Source9999: kernel.azl.macros
11741177
Source5000: 6.18-x86_64-azl.config
11751178
Source5001: 6.18-aarch64-azl.config
11761179
Source5002: azurelinux-ca-20230216.pem
1180+
Source5999: kmod-macros.inc
1181+
Source6000: open-gpu-kernel-modules-%{nvidia_open_version}.tar.gz
1182+
Source6001: kmod-nvidia-open-modprobe.conf
1183+
Source6002: kmod-nvidia-open.inc
11771184

11781185
## Patches needed for building this package
11791186

@@ -1224,6 +1231,11 @@ AutoProv: yes\
12241231
%{nil}
12251232

12261233

1234+
1235+
# AZL: kmod subpackage declarations
1236+
%global _kmod_phase package
1237+
%global _kmod_name nvidia-open
1238+
%include %{_sourcedir}/kmod-nvidia-open.inc
12271239
%package doc
12281240
Summary: Various documentation bits found in the kernel source
12291241
Group: Documentation
@@ -2245,6 +2257,11 @@ OPTS="-w -n -c"
22452257
RHJOBS=$RPM_BUILD_NCPUS SPECPACKAGE_NAME=%{name} ./process_configs.sh $OPTS %{specrpmversion}
22462258
cd ../..
22472259
%endif
2260+
2261+
# AZL: Prepare kmod subpackage sources
2262+
%global _kmod_phase prep
2263+
%global _kmod_name nvidia-open
2264+
%include %{_sourcedir}/kmod-nvidia-open.inc
22482265
%build
22492266
%{log_msg "Start of build stage"}
22502267

@@ -3412,6 +3429,11 @@ find Documentation -type d | xargs chmod u+w
34123429

34133430
%ifnarch noarch %{nobuildarches}
34143431
%global __debug_package 1
3432+
3433+
# AZL: Build kmod subpackage modules
3434+
%global _kmod_phase build
3435+
%global _kmod_name nvidia-open
3436+
%include %{_sourcedir}/kmod-nvidia-open.inc
34153437
%files -f debugfiles.list debuginfo-common-%{_target_cpu}
34163438
%endif
34173439

@@ -3886,6 +3908,11 @@ popd
38863908
###
38873909

38883910
%if %{with_tools}
3911+
3912+
# AZL: Install kmod subpackage files
3913+
%global _kmod_phase install
3914+
%global _kmod_name nvidia-open
3915+
%include %{_sourcedir}/kmod-nvidia-open.inc
38893916
%post -n %{package_name}-tools-libs
38903917
/sbin/ldconfig
38913918

@@ -4538,6 +4565,11 @@ fi\
45384565
# and build.
45394566
#
45404567
#
4568+
4569+
# AZL: kmod subpackage file lists and scriptlets
4570+
%global _kmod_phase files
4571+
%global _kmod_name nvidia-open
4572+
%include %{_sourcedir}/kmod-nvidia-open.inc
45414573
%changelog
45424574
* Thu Feb 19 2026 Augusto Caringi <acaringi@redhat.com> [6.18.13-0]
45434575
- Linux v6.18.13

specs/k/kernel/kmod-macros.inc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# kmod-macros.inc — Framework for building kmod subpackages alongside the kernel
2+
#
3+
# Usage in kernel.spec (injected via comp.toml overlays):
4+
# %include %%{_sourcedir}/kmod-macros.inc (in preamble, after genspec vars)
5+
#
6+
# Then at each phase point, the overlay injects:
7+
# %%global _kmod_phase <phase>
8+
# %%include %%{_sourcedir}/kmod-<name>.inc
9+
#
10+
# Each kmod .inc file uses %%if "%%{_kmod_phase}" == "<phase>" guards to
11+
# activate only the relevant section for that phase.
12+
#
13+
# To add a new kmod: create kmod-<name>.inc, add overlays to register its
14+
# sources and inject %%include lines at each phase point.
15+
# To remove: delete those overlays.
16+
#
17+
18+
# Master list of kmod subpackages (informational — used by .inc files if needed)
19+
%global kmod_subpackages nvidia-open
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# kmod-nvidia-open modprobe configuration
2+
# Blacklist nouveau to prevent conflicts with NVIDIA open kernel modules
3+
blacklist nouveau
4+
options nouveau modeset=0
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# kmod-nvidia-open.inc — NVIDIA open GPU kernel module subpackage
2+
#
3+
# Phases: package, prep, build, install, files
4+
# Activated by: setting _kmod_phase global + include from kernel.comp.toml overlays
5+
#
6+
# Requires these defines/sources in kernel.spec (injected via comp.toml overlays):
7+
# nvidia_open_version — NVIDIA driver version (e.g. 595.58.03)
8+
# SOURCE6000 — open-gpu-kernel-modules tarball
9+
# SOURCE6001 — kmod-nvidia-open-modprobe.conf
10+
11+
# =========================================================================
12+
# Phase: package — subpackage declaration
13+
# =========================================================================
14+
%if "%{_kmod_phase}" == "package"
15+
16+
%package -n kmod-%{_kmod_name}
17+
Summary: NVIDIA open GPU kernel modules (driver %{nvidia_open_version})
18+
# NOTE: Version is inherited from kernel (%{version}), NOT nvidia_open_version.
19+
# Track the actual NVIDIA driver version via Provides for dependency resolution.
20+
Provides: nvidia-open-kmod-version = %{nvidia_open_version}
21+
Provides: kmod-%{_kmod_name} = %{version}-%{release}
22+
Provides: kmod-%{_kmod_name}-%{KVERREL} = %{version}-%{release}
23+
Requires: %{name}-core-uname-r = %{KVERREL}
24+
Requires(post): kmod
25+
Requires(postun): kmod
26+
Conflicts: nvidia-closed-kmod
27+
Conflicts: nvidia-open
28+
ExclusiveArch: x86_64 aarch64
29+
30+
%description -n kmod-%{_kmod_name}
31+
Open-source NVIDIA GPU kernel modules (driver version %{nvidia_open_version})
32+
built from the official NVIDIA/open-gpu-kernel-modules repository for
33+
kernel %{KVERREL}.
34+
35+
These modules support CUDA workloads on NVIDIA GPUs (Turing and later).
36+
Modules: nvidia.ko, nvidia-modeset.ko, nvidia-drm.ko, nvidia-uvm.ko,
37+
nvidia-peermem.ko.
38+
39+
NOTE: This subpackage has the kernel version (%{version}-%{release}), not the
40+
NVIDIA driver version. Use 'Requires: nvidia-open-kmod-version = %{nvidia_open_version}'
41+
to depend on a specific NVIDIA driver version.
42+
43+
%endif
44+
45+
# =========================================================================
46+
# Phase: prep — extract NVIDIA source tarball
47+
# =========================================================================
48+
%if "%{_kmod_phase}" == "prep"
49+
50+
%ifnarch noarch %nobuildarches
51+
cd %{_builddir}
52+
tar -xf %{SOURCE6000}
53+
cd -
54+
%endif
55+
56+
%endif
57+
58+
# =========================================================================
59+
# Phase: build — compile NVIDIA kernel modules
60+
# =========================================================================
61+
%if "%{_kmod_phase}" == "build"
62+
63+
%if %{with_up_base}
64+
%ifnarch noarch %nobuildarches
65+
%{log_msg "Building NVIDIA open GPU kernel modules %{nvidia_open_version} for %{KVERREL}"}
66+
pushd %{_builddir}/open-gpu-kernel-modules-%{nvidia_open_version}
67+
# Unset LDFLAGS — NVIDIA kbuild invokes ld directly, not via gcc
68+
unset LDFLAGS
69+
make %{?_smp_mflags} modules \
70+
KERNEL_UNAME="%{KVERREL}" \
71+
SYSSRC="%{_builddir}/kernel-%{tarfile_release}/linux-%{KVERREL}" \
72+
SYSOUT="%{_builddir}/kernel-%{tarfile_release}/linux-%{KVERREL}" \
73+
IGNORE_CC_MISMATCH=1 \
74+
IGNORE_XEN_PRESENCE=1 \
75+
IGNORE_PREEMPT_RT_PRESENCE=1 \
76+
NV_EXCLUDE_BUILD_MODULES=""
77+
popd
78+
%endif
79+
%endif
80+
81+
%endif
82+
83+
# =========================================================================
84+
# Phase: install — install modules, config, and license
85+
# =========================================================================
86+
%if "%{_kmod_phase}" == "install"
87+
88+
%if %{with_up_base}
89+
%ifnarch noarch %nobuildarches
90+
%{log_msg "Installing NVIDIA open GPU kernel modules for %{KVERREL}"}
91+
install -d %{buildroot}/lib/modules/%{KVERREL}/extra/nvidia
92+
for mod in nvidia nvidia-modeset nvidia-drm nvidia-uvm nvidia-peermem; do
93+
ko="%{_builddir}/open-gpu-kernel-modules-%{nvidia_open_version}/kernel-open/${mod}.ko"
94+
if [ -f "${ko}" ]; then
95+
install -m 0644 "${ko}" %{buildroot}/lib/modules/%{KVERREL}/extra/nvidia/
96+
fi
97+
done
98+
# Install modprobe config to blacklist conflicting modules
99+
install -D -m 0644 %{SOURCE6001} %{buildroot}%{_sysconfdir}/modprobe.d/kmod-%{_kmod_name}.conf
100+
# Install depmod override config
101+
install -d %{buildroot}%{_sysconfdir}/depmod.d
102+
cat > %{buildroot}%{_sysconfdir}/depmod.d/kmod-%{_kmod_name}.conf << 'DEPMOD_EOF'
103+
override nvidia %{KVERREL} extra/nvidia
104+
override nvidia-modeset %{KVERREL} extra/nvidia
105+
override nvidia-drm %{KVERREL} extra/nvidia
106+
override nvidia-uvm %{KVERREL} extra/nvidia
107+
override nvidia-peermem %{KVERREL} extra/nvidia
108+
DEPMOD_EOF
109+
# Install NVIDIA license file
110+
install -D -m 0644 %{_builddir}/open-gpu-kernel-modules-%{nvidia_open_version}/COPYING \
111+
%{buildroot}%{_datadir}/licenses/kmod-%{_kmod_name}/COPYING
112+
%endif
113+
%endif
114+
115+
%endif
116+
117+
# =========================================================================
118+
# Phase: files — scriptlets and file list
119+
# =========================================================================
120+
%if "%{_kmod_phase}" == "files"
121+
122+
%post -n kmod-%{_kmod_name}
123+
%{_sbindir}/depmod -a %{KVERREL} || :
124+
125+
%postun -n kmod-%{_kmod_name}
126+
%{_sbindir}/depmod -a %{KVERREL} || :
127+
128+
%files -n kmod-%{_kmod_name}
129+
%license %{_datadir}/licenses/kmod-%{_kmod_name}/COPYING
130+
/lib/modules/%{KVERREL}/extra/nvidia/nvidia.ko.xz
131+
/lib/modules/%{KVERREL}/extra/nvidia/nvidia-modeset.ko.xz
132+
/lib/modules/%{KVERREL}/extra/nvidia/nvidia-drm.ko.xz
133+
/lib/modules/%{KVERREL}/extra/nvidia/nvidia-uvm.ko.xz
134+
/lib/modules/%{KVERREL}/extra/nvidia/nvidia-peermem.ko.xz
135+
%config(noreplace) %{_sysconfdir}/modprobe.d/kmod-%{_kmod_name}.conf
136+
%{_sysconfdir}/depmod.d/kmod-%{_kmod_name}.conf
137+
138+
%endif

specs/k/kernel/sources

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ SHA512 (linux-6.18.13.tar.xz) = a1d1b27391ed55ae2b17dd25841037d3399e4d87900eb098
22
SHA512 (kernel-abi-stablelists-6.18.13.tar.xz) = 69bbcdd86ae7999b19de306c29bc5cef442e309a8b033900c10a206a97d61b8b4e6d7c6baf6d356daf14e85766bd6a31120b54cfd1eb1c773450e44bae5d2d9b
33
SHA512 (kernel-kabi-dw-6.18.13.tar.xz) = 6473ea636d813e602a59d7332255c4b4597032501a2ed0507985800500451065618a0b6909663e3dc8db2b75c6f4ba10d498dbc41a3b42758cae38f30ca13115
44
SHA512 (kernel-6.18.5.1.tar.gz) = 0d8c755e02857704eb4c4396657ad30b22b474296233b8681365aeaa2fc16926afe31f551e80f565e0d73318f2b7941051ec44f85ccbabaa28ba5a56022f9f4a
5+
SHA256 (open-gpu-kernel-modules-595.58.03.tar.gz) = e0c4659ddf15e4f4e19cee05b49f88c9ba08ef3add0dfe08249798f58d0fe75e

0 commit comments

Comments
 (0)