summaryrefslogtreecommitdiff
path: root/x11-drivers/nvidia-drivers
diff options
context:
space:
mode:
Diffstat (limited to 'x11-drivers/nvidia-drivers')
-rw-r--r--x11-drivers/nvidia-drivers/Manifest16
-rw-r--r--x11-drivers/nvidia-drivers/metadata.xml1
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-390.157.ebuild137
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-470.182.03-r1.ebuild (renamed from x11-drivers/nvidia-drivers/nvidia-drivers-470.182.03.ebuild)140
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-515.105.01-r1.ebuild (renamed from x11-drivers/nvidia-drivers/nvidia-drivers-515.105.01.ebuild)158
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-525.116.04-r1.ebuild (renamed from x11-drivers/nvidia-drivers/nvidia-drivers-525.116.04.ebuild)158
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-525.47.26-r1.ebuild (renamed from x11-drivers/nvidia-drivers/nvidia-drivers-525.47.26.ebuild)160
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-530.41.03-r1.ebuild (renamed from x11-drivers/nvidia-drivers/nvidia-drivers-530.41.03.ebuild)9
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-535.43.02-r1.ebuild (renamed from x11-drivers/nvidia-drivers/nvidia-drivers-535.43.02.ebuild)9
9 files changed, 197 insertions, 591 deletions
diff --git a/x11-drivers/nvidia-drivers/Manifest b/x11-drivers/nvidia-drivers/Manifest
index a770978a375e..db37f983b8e2 100644
--- a/x11-drivers/nvidia-drivers/Manifest
+++ b/x11-drivers/nvidia-drivers/Manifest
@@ -61,11 +61,11 @@ DIST nvidia-xconfig-525.116.04.tar.bz2 110583 BLAKE2B 7fa42ffddee83dd6df0f3d8625
DIST nvidia-xconfig-530.41.03.tar.bz2 110920 BLAKE2B c7b90382b0e42f9f0d839c40c53c613243314399c715c303d9221c1d9558bed4d159bc1b76c2ab8ff4831d32fc93b661650b9833ef7397559847c3a14763cdfa SHA512 72cb1b44ff2fd162fc76fa4993b24a2994545b2b5e8f23252729a55e2deb2d10cc9263dfbe6449a81e3e18beca0bd6506b295a7299696bb9fea628fd99dca555
DIST nvidia-xconfig-535.43.02.tar.bz2 110594 BLAKE2B 2a72f408b3fe4acc21d5c1c9f266db6c0e79aefd25acad8237936bcbd204eefa73182cc950ab3c491efee712540a7a9480a06f4941d407ee7db1db03984f3e16 SHA512 e2078cf80c0bce8f3718917da4da5a1ac534e51b19b49780bdb6d7dcc0a8fe08d38177602b2f3a35fab64ecef65f04ed0a62fcbdd224c305fde493333f6a5cb9
DIST open-gpu-kernel-modules-525.47.26.tar.gz 10323511 BLAKE2B 00d9dd7bef6cf8ce3aaa53bd8c5b756c40ad44bfc21d72118006e4ff1a91ec49e7cf784ad53a8e55b757c451c875d500527b15a904ddf590bca0cf357baf7737 SHA512 ac2ee2e8d32c8a37b000769742f4e242c40daba87e9fc5829e16acbba095e7cfcd05cae4127de6095a058c1b7c9b95ea64c012ef561cf165259db2cbc8b4c736
-EBUILD nvidia-drivers-390.157.ebuild 18829 BLAKE2B e8ea620be73e325613179bbfa02daf269699d2fa12f3338b3e1bab90f620d3ade276977e6037d603f6f7ea36bc5e803c10b415512335c89c0e2f82274265a241 SHA512 fe0e5b627eba87cf0b880636b11d15aea9968f941b162e3c785daabba6f556532328a8a4f4375b7b17a9d1329e58b86172e9d7d4815a304347a0f60e0f1d5d73
-EBUILD nvidia-drivers-470.182.03.ebuild 19546 BLAKE2B 660f4bfee27d996788ce3f3c41e6f728b11fe2d8b50c295360d1cadf45abd813be4a677978d4c4d08fffc207de3affde2b77cdd1d3aafc1dee3b5c400e09299a SHA512 9290b8a1dff2ea425058e00917867dac6a4ab803b97914056bb93f916bc72de8dd828ebfb31d5c791166bef7f7f4b8f297283a670af86b9c974b9304ca39633d
-EBUILD nvidia-drivers-515.105.01.ebuild 22131 BLAKE2B 93dfd835457666332c415c1381ea3e60e9fcc8fb531ee4b5141892d7746f1c94c81eba8a5c2f935cb426e85fb744b26249429c5056a34b4eab7b8baa03cbe14d SHA512 0846cd18ce209c546e60afea10c0eb531fa374e6f96790c961447a2f2cef1e59ba34413f9b43152845468cb71c753d43fb7023c64d98e6140c046258f00a8be9
-EBUILD nvidia-drivers-525.116.04.ebuild 22009 BLAKE2B a7f72f66add739f7eed7ba9555924170a92504f4cbe93cdde698cb24f981d01f10c828671dcbff1b04cd8f9ae528e12b5bd31aa0eef743b1f69921cf11e59d18 SHA512 5d93236870330235c82f68dddd08aac43c0ae39d2cd24b7a938be7e65439a5efec66dd2e8851f47a1118339b287b12f106d7e990499f70c79cf5291b4bf23984
-EBUILD nvidia-drivers-525.47.26.ebuild 22022 BLAKE2B c7b6f4341314c3005da5bdcc030cccc130e112e38d8e00e9f339c307b2ee0ca711c1d94dbfa3bea484b5a7ecfe6dac838f6c9ba284cbda71683ec2091de3fa50 SHA512 7218678d13af6b3cc09c1910fd17df85c8854a80631bd399bae31817a3db29fb2be024fb860884e32149d5c3efbd3a66e11b0cfa22b2f75f901bfda07de4a93c
-EBUILD nvidia-drivers-530.41.03.ebuild 18740 BLAKE2B 47dc9c267db444815f7f9386d7454b932fa0b760d5f096d7ccf9f9ba02b3268c4c3011df2ecad7dba64d3e5ad7703d877cd2bd554433292c22f2532a87c2ac07 SHA512 e8d3f93fd81ad4943f897d56e09bf60b7ed84551146bc10a214b55cf7784236053a5b8d3d6fa577e0e5e69046570f48be85a655a6975e9aee30e7700fd6586f7
-EBUILD nvidia-drivers-535.43.02.ebuild 19225 BLAKE2B 6ab230045b3f2d3597b942791116ae54b3d724cb01a3666131711fab8adaedd038858f38e2931a8c52bedb03afeeb1a4f2b2e72fc76bc6bc7d9c1c9c6446064a SHA512 1a8d50ad6bd5527fe1a91850102a5683e058aefa0459496d9ae4546be59b41d83eec693200a2836a58ae63ba5cb65e507ddc9c0f7aaff9aaf7e6f678fabac33f
-MISC metadata.xml 1340 BLAKE2B 8afeddcb3cb7ab0f83ecc0141cee9e3d8729baf5ce559d15a305c3efdeb4b172fbf86607aa5c8f546aaf7a704d837f13afffce615d3bc831bee63d77e0580afb SHA512 26fbfc0164ce57126d75f112859d91d21f17a5a9a48c7ab4d8bb9d7c8c63ce9fab9304f2992e61050dcae5e01836d4cb9b0384e680fe51ee5322efe39bc5693b
+EBUILD nvidia-drivers-390.157.ebuild 15873 BLAKE2B 6177b64be0abe8bd6f81da585f90c076ca4bdf4040f58328a973d31b70dfdf759ab7017ba47ed7c5ebac9fa130a5fce85042e83b9b308c2df01aed5e24cc083e SHA512 bc2f70935f8485408ddaad3b7afa0eb0a1a3b925196ec4daf6a632b260a7aefffe325ed960a764fc7bf7c1d0857b20ddd0bc64dc2c401778890d6433aa96922f
+EBUILD nvidia-drivers-470.182.03-r1.ebuild 16681 BLAKE2B efbb809a1e4f18bf8c01d047e09e25abd354c2aaffb6395071e82d985d28e748b6194634c6b2410c103ec14bc4cef54624331a1fd41e23a1985754e3af491302 SHA512 81cdedf0ed68a516f6999bb221533a35a1e928ab8735a0efab8e236a4fa3faccf7df42819ff067000167d3c0040cfb4ad701aa2bda154c08b68f355f4c1ed8ca
+EBUILD nvidia-drivers-515.105.01-r1.ebuild 19219 BLAKE2B 0cfac143417a60da36967fb33899e9524091399f32f3038e792f714a858ae1817de6ab5d1f1d7ae9d9a9fa48093daeb62b587969100da42c2e10d65318f85688 SHA512 4a45c3af0a6e29a67eaf6375e6f443cc07a192ce5216a6a21ef79c72a8aa2bef019c9a38c12740c81a0aa3920fa902b13df6e943b888db4dda2f670bdfb2dac0
+EBUILD nvidia-drivers-525.116.04-r1.ebuild 19097 BLAKE2B 32ceb395df4895ab16a40e40d76dcc36d77d8a52d93e477259170b7faa1adaad177534f0371c50a20ed9c785dd43b5a65fbd77791262588c225019cd453636f9 SHA512 e1f145a48c21bcb24e4d775ee68f86a0f55422519e8f3ba4fb0ae71f905d4d141b767aa10ab9da8a1c7513e9599b548f89e95f4d8b4b0d7f25991ca9b45b6e19
+EBUILD nvidia-drivers-525.47.26-r1.ebuild 19108 BLAKE2B 16bf621b5c70832fd62c85a13ab2c6572494488f91a51eead05bcb1affd9a1afee4ae7acd8aa4bb6921a421dab1d147b24185d0df4d6ae5ccca295e2e8e59e2c SHA512 1ab9f03625e844a5c19827e67bbedf06f6f31f5381030f66a811b9c89949640a65a36fbe71bf758d82b619f65bf45c0e83f6f1d3a543d73b41f8cfeb6f15bd20
+EBUILD nvidia-drivers-530.41.03-r1.ebuild 19100 BLAKE2B aff94b26b826f0d63a7cecac29f979b2bd48aa895adee729d14b4badbaec6cbcdcea763768c01fde36b5f25f79acace171ff4189eb23161305092c06a08f7057 SHA512 00d44c9973bf5547d2edb96273e07e078b55c8baf8992a1d5cbf3f718e8c122e6df80644921733ba84a9904681907e64d592211e20b94ee913ad21d03541e134
+EBUILD nvidia-drivers-535.43.02-r1.ebuild 19585 BLAKE2B 3a1263429d6bf74f6ad091a9623496c8744eb23606966a576c6aa4870bb4211d4d088f0278e738b44c5f7edf36e8dc5bd724a26e47c6e1a01dfb719302f87d5c SHA512 e8857ba269fb59688db80ff2ae6ac6eb80648b4532ce4a1e1d89118b620cd7a8cd684cec4c30c6a562cbda2b81cab7ed5a6541fdb989d815d1c751a824a1e84d
+MISC metadata.xml 1281 BLAKE2B 2d2dd88b6c8afbe3b8d4799813fcc65a7102dfaf47fd6266ebd627acce1dde00acdf69d9d85193886cdce3e6553e261987647d12737cdec701ea4f9ba865366b SHA512 00100ef8ec37c1703a2bae7de811ded281c5dcf373407e22e9b359a92feac3ceefb007ed2980ad05cfcc7a698e5434e4cc7e2fc5c6ab82a3d60b679d984963c4
diff --git a/x11-drivers/nvidia-drivers/metadata.xml b/x11-drivers/nvidia-drivers/metadata.xml
index c62fb35fe442..04a446c9f79c 100644
--- a/x11-drivers/nvidia-drivers/metadata.xml
+++ b/x11-drivers/nvidia-drivers/metadata.xml
@@ -10,7 +10,6 @@
<name>David Seifert</name>
</maintainer>
<use>
- <flag name="driver">Install kernel driver modules</flag>
<flag name="kernel-open">Use the open source variant of drivers (Turing/Ampere+ GPUs only, aka GTX 1650+, very experimental)</flag>
<flag name="persistenced">Install the persistence daemon for keeping devices state when unused (e.g. for headless)</flag>
<flag name="static-libs">Install the XNVCtrl static library for accessing sensors and other features</flag>
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-390.157.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-390.157.ebuild
index 94e0026feef8..3cef13920232 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-390.157.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-390.157.ebuild
@@ -3,11 +3,11 @@
EAPI=8
-MODULES_OPTIONAL_USE="driver"
-inherit desktop flag-o-matic linux-mod multilib readme.gentoo-r1 \
- systemd toolchain-funcs unpacker user-info
+MODULES_OPTIONAL_IUSE=+modules
+inherit desktop flag-o-matic linux-mod-r1 multilib readme.gentoo-r1
+inherit systemd toolchain-funcs unpacker user-info
-NV_KERNEL_MAX="6.1"
+MODULES_KERNEL_MAX=6.1
NV_URI="https://download.nvidia.com/XFree86/"
DESCRIPTION="NVIDIA Accelerated Graphics Driver"
@@ -23,7 +23,7 @@ S="${WORKDIR}"
LICENSE="NVIDIA-r2 BSD BSD-2 GPL-2 MIT"
SLOT="0/${PV%%.*}"
KEYWORDS="-* amd64 x86"
-IUSE="+X abi_x86_32 abi_x86_64 +driver persistenced +static-libs +tools"
+IUSE="+X abi_x86_32 abi_x86_64 persistenced +static-libs +tools"
COMMON_DEPEND="
acct-group/video
@@ -81,7 +81,7 @@ PATCHES=(
)
pkg_setup() {
- use driver || return
+ use modules && [[ ${MERGE_TYPE} != binary ]] || return
local CONFIG_CHECK="
PROC_FS
@@ -102,15 +102,7 @@ pkg_setup() {
kernel_is -ge 5 8 && CONFIG_CHECK+=" X86_PAT" #817764
- MODULE_NAMES="
- nvidia(video:kernel)
- nvidia-drm(video:kernel)
- nvidia-modeset(video:kernel)
- $(usev !x86 "nvidia-uvm(video:kernel)")"
-
- linux-mod_pkg_setup
-
- [[ ${MERGE_TYPE} == binary ]] && return
+ linux-mod-r1_pkg_setup
# do some extra checks manually as it gets messy to handle builtin-only
# and some other conditional checks through CONFIG_CHECK
@@ -174,77 +166,6 @@ pkg_setup() {
(( ${#warn[@]} )) &&
ewarn "Detected potential configuration issues with used kernel:${warn[*]/#/$'\n'}"
-
- BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"'
- use x86 && BUILD_PARAMS+=' ARCH=i386'
- BUILD_TARGETS="modules"
-
- # Try to match toolchain with kernel only for modules
- # (experimental, ideally this should be handled in linux-mod.eclass)
- nvidia-tc-set() {
- local -n var=KERNEL_${1}
- if [[ ! -v var ]]; then
- read -r var < <(type -P "${@:2}") ||
- die "failed to find in PATH at least one of: ${*:2}"
- einfo "Forcing '${var}' for modules (set ${!var} to override)"
- fi
- }
-
- local tool switch
- if linux_chkconfig_present CC_IS_GCC; then
- if ! tc-is-gcc; then
- switch=
- nvidia-tc-set CC {${CHOST}-,}gcc
- fi
- elif linux_chkconfig_present CC_IS_CLANG; then
- ewarn "Warning: using ${PN} with a clang-built kernel is largely untested"
- if ! tc-is-clang; then
- switch=llvm-
- nvidia-tc-set CC {${CHOST}-,}clang
- fi
- fi
-
- if linux_chkconfig_present LD_IS_BFD; then
- # tc-ld-is-bfd needs https://github.com/gentoo/gentoo/pull/28355
- [[ $(LC_ALL=C $(tc-getLD) --version 2>/dev/null) == "GNU ld"* ]] ||
- nvidia-tc-set LD {${CHOST}-,}{ld.bfd,ld}
- elif linux_chkconfig_present LD_IS_LLD; then
- tc-ld-is-lld || nvidia-tc-set LD {${CHOST}-,}{ld.lld,lld}
- fi
-
- if [[ -v switch ]]; then
- # only need llvm-nm for lto, but use complete set to be safe
- for tool in AR NM OBJCOPY OBJDUMP READELF STRIP; do
- case $(LC_ALL=C $(tc-get${tool}) --version 2>/dev/null) in
- LLVM*|llvm*) [[ ! ${switch} ]];;
- *) [[ ${switch} ]];;
- esac && nvidia-tc-set ${tool} {${CHOST}-,}${switch}${tool,,}
- done
- fi
-
- # pass unconditionally given exports are semi-ignored except CC/LD
- for tool in CC LD AR NM OBJCOPY OBJDUMP READELF STRIP; do
- BUILD_PARAMS+=" ${tool}=\"\${KERNEL_${tool}:-\$(tc-get${tool})}\""
- done
-
- if linux_chkconfig_present LTO_CLANG_THIN; then
- # kernel enables cache by default leading to sandbox violations
- BUILD_PARAMS+=' ldflags-y=--thinlto-cache-dir= LDFLAGS_MODULE=--thinlto-cache-dir='
- fi
-
- if kernel_is -gt ${NV_KERNEL_MAX/./ }; then
- ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is known to break this version ${PN}"
- ewarn "It is recommended to use one of:"
- ewarn " <=sys-kernel/gentoo-kernel-${NV_KERNEL_MAX}.x"
- ewarn " <=sys-kernel/gentoo-sources-${NV_KERNEL_MAX}.x"
- ewarn "You are free to try or use /etc/portage/patches, but support will"
- ewarn "not be given (Gentoo will not accept patches for this). When no"
- ewarn "supported kernel are usable anymore, end-of-life 390.xx will be"
- ewarn "removed -- 6.1.x LTS will be supported until at least December 2026."
- ewarn
- ewarn "Do _not_ file a bug report if run into issues."
- ewarn
- fi
}
src_prepare() {
@@ -287,24 +208,14 @@ src_compile() {
NV_VERBOSE=1 DO_STRIP= MANPAGE_GZIP= OUTPUTDIR=out
)
- if use driver; then
- if linux_chkconfig_present GCC_PLUGINS; then
- mkdir "${T}"/plugin-test || die
- echo "obj-m += test.o" > "${T}"/plugin-test/Kbuild || die
- :> "${T}"/plugin-test/test.c || die
- if [[ $(LC_ALL=C make -C "${KV_OUT_DIR}" ARCH="$(tc-arch-kernel)" \
- HOSTCC="$(tc-getBUILD_CC)" CC="${CC}" M="${T}"/plugin-test 2>&1) \
- =~ "error: incompatible gcc/plugin version" ]]
- then
- eerror "Detected kernel was built with a different gcc/plugin version,"
- eerror "Please 'make clean' and rebuild your kernel with the current"
- eerror "gcc (or re-emerge for distribution kernels, including kernel-bin)."
- die "kernel ${KV_FULL} needs to be rebuilt"
- fi
- fi
+ local modlist=( nvidia{,-drm,-modeset}=video:kernel )
+ use x86 || modlist+=( nvidia-uvm=video:kernel )
+ local modargs=(
+ IGNORE_CC_MISMATCH=yes NV_VERBOSE=1
+ SYSOUT="${KV_OUT_DIR}" SYSSRC="${KV_DIR}"
+ )
- linux-mod_src_compile
- fi
+ linux-mod-r1_src_compile
if use persistenced; then
# 390.xx persistenced does not auto-detect libtirpc
@@ -377,7 +288,7 @@ src_install() {
local DOC_CONTENTS="\
Trusted users should be in the 'video' group to use NVIDIA devices.
You can add yourself by using: gpasswd -a my-user video\
-$(usev driver "
+$(usev modules "
Like all out-of-tree kernel modules, it is necessary to rebuild
${PN} after upgrading or rebuilding the Linux kernel
@@ -419,8 +330,8 @@ For general information on using ${PN}, please see:
https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers"
readme.gentoo_create_doc
- if use driver; then
- linux-mod_src_install
+ if use modules; then
+ linux-mod-r1_src_install
insinto /etc/modprobe.d
newins "${FILESDIR}"/nvidia-390.conf nvidia.conf
@@ -518,11 +429,17 @@ https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers"
# symlink non-versioned so nvidia-settings can use it even if misdetected
dosym nvidia-application-profiles-${PV}-key-documentation \
${paths[APPLICATION_PROFILE]}/nvidia-application-profiles-key-documentation
+
+ # sandbox issues with /dev/nvidiactl are widespread and sometime
+ # affect revdeps of packages built with USE=opencl/cuda making it
+ # hard to manage in ebuilds (minimal set, ebuilds should handle
+ # manually if need others or addwrite)
+ insinto /etc/sandbox.d
+ newins - 20nvidia <<<'SANDBOX_PREDICT="/dev/nvidiactl"'
}
pkg_preinst() {
- use driver || return
- linux-mod_pkg_preinst
+ use modules || return
# set video group id based on live system (bug #491414)
local g=$(egetent group video | cut -d: -f3)
@@ -531,7 +448,7 @@ pkg_preinst() {
}
pkg_postinst() {
- linux-mod_pkg_postinst
+ linux-mod-r1_pkg_postinst
readme.gentoo_print_elog
@@ -539,7 +456,7 @@ pkg_postinst() {
$(</proc/driver/nvidia/version) != *" ${PV} "* ]]; then
ewarn "Currently loaded NVIDIA modules do not match the newly installed"
ewarn "libraries and may prevent launching GPU-accelerated applications."
- use driver && ewarn "The easiest way to fix this is usually to reboot."
+ use modules && ewarn "The easiest way to fix this is usually to reboot."
fi
ewarn
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-470.182.03.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-470.182.03-r1.ebuild
index 0d0e1a3a178d..133a3e8f047f 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-470.182.03.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-470.182.03-r1.ebuild
@@ -3,11 +3,11 @@
EAPI=8
-MODULES_OPTIONAL_USE="driver"
-inherit desktop flag-o-matic linux-mod multilib readme.gentoo-r1 \
- systemd toolchain-funcs unpacker user-info
+MODULES_OPTIONAL_IUSE=+modules
+inherit desktop flag-o-matic linux-mod-r1 multilib readme.gentoo-r1
+inherit systemd toolchain-funcs unpacker user-info
-NV_KERNEL_MAX="6.2"
+MODULES_KERNEL_MAX=6.2
NV_URI="https://download.nvidia.com/XFree86/"
DESCRIPTION="NVIDIA Accelerated Graphics Driver"
@@ -22,7 +22,7 @@ S="${WORKDIR}"
LICENSE="NVIDIA-r2 BSD BSD-2 GPL-2 MIT ZLIB curl openssl"
SLOT="0/${PV%%.*}"
KEYWORDS="-* amd64"
-IUSE="+X abi_x86_32 abi_x86_64 +driver persistenced +static-libs +tools wayland"
+IUSE="+X abi_x86_32 abi_x86_64 persistenced +static-libs +tools wayland"
COMMON_DEPEND="
acct-group/video
@@ -84,7 +84,7 @@ PATCHES=(
)
pkg_setup() {
- use driver || return
+ use modules && [[ ${MERGE_TYPE} != binary ]] || return
local CONFIG_CHECK="
PROC_FS
@@ -106,16 +106,7 @@ pkg_setup() {
use amd64 && kernel_is -ge 5 8 && CONFIG_CHECK+=" X86_PAT" #817764
- MODULE_NAMES="
- nvidia(video:kernel)
- nvidia-drm(video:kernel)
- nvidia-modeset(video:kernel)
- nvidia-peermem(video:kernel)
- nvidia-uvm(video:kernel)"
-
- linux-mod_pkg_setup
-
- [[ ${MERGE_TYPE} == binary ]] && return
+ linux-mod-r1_pkg_setup
# do some extra checks manually as it gets messy to handle builtin-only
# and some other conditional checks through CONFIG_CHECK
@@ -179,75 +170,6 @@ pkg_setup() {
(( ${#warn[@]} )) &&
ewarn "Detected potential configuration issues with used kernel:${warn[*]/#/$'\n'}"
-
- BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"'
- BUILD_TARGETS="modules"
-
- # Try to match toolchain with kernel only for modules
- # (experimental, ideally this should be handled in linux-mod.eclass)
- nvidia-tc-set() {
- local -n var=KERNEL_${1}
- if [[ ! -v var ]]; then
- read -r var < <(type -P "${@:2}") ||
- die "failed to find in PATH at least one of: ${*:2}"
- einfo "Forcing '${var}' for modules (set ${!var} to override)"
- fi
- }
-
- local tool switch
- if linux_chkconfig_present CC_IS_GCC; then
- if ! tc-is-gcc; then
- switch=
- nvidia-tc-set CC {${CHOST}-,}gcc
- fi
- elif linux_chkconfig_present CC_IS_CLANG; then
- ewarn "Warning: using ${PN} with a clang-built kernel is largely untested"
- if ! tc-is-clang; then
- switch=llvm-
- nvidia-tc-set CC {${CHOST}-,}clang
- fi
- fi
-
- if linux_chkconfig_present LD_IS_BFD; then
- # tc-ld-is-bfd needs https://github.com/gentoo/gentoo/pull/28355
- [[ $(LC_ALL=C $(tc-getLD) --version 2>/dev/null) == "GNU ld"* ]] ||
- nvidia-tc-set LD {${CHOST}-,}{ld.bfd,ld}
- elif linux_chkconfig_present LD_IS_LLD; then
- tc-ld-is-lld || nvidia-tc-set LD {${CHOST}-,}{ld.lld,lld}
- fi
-
- if [[ -v switch ]]; then
- # only need llvm-nm for lto, but use complete set to be safe
- for tool in AR NM OBJCOPY OBJDUMP READELF STRIP; do
- case $(LC_ALL=C $(tc-get${tool}) --version 2>/dev/null) in
- LLVM*|llvm*) [[ ! ${switch} ]];;
- *) [[ ${switch} ]];;
- esac && nvidia-tc-set ${tool} {${CHOST}-,}${switch}${tool,,}
- done
- fi
-
- # pass unconditionally given exports are semi-ignored except CC/LD
- for tool in CC LD AR NM OBJCOPY OBJDUMP READELF STRIP; do
- BUILD_PARAMS+=" ${tool}=\"\${KERNEL_${tool}:-\$(tc-get${tool})}\""
- done
-
- if linux_chkconfig_present LTO_CLANG_THIN; then
- # kernel enables cache by default leading to sandbox violations
- BUILD_PARAMS+=' ldflags-y=--thinlto-cache-dir= LDFLAGS_MODULE=--thinlto-cache-dir='
- fi
-
- if kernel_is -gt ${NV_KERNEL_MAX/./ }; then
- ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is either known to break this version of ${PN}"
- ewarn "or was not tested with it. It is recommended to use one of:"
- ewarn " <=sys-kernel/gentoo-kernel-${NV_KERNEL_MAX}.x"
- ewarn " <=sys-kernel/gentoo-sources-${NV_KERNEL_MAX}.x"
- ewarn "You are free to try or use /etc/portage/patches, but support will"
- ewarn "not be given and issues wait until NVIDIA releases a fixed version"
- ewarn "(Gentoo will not accept patches for this)."
- ewarn
- ewarn "Do _not_ file a bug report if run into issues."
- ewarn
- fi
}
src_prepare() {
@@ -289,25 +211,13 @@ src_compile() {
XNVCTRL_CFLAGS="${xnvflags}"
)
- if use driver; then
- if linux_chkconfig_present GCC_PLUGINS; then
- mkdir "${T}"/plugin-test || die
- echo "obj-m += test.o" > "${T}"/plugin-test/Kbuild || die
- :> "${T}"/plugin-test/test.c || die
- if [[ $(LC_ALL=C make -C "${KV_OUT_DIR}" ARCH="$(tc-arch-kernel)" \
- HOSTCC="$(tc-getBUILD_CC)" CC="${CC}" M="${T}"/plugin-test 2>&1) \
- =~ "error: incompatible gcc/plugin version" ]]
- then
- eerror "Detected kernel was built with a different gcc/plugin version,"
- eerror "Please 'make clean' and rebuild your kernel with the current"
- eerror "gcc (or re-emerge for distribution kernels, including kernel-bin)."
- die "kernel ${KV_FULL} needs to be rebuilt"
- fi
- fi
-
- linux-mod_src_compile
- fi
+ local modlist=( nvidia{,-drm,-modeset,-peermem,-uvm}=video:kernel )
+ local modargs=(
+ IGNORE_CC_MISMATCH=yes NV_VERBOSE=1
+ SYSOUT="${KV_OUT_DIR}" SYSSRC="${KV_DIR}"
+ )
+ linux-mod-r1_src_compile
emake "${NV_ARGS[@]}" -C nvidia-modprobe
use persistenced && emake "${NV_ARGS[@]}" -C nvidia-persistenced
use X && emake "${NV_ARGS[@]}" -C nvidia-xconfig
@@ -354,7 +264,7 @@ src_install() {
)
local skip_modules=(
$(usev !X "nvfbc vdpau xdriver")
- $(usev !driver gsp)
+ $(usev !modules gsp)
installer nvpd # handled separately / built from source
)
local skip_types=(
@@ -374,7 +284,7 @@ src_install() {
local DOC_CONTENTS="\
Trusted users should be in the 'video' group to use NVIDIA devices.
You can add yourself by using: gpasswd -a my-user video\
-$(usev driver "
+$(usev modules "
Like all out-of-tree kernel modules, it is necessary to rebuild
${PN} after upgrading or rebuilding the Linux kernel
@@ -398,8 +308,8 @@ For general information on using ${PN}, please see:
https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers"
readme.gentoo_create_doc
- if use driver; then
- linux-mod_src_install
+ if use modules; then
+ linux-mod-r1_src_install
insinto /etc/modprobe.d
doins "${T}"/nvidia.conf
@@ -500,13 +410,19 @@ https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers"
# don't attempt to strip firmware files (silences errors)
dostrip -x ${paths[FIRMWARE]}
+
+ # sandbox issues with /dev/nvidiactl (and /dev/char wrt bug #904292)
+ # are widespread and sometime affect revdeps of packages built with
+ # USE=opencl/cuda making it hard to manage in ebuilds (minimal set,
+ # ebuilds should handle manually if need others or addwrite)
+ insinto /etc/sandbox.d
+ newins - 20nvidia <<<'SANDBOX_PREDICT="/dev/nvidiactl:/dev/char"'
}
pkg_preinst() {
has_version "${CATEGORY}/${PN}[wayland]" && NV_HAD_WAYLAND=
- use driver || return
- linux-mod_pkg_preinst
+ use modules || return
# set video group id based on live system (bug #491414)
local g=$(egetent group video | cut -d: -f3)
@@ -529,7 +445,7 @@ pkg_preinst() {
}
pkg_postinst() {
- linux-mod_pkg_postinst
+ linux-mod-r1_pkg_postinst
readme.gentoo_print_elog
@@ -537,7 +453,7 @@ pkg_postinst() {
$(</proc/driver/nvidia/version) != *" ${PV} "* ]]; then
ewarn "Currently loaded NVIDIA modules do not match the newly installed"
ewarn "libraries and may prevent launching GPU-accelerated applications."
- use driver && ewarn "The easiest way to fix this is usually to reboot."
+ use modules && ewarn "The easiest way to fix this is usually to reboot."
fi
if [[ $(</proc/cmdline) == *slub_debug=[!-]* ]]; then
@@ -563,7 +479,7 @@ pkg_postinst() {
ewarn "[2] https://wiki.gentoo.org/wiki/Nouveau"
fi
- if use wayland && use driver && [[ ! -v NV_HAD_WAYLAND ]]; then
+ if use wayland && use modules && [[ ! -v NV_HAD_WAYLAND ]]; then
elog
elog "With USE=wayland, this version of ${PN} sets nvidia-drm.modeset=1"
elog "in '${EROOT}/etc/modprobe.d/nvidia.conf'. This feature is considered"
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-515.105.01.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-515.105.01-r1.ebuild
index f7417cec22da..2a3914adf383 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-515.105.01.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-515.105.01-r1.ebuild
@@ -3,11 +3,11 @@
EAPI=8
-MODULES_OPTIONAL_USE="driver"
-inherit desktop flag-o-matic linux-mod multilib readme.gentoo-r1 \
- systemd toolchain-funcs unpacker user-info
+MODULES_OPTIONAL_IUSE=+modules
+inherit desktop flag-o-matic linux-mod-r1 multilib readme.gentoo-r1
+inherit systemd toolchain-funcs unpacker user-info
-NV_KERNEL_MAX="6.2"
+MODULES_KERNEL_MAX=6.2
NV_URI="https://download.nvidia.com/XFree86/"
DESCRIPTION="NVIDIA Accelerated Graphics Driver"
@@ -24,8 +24,8 @@ S="${WORKDIR}"
LICENSE="NVIDIA-r2 BSD BSD-2 GPL-2 MIT ZLIB curl openssl"
SLOT="0/${PV%%.*}"
KEYWORDS="-* amd64 ~arm64"
-IUSE="+X abi_x86_32 abi_x86_64 +driver kernel-open persistenced +static-libs +tools wayland"
-REQUIRED_USE="kernel-open? ( driver )"
+IUSE="+X abi_x86_32 abi_x86_64 kernel-open persistenced +static-libs +tools wayland"
+REQUIRED_USE="kernel-open? ( modules )"
COMMON_DEPEND="
acct-group/video
@@ -90,7 +90,7 @@ PATCHES=(
)
pkg_setup() {
- use driver || return
+ use modules && [[ ${MERGE_TYPE} != binary ]] || return
local CONFIG_CHECK="
PROC_FS
@@ -116,18 +116,7 @@ pkg_setup() {
Cannot be directly selected in the kernel's menuconfig, and may need
selection of another option that requires it such as CONFIG_KVM."
- MODULE_NAMES="
- nvidia(video:kernel)
- nvidia-drm(video:kernel)
- nvidia-modeset(video:kernel)
- nvidia-peermem(video:kernel)
- nvidia-uvm(video:kernel)"
- use kernel-open &&
- MODULE_NAMES=${MODULE_NAMES//:kernel/:kernel-module-source:kernel-module-source/kernel-open}
-
- linux-mod_pkg_setup
-
- [[ ${MERGE_TYPE} == binary ]] && return
+ linux-mod-r1_pkg_setup
# do some extra checks manually as it gets messy to handle builtin-only
# and some other conditional checks through CONFIG_CHECK
@@ -191,77 +180,6 @@ pkg_setup() {
(( ${#warn[@]} )) &&
ewarn "Detected potential configuration issues with used kernel:${warn[*]/#/$'\n'}"
-
- BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"'
- BUILD_TARGETS="modules"
-
- # Try to match toolchain with kernel only for modules
- # (experimental, ideally this should be handled in linux-mod.eclass)
- nvidia-tc-set() {
- local -n var=KERNEL_${1}
- if [[ ! -v var ]]; then
- read -r var < <(type -P "${@:2}") ||
- die "failed to find in PATH at least one of: ${*:2}"
- einfo "Forcing '${var}' for modules (set ${!var} to override)"
- fi
- }
-
- local tool switch
- if linux_chkconfig_present CC_IS_GCC; then
- if ! tc-is-gcc; then
- switch=
- nvidia-tc-set CC {${CHOST}-,}gcc
- nvidia-tc-set CXX {${CHOST}-,}g++ # needed by kernel-open
- fi
- elif linux_chkconfig_present CC_IS_CLANG; then
- ewarn "Warning: using ${PN} with a clang-built kernel is largely untested"
- if ! tc-is-clang; then
- switch=llvm-
- nvidia-tc-set CC {${CHOST}-,}clang
- nvidia-tc-set CXX {${CHOST}-,}clang++
- fi
- fi
-
- if linux_chkconfig_present LD_IS_BFD; then
- # tc-ld-is-bfd needs https://github.com/gentoo/gentoo/pull/28355
- [[ $(LC_ALL=C $(tc-getLD) --version 2>/dev/null) == "GNU ld"* ]] ||
- nvidia-tc-set LD {${CHOST}-,}{ld.bfd,ld}
- elif linux_chkconfig_present LD_IS_LLD; then
- tc-ld-is-lld || nvidia-tc-set LD {${CHOST}-,}{ld.lld,lld}
- fi
-
- if [[ -v switch ]]; then
- # only need llvm-nm for lto, but use complete set to be safe
- for tool in AR NM OBJCOPY OBJDUMP READELF STRIP; do
- case $(LC_ALL=C $(tc-get${tool}) --version 2>/dev/null) in
- LLVM*|llvm*) [[ ! ${switch} ]];;
- *) [[ ${switch} ]];;
- esac && nvidia-tc-set ${tool} {${CHOST}-,}${switch}${tool,,}
- done
- fi
-
- # pass unconditionally given exports are semi-ignored except CC/LD
- for tool in CC CXX LD AR NM OBJCOPY OBJDUMP READELF STRIP; do
- BUILD_PARAMS+=" ${tool}=\"\${KERNEL_${tool}:-\$(tc-get${tool})}\""
- done
-
- if linux_chkconfig_present LTO_CLANG_THIN; then
- # kernel enables cache by default leading to sandbox violations
- BUILD_PARAMS+=' ldflags-y=--thinlto-cache-dir= LDFLAGS_MODULE=--thinlto-cache-dir='
- fi
-
- if kernel_is -gt ${NV_KERNEL_MAX/./ }; then
- ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is either known to break this version of ${PN}"
- ewarn "or was not tested with it. It is recommended to use one of:"
- ewarn " <=sys-kernel/gentoo-kernel-${NV_KERNEL_MAX}.x"
- ewarn " <=sys-kernel/gentoo-sources-${NV_KERNEL_MAX}.x"
- ewarn "You are free to try or use /etc/portage/patches, but support will"
- ewarn "not be given and issues wait until NVIDIA releases a fixed version"
- ewarn "(Gentoo will not accept patches for this)."
- ewarn
- ewarn "Do _not_ file a bug report if run into issues."
- ewarn
- fi
}
src_prepare() {
@@ -321,30 +239,26 @@ src_compile() {
XNVCTRL_CFLAGS="${xnvflags}"
)
- if use driver; then
- if linux_chkconfig_present GCC_PLUGINS; then
- mkdir "${T}"/plugin-test || die
- echo "obj-m += test.o" > "${T}"/plugin-test/Kbuild || die
- :> "${T}"/plugin-test/test.c || die
- if [[ $(LC_ALL=C make -C "${KV_OUT_DIR}" ARCH="$(tc-arch-kernel)" \
- HOSTCC="$(tc-getBUILD_CC)" CC="${CC}" M="${T}"/plugin-test 2>&1) \
- =~ "error: incompatible gcc/plugin version" ]]
- then
- eerror "Detected kernel was built with a different gcc/plugin version,"
- eerror "Please 'make clean' and rebuild your kernel with the current"
- eerror "gcc (or re-emerge for distribution kernels, including kernel-bin)."
- die "kernel ${KV_FULL} needs to be rebuilt"
- fi
- fi
-
+ if use modules; then
local o_cflags=${CFLAGS} o_cxxflags=${CXXFLAGS} o_ldflags=${LDFLAGS}
+
+ local modlistargs=video:kernel
if use kernel-open; then
- # building the nvidia "blob" fails with lto, and also need
- # to strip in case of a different toolchain for the kernel
+ modlistargs+=-module-source:kernel-module-source/kernel-open
+
+ # environment flags are normally unused for modules, but nvidia
+ # uses it for building the "blob" and it is a bit fragile
filter-lto
- strip-unsupported-flags
+ CC=${KERNEL_CC} CXX=${KERNEL_CXX} strip-unsupported-flags
fi
- linux-mod_src_compile
+
+ local modlist=( nvidia{,-drm,-modeset,-peermem,-uvm}=${modlistargs} )
+ local modargs=(
+ IGNORE_CC_MISMATCH=yes NV_VERBOSE=1
+ SYSOUT="${KV_OUT_DIR}" SYSSRC="${KV_DIR}"
+ )
+
+ linux-mod-r1_src_compile
CFLAGS=${o_cflags} CXXFLAGS=${o_cxxflags} LDFLAGS=${o_ldflags}
fi
@@ -395,7 +309,7 @@ src_install() {
)
local skip_modules=(
$(usev !X "nvfbc vdpau xdriver")
- $(usev !driver gsp)
+ $(usev !modules gsp)
installer nvpd # handled separately / built from source
)
local skip_types=(
@@ -415,7 +329,7 @@ src_install() {
local DOC_CONTENTS="\
Trusted users should be in the 'video' group to use NVIDIA devices.
You can add yourself by using: gpasswd -a my-user video\
-$(usev driver "
+$(usev modules "
Like all out-of-tree kernel modules, it is necessary to rebuild
${PN} after upgrading or rebuilding the Linux kernel
@@ -439,8 +353,8 @@ For general information on using ${PN}, please see:
https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers"
readme.gentoo_create_doc
- if use driver; then
- linux-mod_src_install
+ if use modules; then
+ linux-mod-r1_src_install
insinto /etc/modprobe.d
doins "${T}"/nvidia.conf
@@ -550,13 +464,19 @@ https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers"
# don't attempt to strip firmware files (silences errors)
dostrip -x ${paths[FIRMWARE]}
+
+ # sandbox issues with /dev/nvidiactl (and /dev/char wrt bug #904292)
+ # are widespread and sometime affect revdeps of packages built with
+ # USE=opencl/cuda making it hard to manage in ebuilds (minimal set,
+ # ebuilds should handle manually if need others or addwrite)
+ insinto /etc/sandbox.d
+ newins - 20nvidia <<<'SANDBOX_PREDICT="/dev/nvidiactl:/dev/char"'
}
pkg_preinst() {
has_version "${CATEGORY}/${PN}[wayland]" && NV_HAD_WAYLAND=
- use driver || return
- linux-mod_pkg_preinst
+ use modules || return
# set video group id based on live system (bug #491414)
local g=$(egetent group video | cut -d: -f3)
@@ -579,7 +499,7 @@ pkg_preinst() {
}
pkg_postinst() {
- linux-mod_pkg_postinst
+ linux-mod-r1_pkg_postinst
readme.gentoo_print_elog
@@ -587,7 +507,7 @@ pkg_postinst() {
$(</proc/driver/nvidia/version) != *" ${PV} "* ]]; then
ewarn "Currently loaded NVIDIA modules do not match the newly installed"
ewarn "libraries and may prevent launching GPU-accelerated applications."
- use driver && ewarn "The easiest way to fix this is usually to reboot."
+ use modules && ewarn "The easiest way to fix this is usually to reboot."
fi
if [[ $(</proc/cmdline) == *slub_debug=[!-]* ]]; then
@@ -624,7 +544,7 @@ pkg_postinst() {
ewarn "Switch back to USE=-kernel-open to restore functionality if needed for now."
fi
- if use wayland && use driver && [[ ! -v NV_HAD_WAYLAND ]]; then
+ if use wayland && use modules && [[ ! -v NV_HAD_WAYLAND ]]; then
elog
elog "With USE=wayland, this version of ${PN} sets nvidia-drm.modeset=1"
elog "in '${EROOT}/etc/modprobe.d/nvidia.conf'. This feature is considered"
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-525.116.04.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-525.116.04-r1.ebuild
index 6ae8b90eb1a9..d27670a866f3 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-525.116.04.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-525.116.04-r1.ebuild
@@ -3,11 +3,11 @@
EAPI=8
-MODULES_OPTIONAL_USE="driver"
-inherit desktop flag-o-matic linux-mod multilib readme.gentoo-r1 \
- systemd toolchain-funcs unpacker user-info
+MODULES_OPTIONAL_IUSE=+modules
+inherit desktop flag-o-matic linux-mod-r1 multilib readme.gentoo-r1
+inherit systemd toolchain-funcs unpacker user-info
-NV_KERNEL_MAX="6.3"
+MODULES_KERNEL_MAX=6.3
NV_URI="https://download.nvidia.com/XFree86/"
DESCRIPTION="NVIDIA Accelerated Graphics Driver"
@@ -24,8 +24,8 @@ S="${WORKDIR}"
LICENSE="NVIDIA-r2 BSD BSD-2 GPL-2 MIT ZLIB curl openssl"
SLOT="0/${PV%%.*}"
KEYWORDS="-* amd64 ~arm64"
-IUSE="+X abi_x86_32 abi_x86_64 +driver kernel-open persistenced +static-libs +tools wayland"
-REQUIRED_USE="kernel-open? ( driver )"
+IUSE="+X abi_x86_32 abi_x86_64 kernel-open persistenced +static-libs +tools wayland"
+REQUIRED_USE="kernel-open? ( modules )"
COMMON_DEPEND="
acct-group/video
@@ -88,7 +88,7 @@ PATCHES=(
)
pkg_setup() {
- use driver || return
+ use modules && [[ ${MERGE_TYPE} != binary ]] || return
local CONFIG_CHECK="
PROC_FS
@@ -114,18 +114,7 @@ pkg_setup() {
Cannot be directly selected in the kernel's menuconfig, and may need
selection of another option that requires it such as CONFIG_KVM."
- MODULE_NAMES="
- nvidia(video:kernel)
- nvidia-drm(video:kernel)
- nvidia-modeset(video:kernel)
- nvidia-peermem(video:kernel)
- nvidia-uvm(video:kernel)"
- use kernel-open &&
- MODULE_NAMES=${MODULE_NAMES//:kernel/:kernel-module-source:kernel-module-source/kernel-open}
-
- linux-mod_pkg_setup
-
- [[ ${MERGE_TYPE} == binary ]] && return
+ linux-mod-r1_pkg_setup
# do some extra checks manually as it gets messy to handle builtin-only
# and some other conditional checks through CONFIG_CHECK
@@ -189,77 +178,6 @@ pkg_setup() {
(( ${#warn[@]} )) &&
ewarn "Detected potential configuration issues with used kernel:${warn[*]/#/$'\n'}"
-
- BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"'
- BUILD_TARGETS="modules"
-
- # Try to match toolchain with kernel only for modules
- # (experimental, ideally this should be handled in linux-mod.eclass)
- nvidia-tc-set() {
- local -n var=KERNEL_${1}
- if [[ ! -v var ]]; then
- read -r var < <(type -P "${@:2}") ||
- die "failed to find in PATH at least one of: ${*:2}"
- einfo "Forcing '${var}' for modules (set ${!var} to override)"
- fi
- }
-
- local tool switch
- if linux_chkconfig_present CC_IS_GCC; then
- if ! tc-is-gcc; then
- switch=
- nvidia-tc-set CC {${CHOST}-,}gcc
- nvidia-tc-set CXX {${CHOST}-,}g++ # needed by kernel-open
- fi
- elif linux_chkconfig_present CC_IS_CLANG; then
- ewarn "Warning: using ${PN} with a clang-built kernel is largely untested"
- if ! tc-is-clang; then
- switch=llvm-
- nvidia-tc-set CC {${CHOST}-,}clang
- nvidia-tc-set CXX {${CHOST}-,}clang++
- fi
- fi
-
- if linux_chkconfig_present LD_IS_BFD; then
- # tc-ld-is-bfd needs https://github.com/gentoo/gentoo/pull/28355
- [[ $(LC_ALL=C $(tc-getLD) --version 2>/dev/null) == "GNU ld"* ]] ||
- nvidia-tc-set LD {${CHOST}-,}{ld.bfd,ld}
- elif linux_chkconfig_present LD_IS_LLD; then
- tc-ld-is-lld || nvidia-tc-set LD {${CHOST}-,}{ld.lld,lld}
- fi
-
- if [[ -v switch ]]; then
- # only need llvm-nm for lto, but use complete set to be safe
- for tool in AR NM OBJCOPY OBJDUMP READELF STRIP; do
- case $(LC_ALL=C $(tc-get${tool}) --version 2>/dev/null) in
- LLVM*|llvm*) [[ ! ${switch} ]];;
- *) [[ ${switch} ]];;
- esac && nvidia-tc-set ${tool} {${CHOST}-,}${switch}${tool,,}
- done
- fi
-
- # pass unconditionally given exports are semi-ignored except CC/LD
- for tool in CC CXX LD AR NM OBJCOPY OBJDUMP READELF STRIP; do
- BUILD_PARAMS+=" ${tool}=\"\${KERNEL_${tool}:-\$(tc-get${tool})}\""
- done
-
- if linux_chkconfig_present LTO_CLANG_THIN; then
- # kernel enables cache by default leading to sandbox violations
- BUILD_PARAMS+=' ldflags-y=--thinlto-cache-dir= LDFLAGS_MODULE=--thinlto-cache-dir='
- fi
-
- if kernel_is -gt ${NV_KERNEL_MAX/./ }; then
- ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is either known to break this version of ${PN}"
- ewarn "or was not tested with it. It is recommended to use one of:"
- ewarn " <=sys-kernel/gentoo-kernel-${NV_KERNEL_MAX}.x"
- ewarn " <=sys-kernel/gentoo-sources-${NV_KERNEL_MAX}.x"
- ewarn "You are free to try or use /etc/portage/patches, but support will"
- ewarn "not be given and issues wait until NVIDIA releases a fixed version"
- ewarn "(Gentoo will not accept patches for this)."
- ewarn
- ewarn "Do _not_ file a bug report if run into issues."
- ewarn
- fi
}
src_prepare() {
@@ -317,30 +235,26 @@ src_compile() {
XNVCTRL_CFLAGS="${xnvflags}"
)
- if use driver; then
- if linux_chkconfig_present GCC_PLUGINS; then
- mkdir "${T}"/plugin-test || die
- echo "obj-m += test.o" > "${T}"/plugin-test/Kbuild || die
- :> "${T}"/plugin-test/test.c || die
- if [[ $(LC_ALL=C make -C "${KV_OUT_DIR}" ARCH="$(tc-arch-kernel)" \
- HOSTCC="$(tc-getBUILD_CC)" CC="${CC}" M="${T}"/plugin-test 2>&1) \
- =~ "error: incompatible gcc/plugin version" ]]
- then
- eerror "Detected kernel was built with a different gcc/plugin version,"
- eerror "Please 'make clean' and rebuild your kernel with the current"
- eerror "gcc (or re-emerge for distribution kernels, including kernel-bin)."
- die "kernel ${KV_FULL} needs to be rebuilt"
- fi
- fi
-
+ if use modules; then
local o_cflags=${CFLAGS} o_cxxflags=${CXXFLAGS} o_ldflags=${LDFLAGS}
+
+ local modlistargs=video:kernel
if use kernel-open; then
- # building the nvidia "blob" fails with lto, and also need
- # to strip in case of a different toolchain for the kernel
+ modlistargs+=-module-source:kernel-module-source/kernel-open
+
+ # environment flags are normally unused for modules, but nvidia
+ # uses it for building the "blob" and it is a bit fragile
filter-lto
- strip-unsupported-flags
+ CC=${KERNEL_CC} CXX=${KERNEL_CXX} strip-unsupported-flags
fi
- linux-mod_src_compile
+
+ local modlist=( nvidia{,-drm,-modeset,-peermem,-uvm}=${modlistargs} )
+ local modargs=(
+ IGNORE_CC_MISMATCH=yes NV_VERBOSE=1
+ SYSOUT="${KV_OUT_DIR}" SYSSRC="${KV_DIR}"
+ )
+
+ linux-mod-r1_src_compile
CFLAGS=${o_cflags} CXXFLAGS=${o_cxxflags} LDFLAGS=${o_ldflags}
fi
@@ -393,7 +307,7 @@ src_install() {
)
local skip_modules=(
$(usev !X "nvfbc vdpau xdriver")
- $(usev !driver gsp)
+ $(usev !modules gsp)
installer nvpd # handled separately / built from source
)
local skip_types=(
@@ -413,7 +327,7 @@ src_install() {
local DOC_CONTENTS="\
Trusted users should be in the 'video' group to use NVIDIA devices.
You can add yourself by using: gpasswd -a my-user video\
-$(usev driver "
+$(usev modules "
Like all out-of-tree kernel modules, it is necessary to rebuild
${PN} after upgrading or rebuilding the Linux kernel
@@ -437,8 +351,8 @@ For general information on using ${PN}, please see:
https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers"
readme.gentoo_create_doc
- if use driver; then
- linux-mod_src_install
+ if use modules; then
+ linux-mod-r1_src_install
insinto /etc/modprobe.d
doins "${T}"/nvidia.conf
@@ -548,13 +462,19 @@ https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers"
# don't attempt to strip firmware files (silences errors)
dostrip -x ${paths[FIRMWARE]}
+
+ # sandbox issues with /dev/nvidiactl (and /dev/char wrt bug #904292)
+ # are widespread and sometime affect revdeps of packages built with
+ # USE=opencl/cuda making it hard to manage in ebuilds (minimal set,
+ # ebuilds should handle manually if need others or addwrite)
+ insinto /etc/sandbox.d
+ newins - 20nvidia <<<'SANDBOX_PREDICT="/dev/nvidiactl:/dev/char"'
}
pkg_preinst() {
has_version "${CATEGORY}/${PN}[wayland]" && NV_HAD_WAYLAND=
- use driver || return
- linux-mod_pkg_preinst
+ use modules || return
# set video group id based on live system (bug #491414)
local g=$(egetent group video | cut -d: -f3)
@@ -577,7 +497,7 @@ pkg_preinst() {
}
pkg_postinst() {
- linux-mod_pkg_postinst
+ linux-mod-r1_pkg_postinst
readme.gentoo_print_elog
@@ -585,7 +505,7 @@ pkg_postinst() {
$(</proc/driver/nvidia/version) != *" ${PV} "* ]]; then
ewarn "Currently loaded NVIDIA modules do not match the newly installed"
ewarn "libraries and may prevent launching GPU-accelerated applications."
- use driver && ewarn "The easiest way to fix this is usually to reboot."
+ use modules && ewarn "The easiest way to fix this is usually to reboot."
fi
if [[ $(</proc/cmdline) == *slub_debug=[!-]* ]]; then
@@ -622,7 +542,7 @@ pkg_postinst() {
ewarn "Switch back to USE=-kernel-open to restore functionality if needed for now."
fi
- if use wayland && use driver && [[ ! -v NV_HAD_WAYLAND ]]; then
+ if use wayland && use modules && [[ ! -v NV_HAD_WAYLAND ]]; then
elog
elog "With USE=wayland, this version of ${PN} sets nvidia-drm.modeset=1"
elog "in '${EROOT}/etc/modprobe.d/nvidia.conf'. This feature is considered"
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-525.47.26.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-525.47.26-r1.ebuild
index e20c5bdc0474..3cfb46f5d84e 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-525.47.26.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-525.47.26-r1.ebuild
@@ -3,12 +3,12 @@
EAPI=8
-MODULES_OPTIONAL_USE="driver"
-inherit desktop flag-o-matic linux-mod multilib readme.gentoo-r1 \
- systemd toolchain-funcs unpacker user-info
+MODULES_OPTIONAL_IUSE=+modules
+inherit desktop flag-o-matic linux-mod-r1 multilib readme.gentoo-r1
+inherit systemd toolchain-funcs unpacker user-info
-NV_KERNEL_MAX="6.3"
-NV_PIN="525.116.04"
+MODULES_KERNEL_MAX=6.3
+NV_PIN=525.116.04
DESCRIPTION="NVIDIA Accelerated Graphics Driver"
HOMEPAGE="https://developer.nvidia.com/vulkan-driver"
@@ -25,8 +25,8 @@ S="${WORKDIR}"
LICENSE="NVIDIA-r2 BSD BSD-2 GPL-2 MIT ZLIB curl openssl"
SLOT="0/vulkan"
KEYWORDS="-* ~amd64"
-IUSE="+X abi_x86_32 abi_x86_64 +driver kernel-open persistenced +static-libs +tools wayland"
-REQUIRED_USE="kernel-open? ( driver )"
+IUSE="+X abi_x86_32 abi_x86_64 kernel-open persistenced +static-libs +tools wayland"
+REQUIRED_USE="kernel-open? ( modules )"
COMMON_DEPEND="
acct-group/video
@@ -89,7 +89,7 @@ PATCHES=(
)
pkg_setup() {
- use driver || return
+ use modules && [[ ${MERGE_TYPE} != binary ]] || return
local CONFIG_CHECK="
PROC_FS
@@ -115,18 +115,7 @@ pkg_setup() {
Cannot be directly selected in the kernel's menuconfig, and may need
selection of another option that requires it such as CONFIG_KVM."
- MODULE_NAMES="
- nvidia(video:kernel)
- nvidia-drm(video:kernel)
- nvidia-modeset(video:kernel)
- nvidia-peermem(video:kernel)
- nvidia-uvm(video:kernel)"
- use kernel-open &&
- MODULE_NAMES=${MODULE_NAMES//:kernel/:kernel-module-source:kernel-module-source/kernel-open}
-
- linux-mod_pkg_setup
-
- [[ ${MERGE_TYPE} == binary ]] && return
+ linux-mod-r1_pkg_setup
# do some extra checks manually as it gets messy to handle builtin-only
# and some other conditional checks through CONFIG_CHECK
@@ -190,77 +179,6 @@ pkg_setup() {
(( ${#warn[@]} )) &&
ewarn "Detected potential configuration issues with used kernel:${warn[*]/#/$'\n'}"
-
- BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"'
- BUILD_TARGETS="modules"
-
- # Try to match toolchain with kernel only for modules
- # (experimental, ideally this should be handled in linux-mod.eclass)
- nvidia-tc-set() {
- local -n var=KERNEL_${1}
- if [[ ! -v var ]]; then
- read -r var < <(type -P "${@:2}") ||
- die "failed to find in PATH at least one of: ${*:2}"
- einfo "Forcing '${var}' for modules (set ${!var} to override)"
- fi
- }
-
- local tool switch
- if linux_chkconfig_present CC_IS_GCC; then
- if ! tc-is-gcc; then
- switch=
- nvidia-tc-set CC {${CHOST}-,}gcc
- nvidia-tc-set CXX {${CHOST}-,}g++ # needed by kernel-open
- fi
- elif linux_chkconfig_present CC_IS_CLANG; then
- ewarn "Warning: using ${PN} with a clang-built kernel is largely untested"
- if ! tc-is-clang; then
- switch=llvm-
- nvidia-tc-set CC {${CHOST}-,}clang
- nvidia-tc-set CXX {${CHOST}-,}clang++
- fi
- fi
-
- if linux_chkconfig_present LD_IS_BFD; then
- # tc-ld-is-bfd needs https://github.com/gentoo/gentoo/pull/28355
- [[ $(LC_ALL=C $(tc-getLD) --version 2>/dev/null) == "GNU ld"* ]] ||
- nvidia-tc-set LD {${CHOST}-,}{ld.bfd,ld}
- elif linux_chkconfig_present LD_IS_LLD; then
- tc-ld-is-lld || nvidia-tc-set LD {${CHOST}-,}{ld.lld,lld}
- fi
-
- if [[ -v switch ]]; then
- # only need llvm-nm for lto, but use complete set to be safe
- for tool in AR NM OBJCOPY OBJDUMP READELF STRIP; do
- case $(LC_ALL=C $(tc-get${tool}) --version 2>/dev/null) in
- LLVM*|llvm*) [[ ! ${switch} ]];;
- *) [[ ${switch} ]];;
- esac && nvidia-tc-set ${tool} {${CHOST}-,}${switch}${tool,,}
- done
- fi
-
- # pass unconditionally given exports are semi-ignored except CC/LD
- for tool in CC CXX LD AR NM OBJCOPY OBJDUMP READELF STRIP; do
- BUILD_PARAMS+=" ${tool}=\"\${KERNEL_${tool}:-\$(tc-get${tool})}\""
- done
-
- if linux_chkconfig_present LTO_CLANG_THIN; then
- # kernel enables cache by default leading to sandbox violations
- BUILD_PARAMS+=' ldflags-y=--thinlto-cache-dir= LDFLAGS_MODULE=--thinlto-cache-dir='
- fi
-
- if kernel_is -gt ${NV_KERNEL_MAX/./ }; then
- ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is either known to break this version of ${PN}"
- ewarn "or was not tested with it. It is recommended to use one of:"
- ewarn " <=sys-kernel/gentoo-kernel-${NV_KERNEL_MAX}.x"
- ewarn " <=sys-kernel/gentoo-sources-${NV_KERNEL_MAX}.x"
- ewarn "You are free to try or use /etc/portage/patches, but support will"
- ewarn "not be given and issues wait until NVIDIA releases a fixed version"
- ewarn "(Gentoo will not accept patches for this)."
- ewarn
- ewarn "Do _not_ file a bug report if run into issues."
- ewarn
- fi
}
src_prepare() {
@@ -318,30 +236,26 @@ src_compile() {
XNVCTRL_CFLAGS="${xnvflags}"
)
- if use driver; then
- if linux_chkconfig_present GCC_PLUGINS; then
- mkdir "${T}"/plugin-test || die
- echo "obj-m += test.o" > "${T}"/plugin-test/Kbuild || die
- :> "${T}"/plugin-test/test.c || die
- if [[ $(LC_ALL=C make -C "${KV_OUT_DIR}" ARCH="$(tc-arch-kernel)" \
- HOSTCC="$(tc-getBUILD_CC)" CC="${CC}" M="${T}"/plugin-test 2>&1) \
- =~ "error: incompatible gcc/plugin version" ]]
- then
- eerror "Detected kernel was built with a different gcc/plugin version,"
- eerror "Please 'make clean' and rebuild your kernel with the current"
- eerror "gcc (or re-emerge for distribution kernels, including kernel-bin)."
- die "kernel ${KV_FULL} needs to be rebuilt"
- fi
- fi
-
+ if use modules; then
local o_cflags=${CFLAGS} o_cxxflags=${CXXFLAGS} o_ldflags=${LDFLAGS}
+
+ local modlistargs=video:kernel
if use kernel-open; then
- # building the nvidia "blob" fails with lto, and also need
- # to strip in case of a different toolchain for the kernel
+ modlistargs+=-module-source:kernel-module-source/kernel-open
+
+ # environment flags are normally unused for modules, but nvidia
+ # uses it for building the "blob" and it is a bit fragile
filter-lto
- strip-unsupported-flags
+ CC=${KERNEL_CC} CXX=${KERNEL_CXX} strip-unsupported-flags
fi
- linux-mod_src_compile
+
+ local modlist=( nvidia{,-drm,-modeset,-peermem,-uvm}=${modlistargs} )
+ local modargs=(
+ IGNORE_CC_MISMATCH=yes NV_VERBOSE=1
+ SYSOUT="${KV_OUT_DIR}" SYSSRC="${KV_DIR}"
+ )
+
+ linux-mod-r1_src_compile
CFLAGS=${o_cflags} CXXFLAGS=${o_cxxflags} LDFLAGS=${o_ldflags}
fi
@@ -394,7 +308,7 @@ src_install() {
)
local skip_modules=(
$(usev !X "nvfbc vdpau xdriver")
- $(usev !driver gsp)
+ $(usev !modules gsp)
installer nvpd # handled separately / built from source
)
local skip_types=(
@@ -414,7 +328,7 @@ src_install() {
local DOC_CONTENTS="\
Trusted users should be in the 'video' group to use NVIDIA devices.
You can add yourself by using: gpasswd -a my-user video\
-$(usev driver "
+$(usev modules "
Like all out-of-tree kernel modules, it is necessary to rebuild
${PN} after upgrading or rebuilding the Linux kernel
@@ -438,8 +352,8 @@ For general information on using ${PN}, please see:
https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers"
readme.gentoo_create_doc
- if use driver; then
- linux-mod_src_install
+ if use modules; then
+ linux-mod-r1_src_install
insinto /etc/modprobe.d
doins "${T}"/nvidia.conf
@@ -549,13 +463,19 @@ https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers"
# don't attempt to strip firmware files (silences errors)
dostrip -x ${paths[FIRMWARE]}
+
+ # sandbox issues with /dev/nvidiactl (and /dev/char wrt bug #904292)
+ # are widespread and sometime affect revdeps of packages built with
+ # USE=opencl/cuda making it hard to manage in ebuilds (minimal set,
+ # ebuilds should handle manually if need others or addwrite)
+ insinto /etc/sandbox.d
+ newins - 20nvidia <<<'SANDBOX_PREDICT="/dev/nvidiactl:/dev/char"'
}
pkg_preinst() {
has_version "${CATEGORY}/${PN}[wayland]" && NV_HAD_WAYLAND=
- use driver || return
- linux-mod_pkg_preinst
+ use modules || return
# set video group id based on live system (bug #491414)
local g=$(egetent group video | cut -d: -f3)
@@ -578,7 +498,7 @@ pkg_preinst() {
}
pkg_postinst() {
- linux-mod_pkg_postinst
+ linux-mod-r1_pkg_postinst
readme.gentoo_print_elog
@@ -586,7 +506,7 @@ pkg_postinst() {
$(</proc/driver/nvidia/version) != *" ${PV} "* ]]; then
ewarn "Currently loaded NVIDIA modules do not match the newly installed"
ewarn "libraries and may prevent launching GPU-accelerated applications."
- use driver && ewarn "The easiest way to fix this is usually to reboot."
+ use modules && ewarn "The easiest way to fix this is usually to reboot."
fi
if [[ $(</proc/cmdline) == *slub_debug=[!-]* ]]; then
@@ -623,7 +543,7 @@ pkg_postinst() {
ewarn "Switch back to USE=-kernel-open to restore functionality if needed for now."
fi
- if use wayland && use driver && [[ ! -v NV_HAD_WAYLAND ]]; then
+ if use wayland && use modules && [[ ! -v NV_HAD_WAYLAND ]]; then
elog
elog "With USE=wayland, this version of ${PN} sets nvidia-drm.modeset=1"
elog "in '${EROOT}/etc/modprobe.d/nvidia.conf'. This feature is considered"
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-530.41.03.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-530.41.03-r1.ebuild
index 5cf130c784c0..ecf91c791425 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-530.41.03.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-530.41.03-r1.ebuild
@@ -3,7 +3,7 @@
EAPI=8
-MODULES_OPTIONAL_IUSE="+modules"
+MODULES_OPTIONAL_IUSE=+modules
inherit desktop flag-o-matic linux-mod-r1 multilib readme.gentoo-r1
inherit systemd toolchain-funcs unpacker user-info
@@ -462,6 +462,13 @@ https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers"
# don't attempt to strip firmware files (silences errors)
dostrip -x ${paths[FIRMWARE]}
+
+ # sandbox issues with /dev/nvidiactl (and /dev/char wrt bug #904292)
+ # are widespread and sometime affect revdeps of packages built with
+ # USE=opencl/cuda making it hard to manage in ebuilds (minimal set,
+ # ebuilds should handle manually if need others or addwrite)
+ insinto /etc/sandbox.d
+ newins - 20nvidia <<<'SANDBOX_PREDICT="/dev/nvidiactl:/dev/char"'
}
pkg_preinst() {
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-535.43.02.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-535.43.02-r1.ebuild
index 2d8cc12953fd..5d5db42e432b 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-535.43.02.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-535.43.02-r1.ebuild
@@ -3,7 +3,7 @@
EAPI=8
-MODULES_OPTIONAL_IUSE="+modules"
+MODULES_OPTIONAL_IUSE=+modules
inherit desktop flag-o-matic linux-mod-r1 multilib readme.gentoo-r1
inherit systemd toolchain-funcs unpacker user-info
@@ -482,6 +482,13 @@ https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers"
# don't attempt to strip firmware files (silences errors)
dostrip -x ${paths[FIRMWARE]}
+
+ # sandbox issues with /dev/nvidiactl (and /dev/char wrt bug #904292)
+ # are widespread and sometime affect revdeps of packages built with
+ # USE=opencl/cuda making it hard to manage in ebuilds (minimal set,
+ # ebuilds should handle manually if need others or addwrite)
+ insinto /etc/sandbox.d
+ newins - 20nvidia <<<'SANDBOX_PREDICT="/dev/nvidiactl:/dev/char"'
}
pkg_preinst() {