Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Compiling modules against OpenSUSE kernel

  1. #1

    Default Compiling modules against OpenSUSE kernel

    Hi All,
    I am having some issues compiling kernel modules against the pre-built OpenSUSE kernel.

    Whenever I compile a module and try to load it, I get something like:
    Code:
    insmod fs/smbfs/smbfs.ko
    insmod: error inserting 'fs/smbfs/smbfs.ko': -1 Invalid module format
    It doesn't actually matter what the module is, they all do the same thing. I have tried the above mentioned smbfs, I've also tried:
    • vmware kernel module
    • nVidia
    • VirtualBox


    However, if I compile the entire kernel (and boot from it), the individual module loads fine.

    This behavior is consistent across a significant number of machines and installations (>6). As I recall, when I first started using SuSE at around version 9.2, I could successfully compile modules against the supplied kernel. Somewhere around version 10.x (possibly 10.1) it changed. Similarly, I've used RedHat / Fedora / CentOS extensively over the years, and compiling modules always worked on them.

    For the past few years I've actually been compiling the entire kernel so that I can then compile the individual module. That's starting to wear a little thin.

    NB. When I do make my own kernel, even just doing a make all after a make cloneconfig, the resulting kernel and modules are significantly different in size to the supplied ones. eg:

    Code:
    -rw-r--r--  1 root root 3.3M Jan 29 01:26 vmlinuz-2.6.31.12-0.1-xen
    -rw-r--r--  1 root root 3.2M Feb 21 12:48 vmlinuz-2.6.31.8-0.2-xen
    To me, this seems to indicate that there is something different about how the supplied kernel was built compared to the ones I build locally. I have no idea what though.

    I do recall some times when I was using RedHat that I couldn't compile modules for a specific kernel release. In those cases, the supplied kernel had been compiled with a different version of gcc than was supplied with the distro, so the resulting modules weren't right for the kernel. Does anyone know what compiler / version is used to build the standard OpenSUSE kernel?

    I have following kernel related packages installed:
    • kernel-desktop-2.6.31.12-0.1.1.x86_64
    • kernel-desktop-devel-2.6.31.12-0.1.1.x86_64
    • kernel-default-2.6.31.12-0.1.1.x86_64
    • kernel-source-2.6.31.12-0.1.1.noarch
    • kernel-xen-devel-2.6.31.12-0.1.1.x86_64
    • kernel-xen-2.6.31.12-0.1.1.x86_64
    • kernel-default-devel-2.6.31.12-0.1.1.x86_64
    • linux-kernel-headers-2.6.31-3.4.noarch
    • kernel-debug-devel-2.6.31.12-0.1.1.x86_64
    • kernel-syms-2.6.31.12-0.1.1.x86_64


    Before trying to compile a module I do:
    • make clean
    • make cloneconfig
    • make prepare
    • make modules_prepare


    Does anyone have any thoughts on how to successfully compile individual modules without compiling the entire kernel as well?

  2. #2
    Join Date
    Jun 2008
    Location
    The English Lake District. UK - GMT/BST
    Posts
    36,721
    Blog Entries
    20

    Default Re: Compiling modules against OpenSUSE kernel

    Which kernel are you actually booting from

    Post result of:
    Code:
    uname -a
    Leap 15_KDE
    My Articles Was I any help? If yes: Click the star below

  3. #3

    Default Re: Compiling modules against OpenSUSE kernel

    Code:
    Linux david 2.6.31.12-0.1-default #1 SMP 2010-01-27 08:20:11 +0100 x86_64 x86_64 x86_64 GNU/Linux
    Although, as mentioned, this behavior is consistent across multiple machines / installations / versions / kernel types.

  4. #4
    Join Date
    Jun 2008
    Location
    The English Lake District. UK - GMT/BST
    Posts
    36,721
    Blog Entries
    20

    Default Re: Compiling modules against OpenSUSE kernel

    But only kernel-desktop in your list has anything like what you need.

    Do you have a reason for installing all those different kernels?
    Leap 15_KDE
    My Articles Was I any help? If yes: Click the star below

  5. #5

    Default Re: Compiling modules against OpenSUSE kernel

    Quote Originally Posted by caf4926 View Post
    But only kernel-desktop in your list has anything like what you need.

    Do you have a reason for installing all those different kernels?
    The default and desktop kernels were installed by the installer (possibly in a previous version). I installed the xen kernel the other day when I wanted to try it.

    As far as I'm aware, there isn't any real downside to having multiple kernels installed. You only use one at a time. The others just sit there until they are used.

  6. #6
    Join Date
    Jun 2008
    Location
    The English Lake District. UK - GMT/BST
    Posts
    36,721
    Blog Entries
    20

    Default Re: Compiling modules against OpenSUSE kernel

    Let me show you mine, I have no problems

    Code:
    kernel-default-2.6.31.12-0.1.1.i586
    kernel-default-base-2.6.31.12-0.1.1.i586
    kernel-firmware-20090821-4.1.noarch
    kernel-default-devel-2.6.31.12-0.1.1.i586
    kernel-source-2.6.31.12-0.1.1.noarch
    Leap 15_KDE
    My Articles Was I any help? If yes: Click the star below

  7. #7
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: Compiling modules against OpenSUSE kernel

    Quote Originally Posted by baileydau View Post
    Does anyone have any thoughts on how to successfully compile individual modules without compiling the entire kernel as well?
    Haven't had any problems myself, e.g. with compiling vboxdrv, through all the releases of openSUSE. Maybe you have a systemic error, e.g. an older and incompatible version of gcc or binutils that's in /usr/local/bin or somewhere ahead in your PATH and getting invoked instead of the correct ones. Do this:

    which gcc as ld nm strip

    Anything location other than /usr/bin is not good.

    Perhaps you should also post the log of a compile session. E.g. /var/log/vbox-install.log

  8. #8

    Default Re: Compiling modules against OpenSUSE kernel

    Could you please run through the exact steps you use to compile an individual kernel module. for example the smbfs module I've been using as an example.

    NB. To find it in the "make xconfig", look under "File systems" -> "Network File systems" (select SMB file system at that level)

    Thanks,
    David

  9. #9
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: Compiling modules against OpenSUSE kernel

    I've only ever compiled the vboxdrv module and the command is simply

    /etc/init.d/vboxdrv setup

    But the commands for compiling other kernel modules are simply those given in heaps of tutes on the net, no black magic involved, generally just running make.

  10. #10

    Default Re: Compiling modules against OpenSUSE kernel

    Quote Originally Posted by ken_yap View Post
    Haven't had any problems myself, e.g. with compiling vboxdrv, through all the releases of openSUSE. Maybe you have a systemic error, e.g. an older and incompatible version of gcc or binutils that's in /usr/local/bin or somewhere ahead in your PATH and getting invoked instead of the correct ones. Do this:

    which gcc as ld nm strip

    Anything location other than /usr/bin is not good.

    Perhaps you should also post the log of a compile session. E.g. /var/log/vbox-install.log
    Code:
    which gcc as ld nm strip
    /usr/bin/gcc
    /usr/bin/as
    /usr/bin/ld
    /usr/bin/nm
    /usr/bin/strip
    Everything is where I would expect it.


    As mentioned, I've had this issue across many systems etc. It may well be systematic in the way I set my OpenSUSE boxes up.

    I install the "Linux Kernel Development" pattern. I assume that it installs everything I need.

    Code:
    gcc --version
    gcc (SUSE Linux) 4.4.1 [gcc-4_4-branch revision t
    Copyright (C) 2009 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
    .

    Just to reitterate, if I compile the entire kernel myself first, I can then compile any additional modules I like. But if I use exactly the same method with the pre-compiled kernel it fails.

    Below is an example of the commands I use. NB. when I do the "make xconfig" step I set the SMB file system module as mentioned above.

    Could someone else try these steps and let me know what they get.

    Alternatively, could someone describe their exact steps to compile a module.

    NB. When I do things like build the nVidia or VMware modules, it compiles fine, there are no issues shown in the logs, but just fails to insert into the running kernel, exactly the same as this example.

    The commands I use are:
    Code:
    cd /usr/src/linux
    make mrproper
    make cloneconfig
    make prepare
    make modules_prepare
    make xconfig
    make fs/smbfs/smbfs.ko
    insmod fs/smbfs/smbfs.ko
    The output from the above is:
    Code:
    david:/usr/src/linux # make mrproper
      CLEAN   /usr/src/linux-2.6.31.12-0.1
      CLEAN   .tmp_versions               
      CLEAN   scripts/basic               
      CLEAN   scripts/genksyms            
      CLEAN   scripts/kconfig             
      CLEAN   scripts/mod                 
      CLEAN   scripts/selinux/mdp         
      CLEAN   scripts                     
      CLEAN   include/config              
      CLEAN   .config .config.old include/asm include/linux/autoconf.h include/linux/version.h include/linux/utsrelease.h include/linux/bounds.h include/asm/asm-offsets.h Module.symvers Module.markers                                                                                                                                          
    david:/usr/src/linux # make cloneconfig                                                                                                                                
      HOSTCC  scripts/basic/fixdep                                                                                                                                         
      HOSTCC  scripts/basic/docproc                                                                                                                                        
      HOSTCC  scripts/basic/hash                                                                                                                                           
      HOSTCC  scripts/kconfig/conf.o                                                                                                                                       
      HOSTCC  scripts/kconfig/kxgettext.o                                                                                                                                  
      SHIPPED scripts/kconfig/zconf.tab.c                                                                                                                                  
      SHIPPED scripts/kconfig/lex.zconf.c                                                                                                                                  
      SHIPPED scripts/kconfig/zconf.hash.c                                                                                                                                 
      HOSTCC  scripts/kconfig/zconf.tab.o                                                                                                                                  
      HOSTLD  scripts/kconfig/conf                                                                                                                                         
    Cloning configuration file /proc/config.gz                                                                                                                             
    
    #
    # configuration written to .config
    #                                 
    david:/usr/src/linux # make prepare
    scripts/kconfig/conf -s arch/x86/Kconfig
      CHK     include/linux/version.h       
      UPD     include/linux/version.h       
      CHK     include/linux/utsrelease.h    
      UPD     include/linux/utsrelease.h    
      SYMLINK include/asm -> arch/x86/include/asm
      CC      kernel/bounds.s                    
      GEN     include/linux/bounds.h             
      CC      arch/x86/kernel/asm-offsets.s      
      GEN     include/asm/asm-offsets.h          
      CALL    scripts/checksyscalls.sh           
    david:/usr/src/linux # make modules_prepare
      CHK     include/linux/version.h          
      CHK     include/linux/utsrelease.h       
      SYMLINK include/asm -> arch/x86/include/asm
      CALL    scripts/checksyscalls.sh           
      HOSTCC  scripts/genksyms/genksyms.o        
      SHIPPED scripts/genksyms/lex.c             
      SHIPPED scripts/genksyms/parse.h           
      SHIPPED scripts/genksyms/keywords.c        
      HOSTCC  scripts/genksyms/lex.o             
      SHIPPED scripts/genksyms/parse.c           
      HOSTCC  scripts/genksyms/parse.o           
      HOSTLD  scripts/genksyms/genksyms          
      CC      scripts/mod/empty.o                
      HOSTCC  scripts/mod/mk_elfconfig           
      MKELF   scripts/mod/elfconfig.h            
      HOSTCC  scripts/mod/file2alias.o           
      HOSTCC  scripts/mod/modpost.o              
      HOSTCC  scripts/mod/sumversion.o           
      HOSTLD  scripts/mod/modpost                
      HOSTCC  scripts/selinux/mdp/mdp            
      HOSTCC  scripts/kallsyms
      HOSTCC  scripts/conmakehash
      HOSTCC  scripts/bin2c
    david:/usr/src/linux # make xconfig
      CHECK   qt
    sed < scripts/kconfig/lkc_proto.h > scripts/kconfig/lkc_defs.h 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
      HOSTCC  scripts/kconfig/kconfig_load.o
    /usr/lib/qt3//bin/moc -i scripts/kconfig/qconf.h -o scripts/kconfig/qconf.moc
      HOSTCXX scripts/kconfig/qconf.o
      HOSTLD  scripts/kconfig/qconf
    scripts/kconfig/qconf arch/x86/Kconfig
    #
    # configuration written to .config
    #
    david:/usr/src/linux # make fs/smbfs/smbfs.ko
    scripts/kconfig/conf -s arch/x86/Kconfig
      CHK     include/linux/version.h
      CHK     include/linux/utsrelease.h
      SYMLINK include/asm -> arch/x86/include/asm
      CALL    scripts/checksyscalls.sh
      CC [M]  fs/smbfs/proc.o
      CC [M]  fs/smbfs/dir.o
      CC [M]  fs/smbfs/cache.o
      CC [M]  fs/smbfs/sock.o
      CC [M]  fs/smbfs/inode.o
      CC [M]  fs/smbfs/file.o
      CC [M]  fs/smbfs/ioctl.o
      CC [M]  fs/smbfs/getopt.o
      CC [M]  fs/smbfs/symlink.o
      CC [M]  fs/smbfs/smbiod.o
      CC [M]  fs/smbfs/request.o
      LD [M]  fs/smbfs/smbfs.o
      MODPOST 1 modules
      CC      fs/smbfs/smbfs.mod.o
      LD [M]  fs/smbfs/smbfs.ko
    david:/usr/src/linux # insmod fs/smbfs/smbfs.ko
    insmod: error inserting 'fs/smbfs/smbfs.ko': -1 Invalid module format

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •