Howto build kernel module?

Grant Edwards grante at visi.com
Thu Sep 15 20:50:59 UTC 2005


According to the FAQ:

    I have installed Ubuntu, but I need to compile a kernel module
    (for example, in order to connect to the network). What do I
    do?
    
    First, check whether the module you need is already present.
    Many additional drivers are included in the default Ubuntu
    kernel. If you still need to compile a module, the following
    command will install everything you need:
    
    # sudo apt-get install build-essential linux-headers-`uname -r`
    
    All of the packages needed are available on the Ubuntu CD.

I did that, and the linux-headers are installed under /usr/src,
but I still can't compile a kernel module:

    ***
    *** Host machine kernel version=2.6.12-8-386, Driver kernel version=2.6.12-8, Path to kernel sources=/usr/src/linux, use KBUILD=yes
    ***
    make -C /usr/src/linux M=/home/grante/peak-linux-driver-3.21/driver V=0  modules
    /bin/sh: /usr/src/linux-headers-2.6.12-8/scripts/gcc-version.sh: No such file or directory
    make[1]: Entering directory `/usr/src/linux-headers-2.6.12-8'
    
      WARNING: Symbol version dump /usr/src/linux-headers-2.6.12-8/Module.symvers
               is missing; modules will have no dependencies and modversions.
    
    make[2]: scripts/Makefile.build: No such file or directory
    make[2]: *** No rule to make target `scripts/Makefile.build'.  Stop.
    make[1]: *** [_module_/home/grante/peak-linux-driver-3.21/driver] Error 2
    make[1]: Leaving directory `/usr/src/linux-headers-2.6.12-8'
    make: *** [all] Error 2

It looks like I'm going to have to install the kernel sources,
copy the appropriate config file and do a "make oldconfig &&
make".  If that's true, what question is the FAQ really
answering?

-- 
Grant Edwards                   grante             Yow!  ... I live in a
                                  at               FUR-LINE FALLOUT SHELTER
                               visi.com            





More information about the ubuntu-users mailing list