Tux

...making Linux just a little more fun!

Installing Linux Modules

Kiniti Patrick [pkiniti at techmaxkenya.com]


Sun, 26 Sep 2010 07:29:53 -0400

Hi Gang,

I have a question on how to go about installing kernel modules without going through the entire process of recompiling a new kernel. In question is the agpgart module which i want to have as a loadable module. As of now my the agpgart only exists as header files, and dont have the modules ".ko" file yet. Below is the output command from locate agpgart.

$ locate agpgart

/usr/include/linux/agpgart.h /usr/src/kernels/2.6.31.5-127.fc12.i686.PAE/include/linux/agpgart.h

Thanks in advance.

Regards,

--

Kiniti


Top    Back


Ben Okopnik [ben at linuxgazette.net]


Sun, 26 Sep 2010 09:16:32 -0400

On Sun, Sep 26, 2010 at 07:29:53AM -0400, Kiniti Patrick wrote:

> Hi Gang, 
> 
> I have a question on how to go about installing kernel modules without
> going through the entire process of recompiling a new kernel.
> In question is the agpgart module which i want to have as a loadable
> module. As of now my the agpgart only exists as header files, and dont have
> the modules ".ko" file yet. 
> Below is the output command from locate agpgart.
> 
> $ locate agpgart
> 
> /usr/include/linux/agpgart.h
> /usr/src/kernels/2.6.31.5-127.fc12.i686.PAE/include/linux/agpgart.h

There's a bit more to it than that. The .h is just a header file, definitions that the code uses during compilation, but it's not the code itself (whenever you see 'include/' in the path, chances are very high that you're looking at nothing more than a header.)

Laying that aside, however, compiling the module yourself is often unnecessary; your distro probably has it already compiled and available in some package.

ben at Jotunheim:~$ dlocate agpgart.ko
linux-image-2.6.31-14-generic: /lib/modules/2.6.31-14-generic/kernel/drivers/char/agp/agpgart.ko
linux-image-2.6.31-15-generic: /lib/modules/2.6.31-15-generic/kernel/drivers/char/agp/agpgart.ko
linux-image-2.6.31-16-generic: /lib/modules/2.6.31-16-generic/kernel/drivers/char/agp/agpgart.ko
linux-image-2.6.31-17-generic: /lib/modules/2.6.31-17-generic/kernel/drivers/char/agp/agpgart.ko
linux-image-2.6.31-19-generic: /lib/modules/2.6.31-19-generic/kernel/drivers/char/agp/agpgart.ko
linux-image-2.6.31-20-generic: /lib/modules/2.6.31-20-generic/kernel/drivers/char/agp/agpgart.ko
linux-image-2.6.31-21-generic: /lib/modules/2.6.31-21-generic/kernel/drivers/char/agp/agpgart.ko
linux-image-2.6.31-22-generic: /lib/modules/2.6.31-22-generic/kernel/drivers/char/agp/agpgart.ko
ben at Jotunheim:~$ uname -r
2.6.31-22-generic

So, on my system (Ubuntu), the way for me to get the compiled module if I didn't already have it would be

sudo apt-get install linux-image-$(uname -r)

Depending on your distro, this may be the easiest approach. Otherwise, you'll need the kernel source and the headers; once you have those, you can do a module-only compile - I don't recall the syntax, since I haven't done it in a long time, but it would be something simple like

cd /usr/src/linux
sudo make modules
sudo make install
-- 
* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *


Top    Back


KINITI Patrick [pkiniti at techmaxkenya.com]


Sun, 26 Sep 2010 19:50:00 +0300

Hi Ben,

Thanks for the help. I will grub the kernel sources and build the modules and see how it goes.

Kiniti.

> On Sun, Sep 26, 2010 at 07:29:53AM -0400, Kiniti Patrick wrote:
>> Hi Gang,
>>
>> I have a question on how to go about installing kernel modules without
>> going through the entire process of recompiling a new kernel.
>> In question is the agpgart module which i want to have as a loadable
>> module. As of now my the agpgart only exists as header files, and dont
>> have
>> the modules ".ko" file yet.
>> Below is the output command from locate agpgart.
>>
>> $ locate agpgart
>>
>> /usr/include/linux/agpgart.h
>> /usr/src/kernels/2.6.31.5-127.fc12.i686.PAE/include/linux/agpgart.h
>
> There's a bit more to it than that. The .h is just a header file,
> definitions that the code uses during compilation, but it's not the code
> itself (whenever you see 'include/' in the path, chances are very high
> that you're looking at nothing more than a header.)
>
> Laying that aside, however, compiling the module yourself is often
> unnecessary; your distro probably has it already compiled and available
> in some package.
>
> ``
> ben at Jotunheim:~$ dlocate agpgart.ko
> linux-image-2.6.31-14-generic:
> /lib/modules/2.6.31-14-generic/kernel/drivers/char/agp/agpgart.ko
> linux-image-2.6.31-15-generic:
> /lib/modules/2.6.31-15-generic/kernel/drivers/char/agp/agpgart.ko
> linux-image-2.6.31-16-generic:
> /lib/modules/2.6.31-16-generic/kernel/drivers/char/agp/agpgart.ko
> linux-image-2.6.31-17-generic:
> /lib/modules/2.6.31-17-generic/kernel/drivers/char/agp/agpgart.ko
> linux-image-2.6.31-19-generic:
> /lib/modules/2.6.31-19-generic/kernel/drivers/char/agp/agpgart.ko
> linux-image-2.6.31-20-generic:
> /lib/modules/2.6.31-20-generic/kernel/drivers/char/agp/agpgart.ko
> linux-image-2.6.31-21-generic:
> /lib/modules/2.6.31-21-generic/kernel/drivers/char/agp/agpgart.ko
> linux-image-2.6.31-22-generic:
> /lib/modules/2.6.31-22-generic/kernel/drivers/char/agp/agpgart.ko
> ben at Jotunheim:~$ uname -r
> 2.6.31-22-generic
> ''
>
> So, on my system (Ubuntu), the way for me to get the compiled module if
> I didn't already have it would be
>
> ``
> sudo apt-get install linux-image-$(uname -r)
> ''
>
> Depending on your distro, this may be the easiest approach. Otherwise,
> you'll need the kernel source and the headers; once you have those, you
> can do a module-only compile - I don't recall the syntax, since I
> haven't done it in a long time, but it would be something simple like
>
> ```
> cd /usr/src/linux
> sudo make modules
> sudo make install
> '''
>
>
> --
> * Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *
>                                              
> TAG mailing list
> TAG at lists.linuxgazette.net
> http://lists.linuxgazette.net/listinfo.cgi/tag-linuxgazette.net
>

KINITI Patrick Systems Engineer. Techmax Computer Solutions Ltd. tel: +254-20-2074111 cell: +254-722-780806 web: http://www.techmaxkenya.com


Top    Back