Results 1 to 6 of 6
Hello,
I am software developer, and I am new in kernel programming.
I have token a look at linux sources, I found that drivers of all hardware are included in ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 01-07-2009 #1Just Joined!
- Join Date
- Dec 2008
- Posts
- 4
Linux Drivers Concept
Hello,
I am software developer, and I am new in kernel programming.
I have token a look at linux sources, I found that drivers of all hardware are included in linux kernel sources. The question is, how Linux include this drivers on the Kernel ??
- Including drivers statically in the the kernel is illogical of course. Since drivers will be loaded, all of them, even if they are not used.
- making drivers as dynamic libraries (.so) is not sufficient, too. How does the kernel include this library if it was already compiled and build ?
Moreover, will Linux sources grow every time a new driver take place ? this causes many troubles:
- Compiling linux will become slower year after year.
- linux evolution will be difficult because next versions must support old drivers.
- Linux Distributions will be huge in size.
Is Linux planning for solutions to that problems ?
- 01-07-2009 #2Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
Linux loads kernel modules containing drivers. If hardware is detected the correct module is loaded. I believe the extension if used is .ko (kernel object?)
The drivers are pretty small and when you compile Linux you only compile what you want to. If you look at menuconfig you can see that everything is optional.
- 01-07-2009 #3Just Joined!
- Join Date
- Dec 2008
- Posts
- 4
So can we add a new driver to an existing Linux system, without recompiling the kernel ?
- 01-07-2009 #4Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
Yep you can just compile that module and then load it using insmod/modprobe. The nVidia and AMD drivers do just that, the compile their kernel interface module and load it. You don't need to reboot or anything.
- 01-07-2009 #5Linux Guru
- Join Date
- Nov 2007
- Posts
- 1,722
Basic drivers that are *typically* needed by any system are usually compiled statically into the kernel. Everything else is commonly compiled as modules.
Google: linux driver coding module
You see lots of device drivers when you lsmod (list modules):
Code:lsmod Module Size Used by nls_utf8 18432 2 cifs 228592 2 nfs 239660 2 lockd 76408 2 nfs nfs_acl 19840 1 nfs sunrpc 173308 4 nfs,lockd,nfs_acl sha256 27520 0 aes_i586 49524 2 cbc 20736 1 blkcipher 22404 1 cbc dm_crypt 29192 1 vmnet 67472 15 vmmon 121840 6 snd_pcm_oss 62720 0 snd_mixer_oss 32384 1 snd_pcm_oss snd_seq 66740 0 snd_seq_device 24460 1 snd_seq iptable_filter 19200 0 ip_tables 28996 1 iptable_filter ip6_tables 30148 0 x_tables 30596 2 ip_tables,ip6_tables microcode 30092 0 firmware_class 25856 1 microcode cpufreq_conservative 23560 0 cpufreq_userspace 22912 0 cpufreq_powersave 18176 0 acpi_cpufreq 26888 0 speedstep_lib 21508 0 apparmor 53024 0 ext2 76296 1 mbcache 24580 1 ext2 xfs 515220 1 loop 33924 0 dm_mod 69168 3 dm_crypt snd_hda_intel 285212 3 snd_pcm 94852 3 snd_pcm_oss,snd_hda_intel snd_timer 39044 3 snd_seq,snd_pcm snd 70452 11 snd_pcm_oss,snd_mixer_oss,snd_seq,snd_seq_device,snd_hda_intel,snd_pcm,snd_timer soundcore 23748 1 snd e1000 180288 0 fglrx 1686092 27 snd_page_alloc 26248 2 snd_hda_intel,snd_pcm i2c_i801 24848 0 rtc_cmos 24352 0 i2c_core 39808 1 i2c_i801 intel_agp 39572 0 parport_pc 53436 0 rtc_core 35336 1 rtc_cmos button 24720 0 parport 50120 1 parport_pc sr_mod 31780 0 agpgart 48180 2 fglrx,intel_agp rtc_lib 19328 1 rtc_core generic 21124 0 [permanent] serio_raw 23044 0 e1000e 105124 0 joydev 25920 0 ide_core 135492 1 generic cdrom 49308 1 sr_mod sg 49196 0 usbhid 53716 0 hid 41472 1 usbhid ff_memless 21640 1 usbhid raid456 136720 0 xor 30856 1 raid456 raid1 38656 1 sd_mod 43392 11 ehci_hcd 47500 0 uhci_hcd 39440 0 usbcore 136044 4 usbhid,ehci_hcd,uhci_hcd edd 25284 0 raid0 24320 3 reiserfs 245556 2 fan 21508 0 ahci 41476 9 ata_generic 23812 0 libata 149320 2 ahci,ata_generic scsi_mod 152664 4 sr_mod,sg,sd_mod,libata thermal 32136 0 processor 54312 2 acpi_cpufreq,thermal
- 01-07-2009 #6Just Joined!
- Join Date
- Dec 2008
- Posts
- 4
Thank you for help.
That's the first time I read about Kernel Objects.
I found this book very useful for understanding kernel module programming: Linux Device Drivers, 2nd Edition: Online Book
Did you know why hardware drivers are rarely done by manufacturers and usually by third parties ?


Reply With Quote
