- Saved searches
- Use saved searches to filter your results more quickly
- License
- zeankundev/nvidia-gpu-kernel-drivers
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- Compiling the Kernel (NVIDIA DRIVE OS Linux)
- Prerequisites
- To compile the kernel
- Compiling the Kernel (NVIDIA DRIVE OS Linux)
- Prerequisites
- To compile the kernel
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
NVIDIA Linux open GPU kernel module source
License
zeankundev/nvidia-gpu-kernel-drivers
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
NVIDIA Linux Open GPU Kernel Module Source
This is the source release of the NVIDIA Linux open GPU kernel modules, version 515.43.04.
To install, first uninstall any existing NVIDIA kernel modules. Then, as root:
make modules_install -j`nproc`
Note that the kernel modules built here must be used with gsp.bin firmware and user-space NVIDIA GPU driver components from a corresponding 515.43.04 driver release. This can be achieved by installing the NVIDIA GPU driver from the .run file using the —no-kernel-modules option. E.g.,
sh ./NVIDIA-Linux-[. ].run --no-kernel-modules
Supported Target CPU Architectures
Currently, the kernel modules can be built for x86_64 or aarch64. If cross-compiling, set these variables on the make command line:
TARGET_ARCH=aarch64|x86_64 CC LD AR CXX OBJCOPY
# compile on x86_64 for aarch64 make modules -j`nproc` \ TARGET_ARCH=aarch64 \ CC=aarch64-linux-gnu-gcc \ LD=aarch64-linux-gnu-ld \ AR=aarch64-linux-gnu-ar \ CXX=aarch64-linux-gnu-g++ \ OBJCOPY=aarch64-linux-gnu-objcopy
NV_VERBOSE — Set this to «1» to print each complete command executed; otherwise, a succinct «CC» line is printed.
DEBUG — Set this to «1» to build the kernel modules as debug. By default, the build compiles without debugging information. This also enables various debug log messages in the kernel modules.
These variables can be set on the make command line. E.g.,
make modules -j`nproc` NV_VERBOSE=1
Any reasonably modern version of gcc or clang can be used to build the kernel modules. Note that the kernel interface layers of the kernel modules must be built with the toolchain that was used to build the kernel.
Supported Linux Kernel Versions
The NVIDIA open kernel modules support the same range of Linux kernel versions that are supported with the proprietary NVIDIA kernel modules. This is currently Linux kernel 3.10 or newer.
Contributions can be made by creating a pull request on https://github.com/NVIDIA/open-gpu-kernel-modules We’ll respond via github.
Note that when submitting a pull request, you will be prompted to accept a Contributor License Agreement.
This code base is shared with NVIDIA’s proprietary drivers, and various processing is performed on the shared code to produce the source code that is published here. This has several implications for the foreseeable future:
- The github repository will function mostly as a snapshot of each driver release.
- We do not expect to be able to provide revision history for individual changes that were made to NVIDIA’s shared code base. There will likely only be one git commit per driver release.
- We may not be able to reflect individual contributions as separate git commits in the github repository.
- Because the code undergoes various processing prior to publishing here, contributions made here require manual merging to be applied to the shared code base. Therefore, large refactoring changes made here may be difficult to merge and accept back into the shared code base. If you have large refactoring to suggest, please contact us in advance, so we can coordinate.
Problems specific to the Open GPU Kernel Modules can be reported in the Issues section of the https://github.com/NVIDIA/open-gpu-kernel-modules repository.
Further, any of the existing bug reporting venues can be used to communicate problems to NVIDIA, such as our forum:
Please see the ‘NVIDIA Contact Info and Additional Resources’ section of the NVIDIA GPU Driver README for details.
Please see the separate SECURITY.md document if you believe you have discovered a security vulnerability in this software.
Kernel Interface and OS-Agnostic Components of Kernel Modules
Most of NVIDIA’s kernel modules are split into two components:
- An «OS-agnostic» component: this is the component of each kernel module that is independent of operating system.
- A «kernel interface layer»: this is the component of each kernel module that is specific to the Linux kernel version and configuration.
When packaged in the NVIDIA .run installation package, the OS-agnostic component is provided as a binary: it is large and time-consuming to compile, so pre-built versions are provided so that the user does not have to compile it during every driver installation. For the nvidia.ko kernel module, this component is named «nv-kernel.o_binary». For the nvidia-modeset.ko kernel module, this component is named «nv-modeset-kernel.o_binary». Neither nvidia-drm.ko nor nvidia-uvm.ko have OS-agnostic components.
The kernel interface layer component for each kernel module must be built for the target kernel.
Directory Structure Layout
- kernel-open/ The kernel interface layer
- kernel-open/nvidia/ The kernel interface layer for nvidia.ko
- kernel-open/nvidia-drm/ The kernel interface layer for nvidia-drm.ko
- kernel-open/nvidia-modeset/ The kernel interface layer for nvidia-modeset.ko
- kernel-open/nvidia-uvm/ The kernel interface layer for nvidia-uvm.ko
- src/ The OS-agnostic code
- src/nvidia/ The OS-agnostic code for nvidia.ko
- src/nvidia-modeset/ The OS-agnostic code for nvidia-modeset.ko
- src/common/ Utility code used by one or more of nvidia.ko and nvidia-modeset.ko
About
NVIDIA Linux open GPU kernel module source
Compiling the Kernel (NVIDIA DRIVE OS Linux)
This topic contains instructions for compiling the Linux Kernel Source in your Linux SDK product.
Prerequisites
sudo -E apt install nv-driveos-linux-*_amd64.deb sudo -E apt install nv-driveos-foundation-toolchains-*_amd64.deb
The top-level directory layout has this appearance:
drive-foundation drive-linux drive-linux_src toolchains
To compile the kernel
- Set up the environment macros: The LOCAL_VERSION environment variable appends -tegra to the kernel version and modules.
export ARCH=arm64 export CROSS_COMPILE=$/toolchains/aarch64--glibc--stable-2022.03-1/bin/aarch64-buildroot-linux-gnu- export LOCALVERSION="-tegra" export NV_BUILD_KERNEL_OPTIONS="5.10"
cd /drive-linux/kernel/source/oss_src
bash kernel/scripts/rt-patch.sh apply-patches
mkdir out-linux make -C kernel O=$/out-linux clean
sudo apt-get install imagemagick graphviz dvipng python3-venv fonts-noto-cjk latexmk librsvg2-bin texlive-xetex
pip install -r /drive-linux/kernel/source/oss_src/kernel/Documentation/sphinx/requirements.txt
make -C kernel O=$/out-linux tegra_defconfig
make -j3 -C kernel O=$/out-linux
sudo cp $/out-linux/arch/arm64/boot/Image /drive-linux/kernel/preempt_rt/images/
export INSTALL_MOD_PATH=$/out-linux make -C kernel O=$/out-linux modules_install
sudo cp -a $/out-linux/lib/modules/* /drive-linux/kernel/preempt_rt/modules
$ cat > update_rfs.CONFIG.json /targetfs.img", "CopyTargets": [ "\$/copytarget-kernel-modules.yaml" ] >
$ sudo -E /usr/bin/python3 -B /opt/nvidia/driveos/common/filesystems/build-fs/17/bin/build_fs.py -w $/ -i $PWD/update_rfs.CONFIG.json -o $/drive-linux/filesystem/targetfs-images/ $ sudo rm -f $/drive-linux/filesystem/targetfs-images/targetfs.img $ sudo ln -s $/drive-linux/filesystem/targetfs-images/driveos-updated-rfs.img $/drive-linux/filesystem/targetfs-images/targetfs.img
The sync command must be executed as superuser. From the next boot onward, the kernel modules are auto-loaded on boot.
sudo cp $/out-linux/arch/arm64/boot/dts/nvidia/ /drive-linux/kernel/preempt_rt/
Compiling the Kernel (NVIDIA DRIVE OS Linux)
This topic contains instructions for compiling the Linux Kernel Source in your Linux SDK product.
Prerequisites
sudo -E apt install nv-driveos-linux-*_amd64.deb sudo -E apt install nv-driveos-foundation-toolchains-*_amd64.deb
The top-level directory layout has this appearance:
drive-foundation drive-linux drive-linux_src toolchains
To compile the kernel
- Set up the environment macros: The LOCAL_VERSION environment variable appends -tegra to the kernel version and modules.
export ARCH=arm64 export CROSS_COMPILE=$/toolchains/aarch64--glibc--stable-2022.03-1/bin/aarch64-buildroot-linux-gnu- export LOCALVERSION="-tegra" export NV_BUILD_KERNEL_OPTIONS="5.10"
cd /drive-linux/kernel/source/oss_src
bash kernel/scripts/rt-patch.sh apply-patches
mkdir out-linux make -C kernel O=$/out-linux clean
sudo apt-get install imagemagick graphviz dvipng python3-venv fonts-noto-cjk latexmk librsvg2-bin texlive-xetex flex bison -y
pip install -r /drive-linux/kernel/source/oss_src/kernel/Documentation/sphinx/requirements.txt
make -C kernel O=$/out-linux tegra_defconfig
make -j3 -C kernel O=$/out-linux
sudo cp $/out-linux/arch/arm64/boot/Image /drive-linux/kernel/preempt_rt/images/
export INSTALL_MOD_PATH=$/out-linux make -C kernel O=$/out-linux modules_install
sudo cp -a $/out-linux/lib/modules/* /drive-linux/kernel/preempt_rt/modules
$ vim update_rfs.CONFIG.json < "OS": "linux", "Output": "driveos-updated-rfs", "Base": "$/targetfs.img", "CopyTargets": [ "$/copytarget-kernel-modules.yaml" ] >
$ sudo -E /usr/bin/python3 -B /opt/nvidia/driveos/common/filesystems/build-fs/17/bin/build_fs.py -w $/ -i $PWD/update_rfs.CONFIG.json -o $/drive-linux/filesystem/targetfs-images/ $ sudo rm -f $/drive-linux/filesystem/targetfs.img $ sudo ln -s $/drive-linux/filesystem/targetfs-images/driveos-updated-rfs.img $/drive-linux/filesystem/targetfs.img
The sync command must be executed as superuser. From the next boot onward, the kernel modules are auto-loaded on boot.
sudo cp $/out-linux/arch/arm64/boot/dts/nvidia/ /drive-linux/kernel/preempt_rt/