Strip kmod symbols - #139
Conversation
Strip unnedded symbols from the open-gpu and GRID kernel modules Signed-off-by: Arnaldo Garcia Rincon <agarrcia@amazon.com>
98a13b8 to
2d69efe
Compare
|
(Forced push enables CI) |
| make %{?_smp_mflags} ARCH=%{_cross_karch} IGNORE_CC_MISMATCH=1 GRID_BUILD=1 GRID_BUILD_CSP=1 SYSSRC=%{kernel_sources} CC=%{_cross_target}-gcc LD=%{_cross_target}-ld | ||
|
|
||
| # Strip symbols out of the .ko files | ||
| for module in nvidia nvidia-uvm nvidia-modeset nvidia-drm nvidia-peermem; do |
There was a problem hiding this comment.
Why isn't this covered by the previous glob?
There was a problem hiding this comment.
They are in two different directories (open-gpu and grid)
Reviewed this on the phone, it didn't show the full diff. I can fix this.
| # Strip symbols out of the .ko files | ||
| for module in nvidia nvidia-uvm nvidia-modeset nvidia-drm nvidia-peermem; do |
There was a problem hiding this comment.
I have the same concern as @rpkelly - why list specific kmods and run the risk that a new one will be added and this list won't be updated?
There was a problem hiding this comment.
You did this differently in the 6.12 version of the r570 spec. Please use git diff --no-index on the two package directories and eliminate any differences that aren't strictly necessary.
Strip unnedded symbols from the open-gpu and GRID kernel modules Signed-off-by: Arnaldo Garcia Rincon <agarrcia@amazon.com>
Strip unnedded symbols from the open-gpu and GRID kernel modules Signed-off-by: Arnaldo Garcia Rincon <agarrcia@amazon.com>
Strip unnedded symbols from the open-gpu and GRID kernel modules Signed-off-by: Arnaldo Garcia Rincon <agarrcia@amazon.com>
2d69efe to
4308415
Compare
|
Forced push replaces the hard-coded list of modules with glob. Confirmed that the diff between Detailsdiff --git 1/packages/kmod-6.1-nvidia-r570/kmod-6.1-nvidia-r570.spec 2/packages/kmod-6.12-nvidia-r570/kmod-6.12-nvidia-r570.spec
index 832bc59..8cc7e57 100644
--- 1/packages/kmod-6.1-nvidia-r570/kmod-6.1-nvidia-r570.spec
+++ 2/packages/kmod-6.12-nvidia-r570/kmod-6.12-nvidia-r570.spec
@@ -8,6 +8,9 @@
%global fm_arch %{_cross_arch}
%endif
+%global kernel_major 6.12
+%global kernel_sources %{_cross_usrsrc}/kernels/%{kernel_major}
+
# With the split of the firmware binary from firmware/gsp.bin to firmware/gsp_ga10x.bin
# and firmware/gsp_tu10x.bin the file format changed from executable to relocatable.
# The __spec_install_post macro will by default try to strip all binary files.
@@ -15,11 +18,11 @@
# Redefine strip, so that these firmware binaries do not derail the build.
%global __strip /usr/bin/true
-Name: %{_cross_os}kmod-6.1-nvidia-r570
+Name: %{_cross_os}kmod-6.12-nvidia-r570
Version: %{tesla_ver}
Release: 1%{?dist}
Epoch: 1
-Summary: NVIDIA r570 drivers for the 6.1 kernel
+Summary: NVIDIA r570 drivers for the 6.12 kernel
# We use these licences because we only ship our own software in the main package,
# each subpackage includes the LICENSE file provided by the Licenses.toml file
License: Apache-2.0 OR MIT
@@ -65,7 +68,7 @@ Source505: load-grid-kernel-modules.service.in
Patch001: 0001-makefile-allow-to-use-any-kernel-arch.patch
-BuildRequires: %{_cross_os}kernel-6.1-archive
+BuildRequires: %{_cross_os}kernel-6.12-devel
Requires: %{_cross_os}nvidia-migmanager
%description
@@ -132,12 +135,6 @@ rpm2cpio %{_sourcedir}/nvidia-fabric-manager-%{tesla_ver}-1.%{_cross_arch}.rpm |
# Add the license.
install -p -m 0644 %{S:2} %{S:3} .
-%global kernel_sources %{_builddir}/kernel-devel
-tar -xf %{_cross_datadir}/bottlerocket/kernel-devel.tar.xz
-
-%define _kernel_version %(ls %{kernel_sources}/include/config/kernel.release)
-%global _cross_kmoddir %{_cross_libdir}/modules/%{_kernel_version}
-
# This recipe was based in the NVIDIA yum/dnf specs:
# https://github.com/NVIDIA/yum-packaging-precompiled-kmod
@@ -224,9 +221,8 @@ install -d %{buildroot}%{_cross_factorydir}%{_cross_sysconfdir}/{drivers,ld.so.c
install -d %{buildroot}%{_cross_sysusersdir}
install -d %{buildroot}%{_cross_bindir}
-KERNEL_VERSION=$(cat %{kernel_sources}/include/config/kernel.release)
sed \
- -e "s|__KERNEL_VERSION__|${KERNEL_VERSION}|" \
+ -e "s|__KERNEL_VERSION__|%{kernel_major}|" \
-e "s|__PREFIX__|%{_cross_prefix}|" %{S:200} > nvidia.conf
install -p -m 0644 nvidia.conf %{buildroot}%{_cross_tmpfilesdir} |
Description of changes:
Strip kernel module symbols for
open-gpuandgridTesting done:
I confirmed the open gpu driver is loaded and the
.kofiles were stripped with the following combos:aws-k8s-1.31-nvidiaand ag6.2xlargeinstanceDetails
bash-5.1# apiclient get os { "os": { "arch": "x86_64", "build_id": "0968c0610-dirty", "pretty_name": "Bottlerocket OS 1.39.0 (aws-k8s-1.31-nvidia)", "variant_id": "aws-k8s-1.31-nvidia", "version_id": "1.39.0" } } bash-5.1# cat /proc/driver/nvidia/version NVRM version: NVIDIA UNIX Open Kernel Module for x86_64 570.133.20 Release Build (dvs-builder@U22-I3-AF03-14-3) Sun Apr 13 04:34:43 UTC 2025 GCC version: gcc version 13.3.0 (Buildroot 2024.11.1) bash-5.1# ls -lah /lib/modules/6.1.134/kernel/drivers/extra/video/nvidia/open-gpu/ total 22M drwxr-xr-x. 2 root root 115 May 9 00:54 . drwxr-xr-x. 5 root root 47 May 9 00:53 .. -rwxr-xr-x. 1 root root 239K May 9 00:54 nvidia-drm.ko -rwxr-xr-x. 1 root root 2.8M May 9 00:54 nvidia-modeset.ko -rwxr-xr-x. 1 root root 5.5K May 9 00:54 nvidia-peermem.ko -rwxr-xr-x. 1 root root 3.3M May 9 00:54 nvidia-uvm.ko -rwxr-xr-x. 1 root root 15M May 9 00:54 nvidia.ko bash-5.1#aws-k8s-1.27-nvidiaand ag6.2xlargeinstanceDetails
bash-5.1# apiclient get os { "os": { "arch": "x86_64", "build_id": "0968c0610-dirty", "pretty_name": "Bottlerocket OS 1.39.0 (aws-k8s-1.27-nvidia)", "variant_id": "aws-k8s-1.27-nvidia", "version_id": "1.39.0" } } bash-5.1# cat /proc/driver/nvidia/version NVRM version: NVIDIA UNIX Open Kernel Module for x86_64 535.247.01 Release Build (dvs-builder@U22-A24-12-4) Wed Mar 26 06:22:53 UTC 2025 GCC version: gcc version 13.3.0 (Buildroot 2024.11.1) bash-5.1# ls -lah /lib/modules/5.15.180/kernel/drivers/extra/video/nvidia/open-gpu/ total 16M drwxr-xr-x. 2 root root 4.0K May 9 01:09 . drwxr-xr-x. 4 root root 4.0K May 9 01:09 .. -rwxr-xr-x. 1 root root 156K May 9 01:09 nvidia-drm.ko -rwxr-xr-x. 1 root root 2.4M May 9 01:09 nvidia-modeset.ko -rwxr-xr-x. 1 root root 5.3K May 9 01:09 nvidia-peermem.ko -rwxr-xr-x. 1 root root 2.9M May 9 01:09 nvidia-uvm.ko -rwxr-xr-x. 1 root root 11M May 9 01:09 nvidia.ko bash-5.1#aws-k8s-1.33-nvidiaand ag6.2xlargeinstanceDetails
bash-5.1# apiclient get os { "os": { "arch": "x86_64", "build_id": "0968c0610-dirty", "pretty_name": "Bottlerocket OS 1.39.0 (aws-k8s-1.33-nvidia)", "variant_id": "aws-k8s-1.33-nvidia", "version_id": "1.39.0" } } bash-5.1# cat /proc/driver/nvidia/version NVRM version: NVIDIA UNIX Open Kernel Module for x86_64 570.133.20 Release Build (dvs-builder@U22-I3-AF03-14-3) Sun Apr 13 04:34:43 UTC 2025 GCC version: gcc version 13.3.0 (Buildroot 2024.11.1) bash-5.1# ls -lah /lib/modules/6.12/kernel/drivers/extra/video/nvidia/open-gpu/ total 23M drwxr-xr-x. 2 root root 115 May 9 01:15 . drwxr-xr-x. 5 root root 47 May 9 01:15 .. -rwxr-xr-x. 1 root root 285K May 9 01:15 nvidia-drm.ko -rwxr-xr-x. 1 root root 2.9M May 9 01:15 nvidia-modeset.ko -rwxr-xr-x. 1 root root 6.6K May 9 01:15 nvidia-peermem.ko -rwxr-xr-x. 1 root root 4.0M May 9 01:15 nvidia-uvm.ko -rwxr-xr-x. 1 root root 15M May 9 01:15 nvidia.ko bash-5.1#smoke test
aws-k8s-1.31-nvidia (6.1 kernel)
Details
aws-k8s-1.33-nvidia (6.12)
Details
aws-k8s-1.27-nvidia (5.15)
Details
Also, we got a 73 MBs back:
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.