Hi,

I'm using a script to update nvidia modules for the new 3.12 kernels.
Maybe also useful for other's, here it is:

---------------------------
#!/bin/bash

# This script compiles and installs the nvidia kernel modules for
# non-official SUSE kernels to let it work with SUSE's nvidia
# packages without downloading drivers manually.
#
# Requirements:
#   - kernel-desktop-devel rpm (matching the new target kernel)
#   - nvidia kmp rpms (matchine the old official SUSE kernel)
#
# You must set the target kernel version here, we don't want to
# guess and use the running or last installed kernel!
arch=x86_64
kver=3.12.57-44
flavor=desktop

function nvidia_ko() {
    local ver=$1
    local kver=$2
    make -C /usr/src/linux-$kver-obj/$arch/$flavor \
        modules \
        M=/usr/src/kernel-modules/nvidia-$ver-$flavor \
        SYSSRC=/usr/src/linux-$kver \
        SYSOUT=/usr/src/linux-$kver-obj/$arch/$flavor || return

    rm -rf /tmp/nvidia_ko
    cp -a /usr/src/kernel-modules/nvidia-$ver-$flavor /tmp/nvidia_ko || return
    pushd /tmp/nvidia_ko

    make -f Makefile \
        nv-linux.o \
        SYSSRC=/usr/src/linux-$kver \
        SYSOUT=/usr/src/linux-$kver-obj/$arch/$flavor || return
    popd

    #kver=3.11.6-4

    install -m 755 -d /lib/modules/$kver-$flavor/updates
    install -m 644 /usr/src/kernel-modules/nvidia-$ver-$flavor/nvidia.ko \
        /lib/modules/$kver-$flavor/updates
    depmod $kver-$flavor

    # TODO weak update support
    #nvr=nvidia-gfxG03-kmp-desktop-340.96_k3.11.6_4-40.1
    #wm2=/usr/lib/module-init-tools/weak-modules2
    #if [ -x $wm2 ]; then
    #   /bin/bash -${-/e/} $wm2 --add-kmp $nvr
    #fi
}

function nvidia_uvm_ko() {
    local ver=$1
    local kver=$2

    rm -rf /tmp/nvidia-uvm_ko
    cp -a /usr/src/kernel-modules/nvidia-uvm-$ver-$flavor /tmp/nvidia-uvm_ko || 
return
    pushd /tmp/nvidia-uvm_ko/rm

    make module \
        SYSSRC=/usr/src/linux-$kver 
SYSOUT=/usr/src/linux-$kver-obj/$arch/$flavor \
        KBUILD_EXTMOD=/tmp/nvidia-uvm_ko/rm
    popd

    cp -f /tmp/nvidia-uvm_ko/rm/Module.symvers /tmp/nvidia-uvm_ko/Module.symvers

    make -C /usr/src/linux-$kver-obj/$arch/$flavor \
        modules \
        M=/tmp/nvidia-uvm_ko \
        SYSSRC=/usr/src/linux-$kver \
        SYSOUT=/usr/src/linux-$kver-obj/$arch/$flavor \
        RM_OUT_DIR=/tmp/nvidia-uvm_ko/rm

    #kver=3.11.6-4

    install -m 755 -d /lib/modules/$kver-$flavor/updates
    install -m 644 /tmp/nvidia-uvm_ko/nvidia-uvm.ko \
        /lib/modules/$kver-$flavor/updates
    depmod $kver-$flavor

    #TODO weak update support
    #nvr=nvidia-uvm-gfxG03-kmp-desktop-340.96_k3.11.6_4-40.1
    #wm2=/usr/lib/module-init-tools/weak-modules2
    #if [ -x $wm2 ]; then
    #   /bin/bash -${-/e/} $wm2 --add-kmp $nvr
    #fi
}

read name ver_nvidia rest <<<$(rpm -qa --qf "%{NAME} %{VERSION}\n" | grep 
"nvidia-gfx.*kmp")
ver_nvidia=${ver_nvidia%%_*}
read name ver_nvidia_uvm rest <<<$(rpm -qa --qf "%{NAME} %{VERSION}\n" | grep 
"nvidia-uvm-gfx.*kmp")
ver_nvidia_uvm=${ver_nvidia_uvm%%_*}

if [ -n "$ver_nvidia" ]; then
    echo "########## rebuild nvidia.ko $ver_nvidia for kernel $kver"
    nvidia_ko $ver_nvidia $kver
else
    echo "########## no nvidia.ko installed - nothing to do"
fi

if [ -n "$ver_nvidia_uvm" ]; then
    echo "########## rebuild nvidia_uvm.ko $ver_nvidia for kernel $kver"
    nvidia_uvm_ko $ver_nvidia_uvm $kver
else
    echo "########## no nvidia_uvm.ko installed - nothing to do"
fi
-------------------------
_______________________________________________
Evergreen mailing list
Evergreen@lists.rosenauer.org
http://lists.rosenauer.org/mailman/listinfo/evergreen

Reply via email to