Skip to content

feat(nvidia): build-nvidia-drivers to rebuild NVIDIA kernel modules from sources staged in the AMI - #2859

Merged
kummatty merged 1 commit into
awslabs:mainfrom
kummatty:main
Oct 19, 2026
Merged

kummatty merged 1 commit into
awslabs:mainfrom
kummatty:main

Conversation

@kummatty

@kummatty kummatty commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Description of changes:

Refactors the NVIDIA driver build so that the kernel module build is a standalone tool, build-nvidia-drivers, shipped in the AMI and used by the AMI build itself. The tool builds every driver tree's kernel modules for the running kernel, from sources kept in each tree.

How the build is split:

  • helpers/nvidia-kmods.sh now only stages module sources: the dkms rpms, gdrcopy, and the GRID runfile. They go into each flavor's .sources/ (replacing .rpms/, since GRID comes as a runfile).
  • The actual kernel module build code moves from that helper into runtime/gpu/build-nvidia-drivers, installed to /usr/sbin.
  • GRID userspace (gridd) is now extracted at staging in helpers/nvidia-userspace.sh, separate from the GRID module build.
  • install-nvidia-drivers.sh stages each tree with stage-driver-tree, then runs build-nvidia-drivers.
  • Boot-time rpm registration and the version info now read .sources/.

This also makes it possible to rebuild the modules after a kernel change in a custom image. Note: changing system components (the kernel, NVIDIA drivers or userspace) of an EKS NVIDIA AMI is still not officially supported or recommended.

Call outs:

  • build-nvidia-drivers must run before the AMI first boots on an NVIDIA GPU instance, and refuses to run after that.
  • It rebuilds kernel modules only. Userspace stays in the existing AMI build provisioners because it doesn't depend on the kernel, and can only be managed with dnf on booted GPU nodes.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Testing Done

  • Built a 1.35 NVIDIA AMI and booted it on g6, g4dn and g6f. Each got the correct driver and flavor, GRID was licensed, and SELinux was unchanged.
  • On a non-GPU instance, downgraded the kernel to 6.1 and ran build-nvidia-drivers, then created an image and booted it on g6, g4dn and g6f. The rebuilt modules loaded, with the same results as above.

@kummatty
kummatty requested a review from a team as a code owner October 16, 2026 04:53
@kummatty
kummatty requested review from mselim00 and tzneal October 16, 2026 04:54

@tzneal tzneal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@kummatty

Copy link
Copy Markdown
Contributor Author

/ci
+workflow:k8s_versions 1.35
+build enable_accelerator=nvidia enable_efa=true
+test --instance-types=g4dn.xlarge

@github-actions

Copy link
Copy Markdown
Contributor

@kummatty roger that! I've dispatched a workflow. 👍

@github-actions

Copy link
Copy Markdown
Contributor

@kummatty the workflow that you requested has completed. 🎉

AMI variantBuildTest
1.35 / al2023failure ❌skipped ⏭️

@kummatty
kummatty merged commit f160e43 into awslabs:main Oct 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants