LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Confused about linux kernel driver and module driver (https://www.linuxquestions.org/questions/linux-kernel-70/confused-about-linux-kernel-driver-and-module-driver-4175465369/)

amishera 06-09-2013 09:41 PM

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

frieza 06-09-2013 10:28 PM

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.

amishera 06-09-2013 11:22 PM

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

frieza 06-10-2013 12:19 PM

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.

amishera 06-11-2013 01:58 AM

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 :( ).

frieza 06-11-2013 01:42 PM

perhaps you need to re-build your initramfs to include the new driver?


All times are GMT -5. The time now is 05:49 PM.