Skip to content

Commit

Permalink
nvidia_linux: Add version 340.96 for Linux 4.6.3
Browse files Browse the repository at this point in the history
Adapt and run Donald’s script `build-nvidia.pl`.

Unfortunately, it fails to build with the errors below as reported on
the Web already in May 2016 [1][2][3].

```
[…]
/scratch/local/bee-root/nvidia/nvidia_linux-4.6.3-91-340.96-0/source/kernel/os-mlock.c:48:11: error: too many arguments to function ‘get_user_pages’
     ret = get_user_pages(current, mm, (unsigned long)address,
           ^
In file included from /scratch/local/bee-root/nvidia/nvidia_linux-4.6.3-91-340.96-0/source/kernel/nv-linux.h:68:0,
                 from /scratch/local/bee-root/nvidia/nvidia_linux-4.6.3-91-340.96-0/source/kernel/os-mlock.c:15:
include/linux/mm.h:1266:6: note: declared here
 long get_user_pages(unsigned long start, unsigned long nr_pages,
      ^
/scratch/local/bee-root/nvidia/nvidia_linux-4.6.3-91-340.96-0/source/kernel/os-mlock.c:61:13: error: implicit declaration of function ‘page_cache_release’ [-Werror=implicit-function-declaration]
             page_cache_release(user_pages[i]);
             ^
cc1: some warnings being treated as errors
scripts/Makefile.build:291: recipe for target '/scratch/local/bee-root/nvidia/nvidia_linux-4.6.3-91-340.96-0/source/kernel/os-mlock.o' failed
make[2]: *** [/scratch/local/bee-root/nvidia/nvidia_linux-4.6.3-91-340.96-0/source/kernel/os-mlock.o] Error 1
Makefile:1429: recipe for target '_module_/scratch/local/bee-root/nvidia/nvidia_linux-4.6.3-91-340.96-0/source/kernel' failed
make[1]: *** [_module_/scratch/local/bee-root/nvidia/nvidia_linux-4.6.3-91-340.96-0/source/kernel] Error 2
make[1]: Leaving directory '/scratch/local/linux-4.6.3-91.x86_64/source'
NVIDIA: left KBUILD.
nvidia.ko failed to build!
Makefile:184: recipe for target 'nvidia.ko' failed
make: *** [nvidia.ko] Error 1
```

[1] https://github.com/manjaro/packages-extra/issues/71
[2] https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-361/+bug/1573508
[3] https://devtalk.nvidia.com/default/topic/936310/nvidia-drivers-do-not-install-with-kernel-4-6/
  • Loading branch information
pmenzel committed Jul 5, 2016
1 parent e548936 commit b1df083
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions nvidia_linux-4.6.3-91-340.96-0.bee
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/bin/env beesh

# calculate package extra versions and legacy level
# - use extraversions to define nvidia extraversion and/or legacy level
# - legacy level should be the last part of extraversion
# - legacy level 2 to 5 will be calculated from version number..

mxnvversion=${PKGEXTRAVERSION##*_}
: ${mxnvversion=current}

nvextraversion="${PKGEXTRAVERSION_DASH}"

if [ "${mxnvversion:0:6}" = "legacy" -o "${mxnvversion}" = "current" ] ; then
nvextraversion="${nvextraversion%_*}"
nvextraversion="${nvextraversion#-${mxnvversion}}"
else
if [ "${PKGVERSION:0:4}" = "340." ] ; then
mxnvversion="legacy5"
elif [ "${PKGVERSION:0:4}" = "304." ] ; then
mxnvversion="legacy4"
elif [ "${PKGVERSION:0:7}" = "173.14." ] ; then
mxnvversion="legacy3"
elif [ "${PKGVERSION:0:6}" = "96.43." ] ; then
mxnvversion="legacy2"
else
mxnvversion="current"
fi
fi

print_info "calculated mxnvversion = '${mxnvversion}'"
print_info "calculated nvextraversion = '${nvextraversion}'"

NVIDIA_ARCHIVE="NVIDIA-Linux-x86_64-${PKGVERSION}${nvextraversion}.run"

SRCURL[0]="ftp://download.nvidia.com/XFree86/Linux-x86_64/${PKGVERSION}/${NVIDIA_ARCHIVE}"
#PATCHURL+=('/src/mariux/patches/nvidia-linux-readcr4_writecr4.patch')

LINUXPKG=${PKGEXTRANAME}.${ARCH}

LINUXKLOCALVER=$(beeversion --format "%v.mx64.%r" "${LINUXPKG}")

# '4.4.mx64.75' to '4.4.0.mx64.75'
if [[ $LINUXKLOCALVER =~ ^([0-9]+\.[0-9]+)(\.mx64.*) ]]; then
LINUXKLOCALVER="${BASH_REMATCH[1]}.0${BASH_REMATCH[2]}"
fi


build_in_sourcedir
sourcesubdir_append kernel

: ${BEE_TMP_TMPDIR:=/tmp}

mee_extract() {
LINUXBUILDARCHIVE="${BEE_BUILDARCHIVEDIR}/${LINUXPKG}.beebuild.tar.bz2"

print_info "extracting nvidia archive .."

start_cmd rmdir ${S}
start_cmd sh ${F}/${NVIDIA_ARCHIVE} -x --target ${S}

if [ -d "/usr/src/linux/${LINUXPKG}/source" ] ; then
LINUXSRCDIR="/usr/src/linux/${LINUXPKG}/source"
elif [ -d "${BEE_TMP_TMPDIR}/${LINUXPKG}/source" ] ; then
LINUXSRCDIR="${BEE_TMP_TMPDIR}/${LINUXPKG}/source"
else
print_info "extracting linux build ${LINUXPKG} .."
start_cmd gtar -xf "${LINUXBUILDARCHIVE}" -C ${BEE_TMP_TMPDIR}
LINUXSRCDIR="${BEE_TMP_TMPDIR}/${LINUXPKG}/source"
fi

print_info "using kernel sources from ${LINUXSRCDIR} .."
}

mee_build_pre() {
ln -s ${LINUXSRCDIR}/include ${S}/include
}

mee_build() {
start_cmd make SYSSRC=${LINUXSRCDIR} module
}

mee_install() {
mkdir -pv ${D}${DATAROOTDIR}/nvidia/kernel/${LINUXKLOCALVER}/${PKGVERSION}

cp -v *.ko ${D}${DATAROOTDIR}/nvidia/kernel/${LINUXKLOCALVER}/${PKGVERSION}/

ln -s ${PKGVERSION} ${D}${DATAROOTDIR}/nvidia/kernel/${LINUXKLOCALVER}/${mxnvversion}
}

0 comments on commit b1df083

Please sign in to comment.