S.A.N.D.I. - SuSE Automated NVIDIA Driver Installer - Version 1.50

I am happy to present my bash script S.A.N.D.I., SuSE Automated NVIDIA Driver Installer which is written to work with DKMS - Dynamic Kernel Module Support to allow the automatic installation of the nVIDIA proprietary Video Driver each time you upgrade your Kernel version. What DKMS does is to recompile and install any DKMS loaded driver against the running kernel each time a new kernel version is loaded. DKMS only works with the nVIDIA driver if you have compiled your own kernel version and not with the default openSUSE kernel, even if you have installed the kernel sources. Please have a look at the following blog on compiling your own kernel:

openSUSE and Installing New Linux Kernel Versions - Blogs - openSUSE Forums

S.A.N.D.I. works with openSUSE 11.4, 12.1 and with our latest version, 12.2. The normal procedure would be to use S.A.N.D.I. to do a full installation of any new nVIDIA video driver in Runlevel 3 as normal and then run S.A.N.D.I. again to load the same driver into DKMS from Runlevel 3 or from Runlevel 5 in your desktop. This second step (loading the driver into DKMS) can be made with or without your selected desktop being loaded. When you run S.A.N.D.I. in Runlevel 3, the Full video driver installation choice will be available and when selected will work just like LNVHW does.

For more info on getting into Run Level 3, have a look at my blog on the subject: How to Start openSUSE 12.3 with Grub 2 into Run Level 3 - Blogs - openSUSE Forums

Here is a picture (shown above) of the new colored Full nVIDIA driver installation menu. You MUST install DKMS from the Packman repository to use this bash script!

You can find the latest nVIDIA driver on my blog here: Installing the nVIDIA Video Driver the Hard Way - Blogs - openSUSE Forums

If you are running openSUSE 12.1 and systemd is detected as being installed, a DKMS systemd service file will be created and installed for you to get DKMS working. Further, the old Runlevel stuff is removed, the dkms_autoinstaller is moved and there are many other fixes to get S.A.N.D.I. to work with openSUSE 12.1. I was able to get DKMS to work in openSUSE 12.1 AND it will also install your VirtualBox drivers just fine.

I have written the S.A.N.D.I. bash script to reside in the /usr/local/bin folder. Copy and past the following text into the file sandi (as in /usr/local/bin/sandi). You MUST be a root user to complete this task.

S.A.N.D.I. - SuSE Automated NVIDIA Driver Installer - Version 1.50

It is possible to directly download the script from SUSE Paste using the following commands (You must delete the old version of sandi first). Just open up a terminal session and copy the text from any code block show here and past it after the terminal prompt and then press enter:

sudo rm /usr/local/bin/sandi
sudo wget -nc http://paste.opensuse.org/view/download/88011425 -O /usr/local/bin/sandi

Next, you need to mark the file sandi as executable with the following command:

sudo chmod +x /usr/local/bin/sandi

You can add all three commands above and run it as one. Just copy and paste the following command into a terminal session:

sudo rm /usr/local/bin/sandi ; sudo wget -nc http://paste.opensuse.org/view/download/88011425 -O /usr/local/bin/sandi ; sudo chmod +x /usr/local/bin/sandi 

To use S.A.N.D.I., download the most recent nVIDIA driver to your downloads folder from World Leader in Visual Computing Technologies | NVIDIA, restart your PC into runlevel 3, log in as root and run the terminal command:

sandi

You can also run S.A.N.D.I. from within your selected desktop as in the picture above. Just open up a terminal session and run the same sandi command as stated before. You can not do a full installation of the nVIDIA driver, but you can load the selected nVIDIA driver into DKMS. If you have already done a full installation of the nVIDIA driver and have the driver already loaded, S.A.N.D.I. will not replace that already loaded video driver and so an error message will be seen after the driver is built. That is normal and is not a problem.

You MUST edit the S.A.N.D.I. bash script file and enter where you have downloaded the nvidia driver files. If you fail to edit the bash script, you will see this error upon startup.

************ > Folder /home/username/Downloads does not exist < ************

Since sandi is being placed into a system folder, you must enter the root user password in order to change/edit the following line(s):

#
# Where do you keep your nVidia driver downloads?
# Please Make Sure this name is correct - Do not include a "/" at the end...
#
nVidia_folder=/home/**yourname**/Downloads

Look at these lines and modify if you wish:

#
# How do you want to restart your PC when done loading the driver?
# The default is REBOOT="reboot" but can also be set for another program
# like REBOOT="fastboot" or REBOOT="pbs" are two example bash scripts.
#
REBOOT="reboot"

To edit the sandi bash script after it is installed, run one of the following commands:

For KDE or GNOME do** Alt-F2** and then enter:

For KDE: kdesu kwrite /usr/local/bin/sandi

OR

For GNOME: gnomesu gedit /usr/local/bin/sandi

For more information on installing the nVIDIA driver the hard way, please consult the following web link: Installing the nVIDIA Video Driver the Hard Way - Blogs - openSUSE Forums

Be aware that with the latest kernel 3.3, a glitch exists with the nVIDIA driver looking for some Kernel source files in the wrong place. I am running the following command right after compiling and installing the new Linux kernel 3.3 version:

cd /lib/modules/<kernel name>/source/arch/x86/include ; sudo cp generated/asm/*.h ./asm 

My /usr/local/bin/userfix bash script file I am running in order to install the present nVIDIA driver into kernel-3.3-rcx is as follows:

#!/bin/bash

#: Title       : /usr/local/bin/userfix
#: Date Created: Tue Feb 28 20:09:40 CST 2012
#: Last Edit   : Tue Feb 28 20:09:40 CST 2012
#: Author      : James D. McDaniel
#: Version     : 1.00
#: Description : Run User Pre-dkms Compile Commands
#: Options     : None

echo
echo "User Fix File was Executed ..." 
echo

version=$(uname -r | cut -c -3)
folder="/lib/modules/$(uname -r)/source/arch/x86/include"
if  "$version" == "3.3" ] ; then
  if  -d "$folder" ] ; then
    cd $folder 
    cp generated/asm/*.h ./asm
    echo
    echo "Kernel Fix for nVIDIA driver was executed!"
    echo
  fi
fi

exit 0

# End Of Script

As always, I would like to hear about any suggestions or comments you might have about using S.A.N.D.I. - SuSE Automated NVIDIA Driver Installer!

Thank You,

Version 1.10 of S.A.N.D.I. has been updated to completely remove any existing older nVIDIA driver versions you have been using from your dkms configuration when you select a different nVIDIA driver version for usage.

Thank You,

Version 1.15 of S.A.N.D.I. has been updated fix a logic bug in the removal of an unwanted nvidia driver version.

Thank You,

Hello jdmcdaniel3,

After installing S.A.N.D.I, when i run it through level 3 as root it give me error DKMS not installed, install it through yast but when i search in yast for installation it gives no result, so how can i install DKMS?

Thanks n regards

[QUOTE=luvsuse;bt387]Hello jdmcdaniel3,

After installing S.A.N.D.I, when i run it through level 3 as root it give me error DKMS not installed, install it through yast but when i search in yast for installation it gives no result, so how can i install DKMS?

Thanks n regards[/QUOTE]

DKMS comes from the Packman repository and so you must add that to be able to install the dkms package (all lower case) as it is called. Here are the Packman repository URL’s:

for 12.1: "**http://packman.inode.at/suse/openSUSE_12.1/**"
for 11.4: "**http://packman.inode.at/suse/openSUSE_11.4/**"

Using KDE you must go into YaST (enter the root user password the first time) / Software / Software Repositories / Add /** URL** and enter one of the two URL’s excluding the quotes (""). Then, once its there, go into YaST / Software / Software Management and search on dkms and once found, place a check mark by its name and press the accept button on the bottom right to allow it to be installed.

That is it and all you need to do.

Thank You,

Thanks jdmcdaniel3,

I installed the DKMS, and run the S.A.N.D.I it shows that it installed but , when i logged in and checked the system information, its shows me nouveau driver, some think has gone wrong may be i don’t know how to enter in level 3, on boot up i enter nomodeset3 i got x-window login then i press ctrl+alt+f2 , i think its wrong method , that’s why i didn’t got nvidia driver, so how to enter runlevel-3, please guide.

Thanks n regards

Thanks jdmcdaniel3,

Found how to enter level-3 and installed the Nvidia driver, thanks for the nice script.

Thanks n regards

S.A.N.D.I. - SuSE Automated NVIDIA Driver Installer - Version 1.32 now includes a new color display engine that works in Runlevel 3 as well as Runlevel 5 using escape codes and not the tput command. The Full nVIDIA driver installation menu is now shown in full color. In Runlevel 5, when you exit SANDI, you get an option to view the nVIDIA driver HTML help document. You must start SANDI as a normal user and enter the root password into SANDI and you must have installed a nVIDIA driver in Runlevel 5 since you updated to version 1.32. The userfix bash script was being added to the boot.local file incorrectly when in openSUSE 12.1 and that has now been fixed. You may wish to edit this file as root and remove the three lines that call userfix to run. Other fixes are included as well.

Thank You,

Version 1.40 of S.A.N.D.I. now allows the Full nVIDIA driver install without the installing of DKMS, which might occur when you first install openSUSE. If DKMS is not installed and the Runlevel is at 3, then the nVIDIA full install menu is presented to you. This allows SANDI to be a full nVIDIA driver solution, not requiring LNVHW on a new installation. Other minor fixes are also included.

Thank You,

Thank you for posting the latest NVIDIA Video I’ve been searching that for months to install it on my other computer.

I was happy to be of service to you houseclearance and thanks for you kind comments.

Thank You,

I ran into an issue in trying to install these patches into a custom setup nVIDIA driver. That is, you can extract the archive and install the patch, but what it you want to keep the nVIDIA archive intact? Basically, I got some help over at the nVIDIA forum to patch the patch files so that they could be applied to the nVIDIA driver, while leaving or at least getting a new, all in one archive that includes the patch. First, the patch files need to be modified to work. Only a small change to the top was required:

For the NVIDIA-295.33 Patch (save as NVIDIA-295.33.patch) :

Index: NVIDIA-Linux-x86-295.33/kernel/conftest.sh
===================================================================
--- kernel.orig/conftest.sh
+++ kernel/conftest.sh
@@ -95,7 +95,7 @@ build_cflags() {
         fi
     fi
 
-    CFLAGS="$CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
+    CFLAGS="$CFLAGS $OUTPUT_CFLAGS -I$HEADERS -I$OUTPUT/arch/x86/include/generated $AUTOCONF_CFLAGS"
 
     test_xen
 
@@ -126,7 +126,7 @@ build_cflags() {
     CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
 
     if  "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
-        CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include -I$SOURCES/arch/x86/include/generated"
+        CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include -I$OUTPUT/arch/x86/include/generated"
     elif  "$ARCH" = "ARMv7" ]; then
         CFLAGS="$CFLAGS -I$SOURCES/arch/arm/include -I$SOURCES/arch/arm/include/generated"
     fi
@@ -965,11 +965,12 @@ compile_test() {
             #
             echo "$CONFTEST_PREAMBLE
             #include <linux/acpi.h>
+            #include <acpi/acpixf.h>
             void conftest_acpi_walk_namespace(void) {
                 acpi_walk_namespace();
             }" > conftest$$.c
 
-            $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
+            #CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
             rm -f conftest$$.c
 
             if  -f conftest$$.o ]; then
@@ -980,6 +981,7 @@ compile_test() {
 
             echo "$CONFTEST_PREAMBLE
             #include <linux/acpi.h>
+        #include <acpi/acpixf.h>
             void conftest_acpi_walk_namespace(void) {
                 acpi_walk_namespace(0, NULL, 0, NULL, NULL, NULL, NULL);
             }" > conftest$$.c
@@ -996,6 +998,7 @@ compile_test() {
 
             echo "$CONFTEST_PREAMBLE
             #include <linux/acpi.h>
+            #include <acpi/acpixf.h>
             void conftest_acpi_walk_namespace(void) {
                 acpi_walk_namespace(0, NULL, 0, NULL, NULL, NULL);
             }" > conftest$$.c
@@ -1604,6 +1607,9 @@ case "$6" in
             fi
         fi
 
+    RET=0
+    SELECTED_MAKEFILE=Makefile.kbuild
+
         if  "$RET" = "0" ]; then
             ln -s $SELECTED_MAKEFILE Makefile
             exit 0

For the NVIDIA-295.20 Patch (save as NVIDIA-295.20.patch) :

Index: NVIDIA-Linux-x86-295.20/kernel/conftest.sh
===================================================================
--- kernel.orig/conftest.sh
+++ kernel/conftest.sh
@@ -95,7 +95,7 @@ build_cflags() {
         fi
     fi
 
-    CFLAGS="$CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
+    CFLAGS="$CFLAGS $OUTPUT_CFLAGS -I$HEADERS -I$OUTOUT/arch/x86/include/generated $AUTOCONF_CFLAGS"
 
     test_xen
 
@@ -126,7 +126,7 @@ build_cflags() {
     CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
 
     if  "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
-        CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include"
+        CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include -I$OUTPUT/arch/x86/include/generated"
     elif  "$ARCH" = "ARMv7" ]; then
         CFLAGS="$CFLAGS -I$SOURCES/arch/arm/include"
     fi
@@ -980,6 +980,7 @@ compile_test() {
 
             echo "$CONFTEST_PREAMBLE
             #include <linux/acpi.h>
+        #include <acpi/acpixf.h>
             void conftest_acpi_walk_namespace(void) {
                 acpi_walk_namespace(0, NULL, 0, NULL, NULL, NULL, NULL);
             }" > conftest$$.c
@@ -1560,7 +1561,7 @@ case "$6" in
             #endif
             #if defined(TEST_2_6_OR_3) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
               #error \"!KERNEL_2_6_OR_3\"
-            #endif" > conftest$$.c
+            #endif " > conftest$$.c
 
             $CC $CFLAGS -DTEST_2_6_OR_3 -c conftest$$.c > /dev/null 2>&1
 
@@ -1604,6 +1605,9 @@ case "$6" in
             fi
         fi
 
+    RET=0
+    SELECTED_MAKEFILE=Makefile.kbuild
+
         if  "$RET" = "0" ]; then
             ln -s $SELECTED_MAKEFILE Makefile
             exit 0

Then, with the patch and NVIDIA driver in the same folder, you can use the commands:

sh ./NVIDIA-Linux-x86_64-295.33.run --apply-patch NVIDIA-295.33.patch 

which creates a **NVIDIA-Linux-x86_64-295.33-custom.run** file

OR

sh ./NVIDIA-Linux-x64-295.33.run --apply-patch NVIDIA-295.33.patch 

which creates a **NVIDIA-Linux-x64-295.33-custom.run** file

OR

sh ./NVIDIA-Linux-x86_64-295.20.run --apply-patch NVIDIA-295.20.patch 

which creates a **NVIDIA-Linux-x86_64-295.20-custom.run** file

OR

sh ./NVIDIA-Linux-x64-295.20.run --apply-patch NVIDIA-295.20.patch 

which creates a **NVIDIA-Linux-x64-295.20-custom.run** file 

You then use the resulting custom patch nvidia driver with any kerne-3.3 version.

Thank You,

The following patch file can be applied to the NVIDIA-Linux-x86_64-295.33.run or NVIDIA-Linux-x64-295.33.run driver to allow it to install into the latest kernel-3.3-rcx. Copy the text from the code block below and pasted into your favorite text editor and then save it as the text file called NVIDIA-295.33.patch:

Index: NVIDIA-Linux-x86-295.33/kernel/conftest.sh
===================================================================
--- kernel.orig/conftest.sh
+++ kernel/conftest.sh
@@ -95,7 +95,7 @@ build_cflags() {
         fi
     fi
 
-    CFLAGS="$CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
+    CFLAGS="$CFLAGS $OUTPUT_CFLAGS -I$HEADERS -I$OUTPUT/arch/x86/include/generated $AUTOCONF_CFLAGS"
 
     test_xen
 
@@ -126,7 +126,7 @@ build_cflags() {
     CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
 
     if  "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
-        CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include -I$SOURCES/arch/x86/include/generated"
+        CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include -I$OUTPUT/arch/x86/include/generated"
     elif  "$ARCH" = "ARMv7" ]; then
         CFLAGS="$CFLAGS -I$SOURCES/arch/arm/include -I$SOURCES/arch/arm/include/generated"
     fi
@@ -512,7 +512,7 @@
             # and if it as an 'event' member.
             #
             echo "$CONFTEST_PREAMBLE
-            #include <asm/system.h>
+            #include <asm/switch_to.h>
             #include <linux/pm.h>
             void conftest_pm_message_t(pm_message_t state) {
                 pm_message_t *p = &state;
@@ -965,11 +965,12 @@ compile_test() {
             #
             echo "$CONFTEST_PREAMBLE
             #include <linux/acpi.h>
+            #include <acpi/acpixf.h>
             void conftest_acpi_walk_namespace(void) {
                 acpi_walk_namespace();
             }" > conftest$$.c
 
-            $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
+            #CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
             rm -f conftest$$.c
 
             if  -f conftest$$.o ]; then
@@ -980,6 +981,7 @@ compile_test() {
 
             echo "$CONFTEST_PREAMBLE
             #include <linux/acpi.h>
+        #include <acpi/acpixf.h>
             void conftest_acpi_walk_namespace(void) {
                 acpi_walk_namespace(0, NULL, 0, NULL, NULL, NULL, NULL);
             }" > conftest$$.c
@@ -996,6 +998,7 @@ compile_test() {
 
             echo "$CONFTEST_PREAMBLE
             #include <linux/acpi.h>
+            #include <acpi/acpixf.h>
             void conftest_acpi_walk_namespace(void) {
                 acpi_walk_namespace(0, NULL, 0, NULL, NULL, NULL);
             }" > conftest$$.c
@@ -1604,6 +1607,9 @@ case "$6" in
             fi
         fi
 
+    RET=0
+    SELECTED_MAKEFILE=Makefile.kbuild
+
         if  "$RET" = "0" ]; then
             ln -s $SELECTED_MAKEFILE Makefile
             exit 0
Index: NVIDIA-Linux-x86-295.33/kernel/nv-linux.h
===================================================================
--- kernel.orig/nv-linux.h
+++ kernel/nv-linux.h
@@ -111,7 +111,7 @@
 #include <linux/timer.h>
 
 #include <asm/div64.h>              /* do_div()                         */
-#include <asm/system.h>             /* cli, sli, save_flags             */
+#include <asm/switch_to.h>          /* cli, sli, save_flags             */
 #include <asm/io.h>                 /* ioremap, virt_to_phys            */
 #include <asm/uaccess.h>            /* access_ok                        */
 #include <asm/page.h>               /* PAGE_OFFSET                      */

To then apply the patch you can use SANDI version 1.45 or manuallly with the following command:

sh ./NVIDIA-Linux-x86_64-295.33.run --apply-patch NVIDIA-295.33.patch

which creates the file NVIDIA-Linux-x86_64-295.33-custom.run

OR

sh ./NVIDIA-Linux-x64-295.33.run --apply-patch NVIDIA-295.33.patch

which creates the file NVIDIA-Linux-x64-295.33-custom.run

Thank You,

Here is a nVIDIA driver patch text file I call NVIDIA-295.33+.patch

Index: kernel/conftest.sh
===================================================================
--- kernel/conftest.sh.orig
+++ kernel/conftest.sh
@@ -95,7 +95,7 @@ build_cflags() {
         fi
     fi
 
-    CFLAGS="$CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
+    CFLAGS="$CFLAGS $OUTPUT_CFLAGS -I$HEADERS -I$OUTPUT/arch/x86/include/generated $AUTOCONF_CFLAGS"
 
     test_xen
 
@@ -126,7 +126,7 @@ build_cflags() {
     CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
 
     if  "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
-        CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include -I$SOURCES/arch/x86/include/generated"
+        CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include -I$OUTPUT/arch/x86/include/generated"
     elif  "$ARCH" = "ARMv7" ]; then
         CFLAGS="$CFLAGS -I$SOURCES/arch/arm/include -I$SOURCES/arch/arm/include/generated"
     fi
@@ -512,7 +512,12 @@ compile_test() {
             # and if it as an 'event' member.
             #
             echo "$CONFTEST_PREAMBLE
-            #include <asm/system.h>
+            #include <linux/version.h>
+        #if LINUX_VERSION_CODE > KERNEL_VERSION(3, 3, 0)
+          #include <asm/switch_to.h>
+        #else
+          #include <asm/system.h>
+        #endif
             #include <linux/pm.h>
             void conftest_pm_message_t(pm_message_t state) {
                 pm_message_t *p = &state;
@@ -965,11 +970,12 @@ compile_test() {
             #
             echo "$CONFTEST_PREAMBLE
             #include <linux/acpi.h>
+            #include <acpi/acpixf.h>
             void conftest_acpi_walk_namespace(void) {
                 acpi_walk_namespace();
             }" > conftest$$.c
 
-            $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
+            #CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
             rm -f conftest$$.c
 
             if  -f conftest$$.o ]; then
@@ -980,6 +986,7 @@ compile_test() {
 
             echo "$CONFTEST_PREAMBLE
             #include <linux/acpi.h>
+        #include <acpi/acpixf.h>
             void conftest_acpi_walk_namespace(void) {
                 acpi_walk_namespace(0, NULL, 0, NULL, NULL, NULL, NULL);
             }" > conftest$$.c
@@ -996,6 +1003,7 @@ compile_test() {
 
             echo "$CONFTEST_PREAMBLE
             #include <linux/acpi.h>
+            #include <acpi/acpixf.h>
             void conftest_acpi_walk_namespace(void) {
                 acpi_walk_namespace(0, NULL, 0, NULL, NULL, NULL);
             }" > conftest$$.c
@@ -1604,6 +1612,9 @@ case "$6" in
             fi
         fi
 
+    RET=0
+    SELECTED_MAKEFILE=Makefile.kbuild
+
         if  "$RET" = "0" ]; then
             ln -s $SELECTED_MAKEFILE Makefile
             exit 0
Index: kernel/nv-linux.h
===================================================================
--- kernel/nv-linux.h.orig
+++ kernel/nv-linux.h
@@ -111,7 +111,11 @@
 #include <linux/timer.h>
 
 #include <asm/div64.h>              /* do_div()                         */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 3, 0)
+#include <asm/switch_to.h>
+#else
 #include <asm/system.h>             /* cli, sli, save_flags             */
+#endif
 #include <asm/io.h>                 /* ioremap, virt_to_phys            */
 #include <asm/uaccess.h>            /* access_ok                        */
 #include <asm/page.h>               /* PAGE_OFFSET                      */


Copy the text above into a text file and save as NVIDIA-295.33+.patch in your ~/Downloads folder and you will be able to use it to patch kernels 3.3 and 3.4 for the nVIDIA driver 295.33 in 32 or 64 bit systems and installable by the SANDI bash script.

Thank You,

The following Patch file (I called NVIDIA-295.40.patch) and generously supplied by Larry Finger (a well known kernel developer) can be used to patch the latest nVIDIA driver 295.40 for use with the kernel version 3.4.

Index: kernel/conftest.sh
===================================================================
--- kernel/conftest.sh.orig
+++ kernel/conftest.sh
@@ -512,13 +512,18 @@ compile_test() {
             # and if it as an 'event' member.
             #
             echo "$CONFTEST_PREAMBLE
-            #include <asm/system.h>
+        #include <linux/version.h>
+#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 3, 0)
+        #include <asm/switch_to.h>
+#else
+        #include <asm/system.h>
+#endif
             #include <linux/pm.h>
             void conftest_pm_message_t(pm_message_t state) {
                 pm_message_t *p = &state;
             }" > conftest$$.c
 
-            $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
+            $CC $CFLAGS -c conftest$$.c #> /dev/null 2>&1
             rm -f conftest$$.c
 
             if  -f conftest$$.o ]; then
@@ -965,6 +970,7 @@ compile_test() {
             #
             echo "$CONFTEST_PREAMBLE
             #include <linux/acpi.h>
+            #include <acpi/acpixf.h>
             void conftest_acpi_walk_namespace(void) {
                 acpi_walk_namespace();
             }" > conftest$$.c
@@ -980,6 +986,7 @@ compile_test() {
 
             echo "$CONFTEST_PREAMBLE
             #include <linux/acpi.h>
+            #include <acpi/acpixf.h>
             void conftest_acpi_walk_namespace(void) {
                 acpi_walk_namespace(0, NULL, 0, NULL, NULL, NULL, NULL);
             }" > conftest$$.c
@@ -996,6 +1003,7 @@ compile_test() {
 
             echo "$CONFTEST_PREAMBLE
             #include <linux/acpi.h>
+            #include <acpi/acpixf.h>
             void conftest_acpi_walk_namespace(void) {
                 acpi_walk_namespace(0, NULL, 0, NULL, NULL, NULL);
             }" > conftest$$.c
Index: kernel/nv-linux.h
===================================================================
--- kernel/nv-linux.h.orig
+++ kernel/nv-linux.h
@@ -111,7 +111,11 @@
 #include <linux/timer.h>
 
 #include <asm/div64.h>              /* do_div()                         */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 3, 0)
+#include <asm/switch_to.h>
+#else
 #include <asm/system.h>             /* cli, sli, save_flags             */
+#endif
 #include <asm/io.h>                 /* ioremap, virt_to_phys            */
 #include <asm/uaccess.h>            /* access_ok                        */
 #include <asm/page.h>               /* PAGE_OFFSET                      */


This patch, when save with the suggested file name (NVIDIA-295.40.patch), can be used to patch the nVIDIA driver 295.40 and loaded using SANDI shown above.

Thank You,

This version of SANDI needs a patch to be used by
NVIDIA-Linux-x86_64-295.40.run?
when using SANDI , xserver must be shut down or not? using init 3 command,?
Run Leve 3! Does it mean a terminal?

[QUOTE=kujirasan;bt458]This version of SANDI needs a patch to be used by
NVIDIA-Linux-x86_64-295.40.run?
when using SANDI , xserver must be shut down or not? using init 3 command,?
Run Leve 3! Does it mean a terminal?[/QUOTE]

The patch is required if you are using the released version of kernel 3.3 (which openSUSE 12.2 will use) or if you are trying out the beta kernel 3.4. If you use kernel 3.2 or lower, no patch is required. The patch is specific to the kernel being used and the version of the nVIDIA driver being loaded. Basically the kernel source file has changed, first with 3.3 and further with kernel 3.4 all the while the nVIDIA driver has changed as well, now up to version 295.40 and nVIDIA so far has NOT kept up with the kernel source file changes, all the while they keep changing their code as well. With the generous help of others such as Larry Finger, a kernel developer, we are trying to provide a way to match the latest kernel versions with the latest nVIDIA drivers, but it is not been easy to keep these two together. Right now, there is no single solution that gets kernels 3.2, 3.3 and 3.4 to work with the latest nVIDIA driver version and on top of that, nVIDIA driver 295.40 is said to have problems with older nVIDIA GPU versions. In the end, its is up to nVIDIA to provide a single solution, but they have failed to do this so far.

Thank You,

Copy the text in the code block below into a text editor and save the text as the file: NVIDIA-295.49-302.07.patch

--- kernel/conftest.sh  2012-05-01 10:46:38.000000000 +0400
+++ kernel/conftest.sh  2012-05-04 22:19:39.463000001 +0400
@@ -512,7 +512,6 @@
             # and if it as an 'event' member.
             #
             echo "$CONFTEST_PREAMBLE
-            #include <asm/system.h>
             #include <linux/pm.h>
             void conftest_pm_message_t(pm_message_t state) {
                 pm_message_t *p = &state;
--- kernel/nv-linux.h   2012-05-01 10:46:38.000000000 +0400
+++ kernel/nv-linux.h   2012-05-04 23:35:26.315000020 +0400
@@ -111,7 +111,6 @@
 #include <linux/timer.h>
 #include <asm/div64.h>              /* do_div()                         */
-#include <asm/system.h>             /* cli, sli, save_flags             */
 #include <asm/io.h>                 /* ioremap, virt_to_phys            */
 #include <asm/uaccess.h>            /* access_ok                        */
 #include <asm/page.h>               /* PAGE_OFFSET                      */
@@ -994,9 +993,19 @@
 #  define NV_IS_SUSER()                 capable(CAP_SYS_ADMIN)
 #  define NV_PCI_DEVICE_NAME(dev)       ((dev)->pretty_name)
 #  define NV_NUM_CPUS()                 num_online_cpus()
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
+# include <asm/system.h>
 #  define NV_CLI()                      local_irq_disable()
 #  define NV_SAVE_FLAGS(eflags)         local_save_flags(eflags)
 #  define NV_RESTORE_FLAGS(eflags)      local_irq_restore(eflags)
+#else
+# include <asm/irqflags.h>
+# define NV_CLI()                       arch_local_irq_disable()
+# define NV_SAVE_FLAGS()                arch_local_save_flags()
+# define NV_RESTORE_FLAGS(eflags)       arch_local_irq_restore(eflags)
+#endif
+
 #  define NV_MAY_SLEEP()                (!irqs_disabled() && !in_interrupt() && !NV_IN_ATOMIC())
 #  define NV_MODULE_PARAMETER(x)        module_param(x, int, 0)
 #  define NV_MODULE_STRING_PARAMETER(x) module_param(x, charp, 0)
--- kernel/nv-pat.c     2012-04-27 22:50:12.000000000 +0400
+++ kernel/nv-pat.c     2012-05-04 23:48:45.842000011 +0400
@@ -109,7 +109,11 @@
         return;
 #endif

+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
     NV_SAVE_FLAGS(eflags);
+#else
+    NV_SAVE_FLAGS();
+#endif
     NV_CLI();
     nv_disable_caches(&cr4);

@@ -135,7 +139,11 @@
         return;
 #endif

+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
     NV_SAVE_FLAGS(eflags);
+#else
+    NV_SAVE_FLAGS();
+#endif
     NV_CLI();
     nv_disable_caches(&cr4);

For users of the new Kernel 3.4, this patch can be loaded into SANDI to create a usable custom copy of the nVIDIA driver 295.49 or the beta 302.07 version of the nVIDIA proprietary video driver.

Links to these driver versions are here: Installing the nVIDIA Video Driver the Hard Way - Blogs - openSUSE Forums

Thank You,

NVIDIA Driver 295.59 has been released which is easy to use with SANDI. I suggest that you take the following steps:

  1. Download the latest nVIDIA driver to your ~/Downloads folder.
  2. Close all apps and restart your PC.
  3. Enter the kernel load option 3, taking you to runlevel 3, not loading your desktop
  4. Once your kernel is loaded, log into terminal as a root user
  5. Start sandi at the terminal prompt
  6. Select the nVIDIA driver version to load
  7. Select D for DKMS and allow all previous nVIDIA drivers loaded to be removed
  8. Once SANDI is complete, do not restart and run sandi again
  9. Again, select the same nVIDIA driver version, but this time, select F for a Full nVIDIA driver installation
  10. Once the full install is complete, you may now reboot your computer

Please let me know if you have any questions.

Thank You,

Hi James,

First of all, thank you for sharing your scripts and expertise!

I have a few questions for you.

  1. Does the 304.64 driver require a patch to work with SANDI and the current (oS 12.2) 3.4.x kernel?

  2. Which is the ‘best’ or preferred method to install the Nvidia driver (with as little pain as possible!) - LNVHW or SANDI?

  3. In the event that I completely bork the driver install and want to start from scratch again, how do I restore the default nouveau driver?

Thanks!