Confused about linux kernel driver and module driver
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
Rep:
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.
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.
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
Rep:
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.
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 ).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.