summaryrefslogtreecommitdiffstats
path: root/core/modules/nvidia_kernel
diff options
context:
space:
mode:
authorSebastian2016-04-25 12:01:08 +0200
committerSebastian2016-04-25 12:01:08 +0200
commit5acda3eaeabae9045609539303a8c12c4ce401f1 (patch)
tree7e71975f8570b05aafe2ea6ec0e242a8912387bb /core/modules/nvidia_kernel
parentinitial commit (diff)
downloadmltk-5acda3eaeabae9045609539303a8c12c4ce401f1.tar.gz
mltk-5acda3eaeabae9045609539303a8c12c4ce401f1.tar.xz
mltk-5acda3eaeabae9045609539303a8c12c4ce401f1.zip
merge with latest dev version
Diffstat (limited to 'core/modules/nvidia_kernel')
-rw-r--r--core/modules/nvidia_kernel/module.build56
-rw-r--r--core/modules/nvidia_kernel/module.conf10
2 files changed, 66 insertions, 0 deletions
diff --git a/core/modules/nvidia_kernel/module.build b/core/modules/nvidia_kernel/module.build
new file mode 100644
index 00000000..b091eab2
--- /dev/null
+++ b/core/modules/nvidia_kernel/module.build
@@ -0,0 +1,56 @@
+fetch_source() {
+ mkdir -p src 2>/dev/null
+ cd src || perror "Could not change into src directory."
+ download "$REQUIRED_URL"
+}
+
+build() {
+ local ROOTUPPERDIR="$MODULE_DIR/rootupper"
+
+ local NVIDIA="$MODULE_WORK_DIR/src/$REQUIRED_NVIDIA"
+ local NVIDIAEXTRACTDIR="$ROOTUPPERDIR/NVIDIA"
+
+ [ -d "$NVIDIAEXTRACTDIR" ] && rm -rf "$NVIDIAEXTRACTDIR"
+ pinfo "Unpacking NVidia archive ($NVIDIA) ..."
+ sh "$NVIDIA" --extract-only --target "$NVIDIAEXTRACTDIR" || perror "Could not extract $NVIDIA to $NVIDIAEXTRACTDIR."
+
+ pinfo "Ready to chroot - compiling may take some time."
+ pdebug "--- chroot ---------------------------------------------------------------------"
+ pdebug "- -"
+ pdebug "- Notice: This may take a while! -"
+ pdebug "- -"
+ pdebug "- Please keep note the Nvidia installer _will_ complain about -"
+ pdebug "- several warnings and errors. It will do this in any case. -"
+ pdebug "- -"
+ pdebug "- This does _not_ mean the kernel module compilation was unsuccessful! -"
+ pdebug "- -"
+ pdebug "--------------------------------------------------------------------------------"
+
+
+ chroot_run "$ROOTUPPERDIR" <<-EOF
+ /NVIDIA/nvidia-installer --no-nouveau-check --no-network --no-backup --no-rpms --no-runlevel-check --no-distro-scripts --no-cc-version-check --no-x-check --no-precompiled-interface --silent --kernel-source-path /"$KERNEL_HEADERS_DIR" # Do the work!
+ # fake success since the installer will exit with an error due to the module not loading properly.
+ exit 0
+ EOF
+ pinfo "chroot terminated."
+
+ local file
+ local RESULT
+ local NVIDIA_MODULES="$MODULE_BUILD_DIR/lib/modules/nvidia/"
+ mkdir -p "$NVIDIA_MODULES"
+ pinfo "Copying kernel modules..."
+ for file in nvidia.ko nvidia-uvm.ko nvidia-modeset.ko; do
+ RESULT=$(find "$ROOTUPPERDIR/NVIDIA/kernel" -name "$file" | head -n 1)
+ [ -z "$RESULT" ] && perror "Could not find built module $file in ./NVIDIA/kernel"
+ pinfo "Fetching ${file}..."
+ strip -g "$RESULT" || pwarning "Could not strip $file"
+ cp "$RESULT" "$NVIDIA_MODULES" || perror "Could not copy $file"
+ done
+
+ rm -rf "$MODULE_BUILD_DIR/NVIDIA"
+}
+
+post_copy() {
+ :
+}
+
diff --git a/core/modules/nvidia_kernel/module.conf b/core/modules/nvidia_kernel/module.conf
new file mode 100644
index 00000000..d04051b9
--- /dev/null
+++ b/core/modules/nvidia_kernel/module.conf
@@ -0,0 +1,10 @@
+REQUIRED_VERSION="358.16"
+REQUIRED_NVIDIA="NVIDIA-Linux-x86_64-$REQUIRED_VERSION.run"
+REQUIRED_URL="http://download.nvidia.com/XFree86/Linux-x86_64/$REQUIRED_VERSION/$REQUIRED_NVIDIA"
+
+REQUIRED_DIRECTORIES="
+ /lib/modules/nvidia
+"
+REQUIRED_MODULES="
+ kernel
+"