LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 06-09-2013, 09:41 PM   #1
amishera
LQ Newbie
 
Registered: Dec 2011
Posts: 8

Rep: Reputation: Disabled
Confused about linux kernel driver and module driver


Hi,

Normally the driver is compiled and the .ko file is placed inside some directory /lib/modules/....

But I just downloaded some kernel source today and when I checked inside the subdirectories I found there are source code for the driver ie the ixgbe. Now the question is what is the purpose of the source code of the driver inside the kernel? When a fresh linux is installed the ixgbe.ko driver is located inside the /lib/... directory I mean the built-in driver is located in that location of the filesystem.

Moreover, there is some ixgbe.ko file in the initrd file also. Hence the interrelationship between the driver inside the kernel source code, initrd and user-installed .ko file (using modprobe) is totally confusing.

Would appreciate if someone can throw some light here.

Thanks
 
Old 06-09-2013, 10:28 PM   #2
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
to clarify, the .ko file are called Kernel modules, they are loaded and run in kernel space, and are effectively part of the kernel. some of the modules can actually be recompiled as a direct part of the kernel, but it is advantageous to leave them as modules as modules can be dynamically loaded and unloaded without rebooting or re-compiling the kernel, either way they are part of the kernel.

the initrd is an image that is loaded during boot prior to the root file system being loaded, and contains drivers that need to be present during boot prior to the root file system being loaded.
 
Old 06-09-2013, 11:22 PM   #3
amishera
LQ Newbie
 
Registered: Dec 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thank you very much sir, for the information. Can you also tell me what should I do to PXE boot? I have compiled the ixgbe driver in a RHEL server and I have the PXE image in the tftp server. So should I add the ixgbe.ko file in the initrd of the PXE image or I have to compile the kernel with the ixgbe source code? I just replaced the existing ixgbe.ko in the initrd with mine. But it is not working. Hence not sure whether I am doing things correctly.

Thanks
 
Old 06-10-2013, 12:19 PM   #4
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
i can't tell you the specifics since i've never done a pxe, but you would need to create an NFS based root tree and configure the fstab to reflect that (no swap mind you), then make sure the driver for NFS exists in the initrd so that the system has access to the NFS when the switchover from the initramfs to the live system occurs. the initial kernel and initramfs would be served by tftp, the boot loader by a pxe daemon which usually doubles as a DHCP server.

Last edited by frieza; 06-10-2013 at 12:20 PM.
 
Old 06-11-2013, 01:58 AM   #5
amishera
LQ Newbie
 
Registered: Dec 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thank you very much Mr Freiza. In fact I already have a PXE setup and it was working with the built-in driver. But as soon as I replaced my compiled ixgbe.ko file, it stopped working. The compiled driver was working fine on the running system and the running system was installed via the same PXE (how ironic ).
 
Old 06-11-2013, 01:42 PM   #6
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
perhaps you need to re-build your initramfs to include the new driver?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert a static driver to a loadable module in linux kernel? sunr2007 Linux - Kernel 5 05-09-2012 01:59 PM
nvidia driver 8762 kernel module mismatch x module openfun Ubuntu 5 06-27-2006 10:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 04:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration