Kernel sources missing version.h

Issues Related to Hardware (Sound, Video, Printers, Scanners, Webcams, Touchpads, Keyboards, Sensors, Drives, GRUB, etc.)

Moderator: Moderators

Kernel sources missing version.h

Postby jortax » Wed Jan 23, 2013 11:11

I'm trying to install the AMD catalyst kernel drivers on my updated Sabayon with kernel 3.7.
It fails with "fglrx installation requires that the system have kernel headers. /lib/modules/3.7.0-sabayon/build/include/linux/version.h cannot be found on this system."
I have the directory and it contains a lot of files, except version.h.

I found that I have /lib/modules/3.6.0-sabayon/build/ (as well as 3.4.0, 3.3.0 ) contains version.h (and only that file in include-directory) and have a different structure than for 3.7.0. I cannot recall that I have done something different when upgrading the kernel (using kernel-switcher).
What do I need to do to have version.h?
jortax
Young Hen
 
Posts: 20
Joined: Fri Sep 24, 2010 18:54

Re: Kernel sources missing version.h

Postby jortax » Wed Jan 23, 2013 11:20

jortax wrote:I found that I have /lib/modules/3.6.0-sabayon/build/ (as well as 3.4.0, 3.3.0 ) contains version.h (and only that file in include-directory) and have a different structure than for 3.7.0.


I have sabayon-sources installed for 3.7-r3 but not for 3.6, 3.4 or 3.3.
jortax
Young Hen
 
Posts: 20
Joined: Fri Sep 24, 2010 18:54

Re: Kernel sources missing version.h

Postby Fitzcarraldo » Wed Jan 23, 2013 15:12

I suggest you file a bug report (click on the link 'Bugs' at the top of this page).
User avatar
Fitzcarraldo
Sagely Hen
 
Posts: 7998
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom

Re: Kernel sources missing version.h

Postby Fitzcarraldo » Wed Jan 23, 2013 15:15

I'm moving this thread to the Hardware shed (forum) as it's more appropriate there.
User avatar
Fitzcarraldo
Sagely Hen
 
Posts: 7998
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom

Re: Kernel sources missing version.h

Postby jortax » Fri Jan 25, 2013 11:39

It seems that the AMD Catalyst 13.1 kernel drivers does not support later kernels (like 3.7).
I found version.h in kernel sources and added a link to it where AMD drivers wanted it, then tried again but it failed on some compiler error due to that the drivers are using some symbols that are removed in 3.7 kernel.
jortax
Young Hen
 
Posts: 20
Joined: Fri Sep 24, 2010 18:54

Re: Kernel sources missing version.h

Postby Thev00d00 » Sat Jan 26, 2013 10:31

You need to wait for an ebuild. Or apply the additional patches that the ebuild would to your tree.

Manually building stuff is not supported/recommended.
Image
Please report Bugs on the Bugzilla, not forum
Please Adopt an Unanswered thread
Website / Blog : v00d00.net
twitter: Follow Me
G+: Circle Me
Thev00d00
Generally Awesome (tm)
 
Posts: 1472
Joined: Wed Feb 21, 2007 15:52
Location: United Kingdom

Re: Kernel sources missing version.h

Postby Firalus » Sun Jan 27, 2013 18:51

version.h is in a different location in the new kernels.
All you need to do is create a symlink, but not from sources as you did:
Code: Select all
# ln -s /lib/modules/$(uname -r)/build/include/generated/uapi/linux/version.h /lib/modules/$(uname -r)/build/include/linux/version.h


Also, as far as I know, AMD drivers do not install properly on the newer kernels (I'm trying to get 13.1 Legacy for my HD4670). My drivers do not want to cooperate, but I found a patch during my research that may work if you are using normal ones.

Try to install the drivers. After creating the symlink for version.h they should install and give an error message at the end of the installation. Ignore the message.

Copy the fglrx-3.7.patch to /lib/modules/fglrx/build_mod/ (I believe you must do it through console with sudo).

Then:
Code: Select all
# cd /lib/modules/fglrx/build_mod/
# patch -p0 < fglrx-3.7.patch
# ./make.sh
# cd ..
# ./make_install.sh


I didn't test it myself, but it should be working at least on ATI 12.10 drivers, possibly also on the newest release.
Firalus
Baby Hen
 
Posts: 5
Joined: Fri Jan 25, 2013 19:34

Re: Kernel sources missing version.h

Postby Firalus » Sun Jan 27, 2013 19:59

Another post for clarity:
I managed to install my drivers just now, unsure if they will work though.

I used these patches, they are somewhat flawed though and you need to manually specify the file to be patched (:
1.
Code: Select all
--- make.sh
+++ make.sh
@@ -202,7 +202,7 @@ cd $current_wd
 # verify match with respective line in linux/version.h
 # sample: #define UTS_RELEASE "2.4.0-test7"
 
-src_file=$linuxincludes/linux/version.h
+src_file=$linuxincludes/generated/uapi/linux/version.h
 
 if [ ! -e $src_file ]; then
   echo "kernel includes at $linuxincludes not found or incomplete" | tee -a $logfile
@@ -218,7 +218,7 @@ OsRelease=${uname_r}
 # Some old distributions used to define UTS-defines in external
 # version-*.h files, e.g. linux-2.2.14-5.0-RedHat. Is this kludge still needed?
 for src_file in \
-    "$linuxincludes/linux/version.h" \
+    "$linuxincludes/generated/uapi/linux/version.h" \
     "$linuxincludes/linux/utsrelease.h" \
     "$linuxincludes/generated/utsrelease.h" \
     "$linuxincludes/linux/version-*.h";
--
1.7.9.5


2.
Code: Select all
*** firegl_public.c.orig   2012-10-23 21:44:52.000000000 +0100
--- firegl_public.c   2012-11-10 01:54:01.211564395 +0000
***************
*** 3892,3898 ****
--- 3892,3902 ----
                  KCL_DEBUG_ERROR(REMAP_PAGE_RANGE_STR " failed\n");
                  return -EAGAIN;
              }
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
              vma->vm_flags |= VM_SHM | VM_RESERVED; /* Don't swap */
+ #else
+             vma->vm_flags |= VM_SHM | VM_DONTEXPAND | VM_DONTDUMP; /* Don't swap */
+ #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
              vma->vm_ops = &vm_ops;
           break;
 
***************
*** 3922,3935 ****
--- 3926,3947 ----
                  KCL_DEBUG_ERROR(REMAP_PAGE_RANGE_STR " failed\n");
                  return -EAGAIN;
              }
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
              vma->vm_flags |= VM_SHM | VM_RESERVED; /* Don't swap */
+ #else
+             vma->vm_flags |= VM_SHM | VM_DONTEXPAND | VM_DONTDUMP; /* Don't swap */
+ #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
              vma->vm_ops = &vm_ops;
              }
           break;
  #endif                   
 
          case __KE_SHM:
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
              vma->vm_flags |= VM_SHM | VM_RESERVED; /* Don't swap */
+ #else
+             vma->vm_flags |= VM_SHM | VM_DONTEXPAND | VM_DONTDUMP; /* Don't swap */
+ #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
              vma->vm_ops = &vm_shm_ops;
              break;
 
***************
*** 3937,3943 ****
--- 3949,3959 ----
 
              pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
 
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
              vma->vm_flags |= VM_RESERVED;
+ #else
+             vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
+ #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
 
              //vma->vm_flags |=  VM_SHM | VM_LOCKED; /* DDDDDDDDDDon't swap */
              //vma->vm_mm->locked_vm += pages; /* Kernel tracks aqmount of locked pages */
***************
*** 3946,3959 ****
--- 3962,3983 ----
 
          case __KE_CTX:
              pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
              vma->vm_flags |= VM_LOCKED | VM_SHM | VM_RESERVED; /* Don't swap */
+ #else
+             vma->vm_flags |= VM_LOCKED | VM_SHM | VM_DONTEXPAND | VM_DONTDUMP; /* Don't swap */
+ #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
              vma->vm_mm->locked_vm += pages; /* Kernel tracks aqmount of locked pages */
              vma->vm_ops = &vm_ctx_ops;
              break;
 
          case __KE_PCI_BQS:
              pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
              vma->vm_flags |= VM_LOCKED | VM_SHM | VM_RESERVED; /* Don't swap */
+ #else
+             vma->vm_flags |= VM_LOCKED | VM_SHM | VM_DONTEXPAND | VM_DONTDUMP; /* Don't swap */
+ #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
              vma->vm_mm->locked_vm += pages; /* Kernel tracks aqmount of locked pages */
              vma->vm_ops = &vm_pci_bq_ops;
              break;
***************
*** 3984,3992 ****
--- 4008,4024 ----
                      return -EAGAIN;
                  }
  #ifdef __x86_64__
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
                  vma->vm_flags |= VM_RESERVED;
  #else
+                 vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
+ #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
+ #else
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
                  vma->vm_flags |= VM_SHM | VM_RESERVED; /* Don't swap */
+ #else
+                 vma->vm_flags |= VM_SHM | VM_DONTEXPAND | VM_DONTDUMP; /* Don't swap */
+ #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
  #endif
                  vma->vm_ops = &vm_ops;
              }
***************
*** 4015,4023 ****
--- 4047,4063 ----
                      return -EAGAIN;
                  }
  #ifdef __x86_64__
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
                  vma->vm_flags |= VM_RESERVED;
  #else
+                 vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
+ #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
+ #else
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
                  vma->vm_flags |= VM_SHM | VM_RESERVED; /* Don't swap */
+ #else
+                 vma->vm_flags |= VM_SHM | VM_DONTEXPAND | VM_DONTDUMP; /* Don't swap */
+ #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
  #endif
                  vma->vm_ops = &vm_agp_bq_ops;
              }
***************
*** 4025,4031 ****
--- 4065,4075 ----
  #endif /* __AGP__BUILTIN__ */
 
          case __KE_KMAP:
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
            vma->vm_flags |= VM_SHM | VM_RESERVED;
+ #else
+           vma->vm_flags |= VM_SHM | VM_DONTEXPAND | VM_DONTDUMP;
+ #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
              vma->vm_ops = &vm_kmap_ops;
              if (readonly && (vma->vm_flags & VM_WRITE))
              {
***************
*** 4046,4052 ****
--- 4090,4100 ----
  #endif           
              // fall through
           case __KE_GART_CACHEABLE:
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
               vma->vm_flags |= VM_RESERVED;
+ #else
+              vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
+ #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
               vma->vm_ops = &vm_gart_ops;
               break;
          default:


3.
Code: Select all
--- a/common/lib/modules/fglrx/build_mod/firegl_public.c   2012-06-15 18:30:13.483762070 +0200
+++ b/common/lib/modules/fglrx/build_mod/firegl_public.c   2012-06-17 17:47:36.543041869 +0200
@@ -2106,6 +2106,12 @@
     }
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
+# define NO_DO_MMAP
+# define do_mmap(a,b,c,d,e,f) vm_mmap(a, b, c, d, e, f)
+# define do_munmap(a,b,c) vm_munmap(b, c)
+#endif
+
 unsigned long ATI_API_CALL KCL_MEM_AllocLinearAddrInterval(
                                         KCL_IO_FILE_Handle file,
                                         unsigned long addr,
@@ -2117,10 +2123,13 @@
 
     flags = MAP_SHARED;
     prot  = PROT_READ|PROT_WRITE;
-
+#ifdef NO_DO_MMAP
+    vaddr = (void *) vm_mmap(file, 0, len, prot, flags, pgoff);
+#else
     down_write(&current->mm->mmap_sem);
     vaddr = (void *) do_mmap(file, 0, len, prot, flags, pgoff);
     up_write(&current->mm->mmap_sem);
+#endif
     if (IS_ERR(vaddr))
        return 0;
     else
@@ -2131,7 +2140,9 @@
 {
     int retcode = 0;
 
+#ifndef NO_DO_MMAP
     down_write(&current->mm->mmap_sem);
+#endif
 #ifdef FGL_LINUX_RHEL_MUNMAP_API
     retcode = do_munmap(current->mm,
                         addr,
@@ -2142,7 +2153,9 @@
                         addr,
                         len);
 #endif                       
+#ifndef NO_DO_MMAP
     up_write(&current->mm->mmap_sem);
+#endif
     return retcode;
 }
 


4.
Code: Select all
--- lib/modules/fglrx/build_mod/2.6.x/Makefile.compat_alloc     2010-10-25 19:14:43.157401050 -0400
+++ lib/modules/fglrx/build_mod/2.6.x/Makefile  2010-10-25 19:14:54.586401063 -0400
@@ -66,6 +66,7 @@
                         -DFGL_GART_RESERVED_SLOT \
                    -DFGL_LINUX253P1_VMA_API \
                    -DPAGE_ATTR_FIX=$(PAGE_ATTR_FIX) \
+                        -DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space \
   
    ifeq ($(KERNELRELEASE),)
    # on first call from remote location we get into this path


Did not use the patch I gave in the last post.
Also, I believe one of those patches removes the need to create symlink of version.h
Firalus
Baby Hen
 
Posts: 5
Joined: Fri Jan 25, 2013 19:34

Re: Kernel sources missing version.h

Postby soldier9599 » Wed Feb 20, 2013 9:20

I installed Catalyst (had to copy version.h) from AMD website and ran into similar errors upon completion. Catalyst interface will actually open and I can change settings (I can no longer edit graphical settings through Sabayon), but graphics processing has clearly gone from bad to a lot worse. I'm somewhat new to this so I'm wondering, how would I apply those patches? Your first post is pretty straightforward and I can figure that out, but I have no idea what to do with those four chunks of code.

This is my installation log:
Supported adapter detected.
Check if system has the tools required for installation.
Uninstalling any previously installed drivers.
Unloading radeon module...
rmmod: ERROR: Module radeon is in use
[Message] Kernel Module : Trying to install a precompiled kernel module.
[Message] Kernel Module : Precompiled kernel module version mismatched.
[Message] Kernel Module : Found kernel module build environment, generating kernel module now.
AMD kernel module generator version 2.1
Error:
kernel includes at /lib/modules/3.7.0-sabayon/build/include do not match current kernel.
they are versioned as ""
instead of "3.7.0-sabayon".
you might need to adjust your symlinks:
- /usr/include
- /usr/src/linux
[Error] Kernel Module : Failed to compile kernel module - please consult readme.
soldier9599
Baby Hen
 
Posts: 1
Joined: Wed Feb 20, 2013 8:44


Return to Hardware

Who is online

Users browsing this forum: No registered users and 1 guest

cron