Page 1 of 1

Porteus 3.2.2: Nvidia Drivers: 304 .131 .134 & 340 Patch

Posted: 30 Dec 2016, 01:15
by Bogomips
Nvidia 304.131

Built 304.131 modules by adapting from 340 Patch for Kernel 4.9. So, with a bit of guesswork managed to get modules to load. However with 304.132 managed to load module, but then ran into OpenGL 2 Issue, with Plasma shell complaining in this regard. Maybe could be same issue of symbolic links as that faced by those trying to run the advanced drivers. Will have to investigate a bit further.
32 Bit
md5sum nvidia-304.131_3.2.2-i586-1bp.xzm
4b297e76752657346d21e1355e5ff341 nvidia-304.131_3.2.2-i586-1bp.xzm

Code: Select all

guest@porteus:~$ uname -rm
4.9.0-porteus i686
guest@porteus:~$ ls -lh  nvidia-304.131_3.2.2-i586-1bp.xzm 
-rw-r--r-- 1 root root 23M Dec 28 19:02  nvidia-304.131_3.2.2-i586-1bp.xzm
64 Bit
md5sum nvidia-304.131_3.2.2-x86_64-1bp.xzm
68aa03d63f1a5a572bb4a23fdb14620c nvidia-304.131_3.2.2-x86_64-1bp.xzm

Code: Select all

guest@porteus:~$ uname -rm
4.9.0-porteus x86_64
guest@porteus:~$ ls -lh  nvidia-304.131_3.2.2-x86_64-1bp.xzm
-rw-r--r-- 1 root root 24M Dec 28 22:16  nvidia-304.131_3.2.2-x86_64-1bp.xzm
md5sum nvidia-304.131_3.2.2-x86_64-2bp.xzm
6cd20e46c6217b73f440832308e32556 nvidia-304.131_3.2.2-x86_64-2bp.xzm

Code: Select all

guest@porteus:~$ uname -rm
4.9.0-porteus x86_64
guest@porteus:~$ ls -lh  nvidia-304.131_3.2.2-x86_64-2bp.xzm
-rw-r--r-- 1 root root 24M Dec 29 22:30   nvidia-304.131_3.2.2-x86_64-2bp.xzm
Not sure if one of above is faster than the other. :unknown:


Adapted from 340.98 Patch:

Probably advisable for anyone trying to run 340 to patch 340.98 as mentioned here: https://devtalk.nvidia.com/default/topi ... ernel-4-9/

Nvidia Driver: 304.134

Posted: 31 Dec 2016, 23:19
by Bogomips
Nvidia Driver: 304.134 with support for Xorg119

md5sum nvidia-304.134_3.2.2-x86_64-1bp.xzm
5ff09e280fb89ee02cb91af641f9966f nvidia-304.134_3.2.2-x86_64-1bp.xzm

Code: Select all

guest@porteus:~$ uname -rm
4.9.0-porteus x86_64
guest@porteus:~$ ls -lh   nvidia-304.134_3.2.2-x86_64-1bp.xzm
-rw-r--r-- 1 root root 24M Dec 31 23:19  nvidia-304.134_3.2.2-x86_64-1bp.xzm
Enjoy!

Re: Porteus 3.2.2: Nvidia Drivers: 304 .131 .134 & 340 Patc

Posted: 08 Jan 2017, 00:43
by Bogomips
DIY Module
  1. Patch save as, say, nv134x86_64.patch

    Code: Select all

    --- kernel/nv-linux.h   2016-12-09 20:30:08.000000000 +0000
    +++ kernel/nv-linux.h  2016-12-31 21:17:37.000000000 +0000
    @@ -254,6 +254,15 @@
     #include <linux/seq_file.h>
     #endif
     
    +/*
    + * As of version 304.131, os-agp.c and os-mtrr.c still use deprecated
    + * kernel APIs for mtrr which are no longer exported since 4.3, causing
    + * the module to error out when loaded.
    + */
    +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)
    +#undef CONFIG_MTRR
    +#endif
    +
     #if !defined(NV_VMWARE) && defined(CONFIG_MTRR)
     #include <asm/mtrr.h>
     #endif
    @@ -1891,8 +1900,17 @@
     #else
         #define NV_GET_USER_PAGES(start, nr_pages, write, force, pages, vmas) \
             get_user_pages(current, current->mm, start, nr_pages, write, force, pages, vmas)
    +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
    +    #define NV_GET_USER_PAGES(start, nr_pages, gup_flags, pages, vmas) \
    +        get_user_pages(current, current->mm, start, nr_pages, gup_flags, pages, vmas)
    +#else
    +    #define NV_GET_USER_PAGES(start, nr_pages, write, force, pages, vmas) \
    +        get_user_pages(current, current->mm, start, nr_pages, write, force, pages, vmas)
    +#endif
     
         #define NV_GET_USER_PAGES_REMOTE    get_user_pages
     #endif
     
    +
    +        
     #endif  /* _NV_LINUX_H_ */
    --- kernel/nv-mlock.c   2016-12-09 20:30:08.000000000 +0000
    +++ kernel/nv-mlock.c  2016-12-31 21:17:37.000000000 +0000
    @@ -49,8 +49,12 @@
         }
     
         down_read(&mm->mmap_sem);
    -    ret = NV_GET_USER_PAGES((unsigned long)address,
    +    ret = get_user_pages((unsigned long)address,
    +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
    +                            page_count, write ? FOLL_WRITE : 0, user_pages, NULL);
    +#else
                                 page_count, write, force, user_pages, NULL);
    +#endif
         up_read(&mm->mmap_sem);
         pinned = ret;
     
    --- kernel/nv-drm.c     2016-12-09 20:30:08.000000000 +0000
    +++ kernel/nv-drm.c    2016-12-31 21:17:37.000000000 +0000
    @@ -71,7 +71,11 @@
     };
     
     static struct drm_driver nv_drm_driver = {
    -    .driver_features = 0,
    +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
    +     .driver_features = DRIVER_GEM | DRIVER_PRIME | DRIVER_LEGACY,
    +#else
    +     .driver_features = DRIVER_GEM | DRIVER_PRIME,
    +#endif
         .load = nv_drm_load,
         .unload = nv_drm_unload,
         .fops = &nv_drm_fops,
    
  2. Extract to Directory(to be created, must not exist)

    Code: Select all

    sh NVIDIA-Linux-x86_64-304.134.run -x --target /Path/to/nv134x86_64
  3. Descend into Directory & Apply Patch

    Code: Select all

    pushd   /Path/to/nv134x86_64
    patch -p0  -i /Path/to/nv134x86_64.patch
    popd
    
  4. Boot into Text Mode, blacklisting Nouveau > Compile
  5. Save Changes > Enter init 4
  6. Verify
    Image
  7. Make Module
  8. Enjoy!

Re: Porteus 3.2.2: Nvidia Drivers: 304 .131 .134 & 340 Patc

Posted: 09 Jan 2017, 03:07
by fulalas
Thanks, Bogomips! You're doing a good job with this Nvidia mess :good:

There's a new 340.101 version, but it still doesn't work out of the box with kernel 4.9 :(

Re: Porteus 3.2.2: Nvidia Drivers: 304 .131 .134 & 340 Patc

Posted: 19 Jan 2017, 08:00
by fulalas
A little contribution :)

340.98 driver for kernel 4.9: http://www.mediafire.com/file/dwmzy5tdx ... el-4.9.xzm