Use of the ubuntulinux Driver Module

Source: Internet
Author: User
Use of the ubuntulinux driver module-general Linux technology-Linux programming and kernel information. The following is a detailed description. Linux is based on modules, and all drivers are modular:
Management Module command:

1,
Lists the sizes and names of all loaded modules in the system. For example, lsmod or cat/proc/modules.
Ty @ tonylinux :~ $ Lsmod
Module Size Used
Rfcomm 40216 0
L2cap 26244 5 rfcomm
Bluetooth 50020 4 rfcomm, l2cap
Ppdev 9220 0
Radeon 116000 1
Drm 73236 2 radeon
Speedstep_centrino 8400 1
Cpufreq_userspace 4696 1
Cpfreq_stats 5636 0
Freq_table 4740 2 speedstep_centrino, cpufreq_stats
Cpufreq_powersave 1920 0
Cpufreq_ondemand 6428 0
Cpufreq_conservative 7332 0
Video 16260 0
Tc1100_wmi 6916 0
Sony_acpi 5644 0
Pcc_acpi 12416 0
Hotkey 11556 0
Dev_acpi 11140 0
Container 4608 0
Button 6672 0
Acpi_sbs 19980 0
Battery 9988 1 acpi_sbs
Ac 5252 1 acpi_sbs
I2c_acpi_ec 5120 1 acpi_sbs
I2c_core 21904 1 i2c_acpi_ec
Nls_utf8 2176 2
Ntfs 103536 2
Nls_iso8859_1 4224 1
Nls_cp437 5888 1
Vfat 13440 1
Fat 53020 1 vfat
IPv6. 6 265728
Dm_mod 58936 1
Md_mod 72532 0
Lp 11844 0
Af_packet 22920 2
Wlan_wep 6912 1
Tg3 101764 0
Pcmcia 40508 0
Joydev 10048 0
Rtc 13492 0
Tsdev 8000 0
Pcspkr 2180 0
Yenta_socket 28428 3
Rsrc_nonstatic 13440 1 yenta_socket
Pcmcia_core 42640 3 pcmcia, yenta_socket, rsrc_nonstatic
Floppy 62148 0
Parport_pc 35780 1
Parport 36296 3 ppdev, lp, parport_pc
Usbhid 39904 0
Psmouse 36100 0
Serio_raw 7300 0
Ath_pci-80540 0
Ath_rate_sample 17160 1 ath_pci
Wlan 144924 4 wlan_wep, ath_pci, ath_rate_sample
Ath_hal 148816 3 ath_pci, ath_rate_sample
Snd_intel8x0 33692 4
Snd_ac97_codec 93216 1 snd_intel8x0
Snd_ac97_bus 2304 1 snd_ac97_codec
Snd_pcm_oss 53664 0
Snd_mixer_oss 18688 1 snd_pcm_oss
Snd_pcm 89864 4 snd_intel8x0, snd_ac97_codec, snd_pcm_oss
Snd_timer 25220 3 snd_pcm
Snd 55268 11 snd_intel8x0, snd_ac97_codec, snd_pcm_oss, snd_mixer_oss, snd_pcm, snd_timer
Soundcore 10208 1 snd
Snd_page_alloc 10632 2 snd_intel8x0, snd_pcm
Shpchp 45632 0
Pci_hotplug29236 1 shpchp
Intel_agp 22940 1
Agpgart 34888 2 drm, intel_agp
Evdev2 9856 2
Ext3 135816 2
Jbd 58772 1 ext3
Ide_generic 1536 0
E-ci_hcd 34184 0
Uhci_hcd 33808 0
Usbcore 130820 4 usbhid, ehci_hcd, uhci_hcd
Ide_cd 33028 2
Cdrom 38560 1 ide_cd
Ide_disk 17664 7
Piix 11012 1
Generic 5124 0
Thermal0 13576
Processor 23360 2 speedstep_centrino, thermal
Fan 4868 0
Capability 5000 0
Commoncap 7296 1 capability
Vga16fb 13704 1
Vgastate 10368 1 vga16fb
Fbcon 42784 72
Tileb00002816 1 fbcon
Font 8320 1 fbcon
Bitb00006272 1 fbcon
Softcursor 2304 1 bitbits


Ty @ tonylinux :~ $ Cat/proc/modules
Rfcomm 40216 0-Live 0xf8dee000
L2cap 26244 5 rfcomm, Live 0xf8db2000
Bluetooth 50020 4 rfcomm, l2cap, Live 0xf8dc2000
Ppdev 9220 0-Live 0xf8d88000
Radeon 116000 1-Live 0xf8dd0000
Drm 73236 2 radeon, Live 0xf8d9f000
Speedstep_centrino 8400 1-Live 0xf8ty @ tonylinux :~ $ Cat/proc/modules
Rfcomm 40216 0-Live 0xf8dee000
L2cap 26244 5 rfcomm, Live 0xf8db2000
Bluetooth 50020 4 rfcomm, l2cap, Live 0xf8dc2000
Ppdev 9220 0-Live 0xf8d88000
Radeon 116000 1-Live 0xf8dd0000
Drm 73236 2 radeon, Live 0xf8d9f000
Speedstep_centrino 8400 1-Live 0xf8d7e000
Cpufreq_userspace 4696 1-Live 0xf8d7b000
Cpufreq_stats 5636 0-Live 0xf8d78000
Freq_table 4740 2 speedstep_centrino, cpufreq_stats, Live 0xf8d75000
Cpufreq_powersave 1920 0-Live 0xf8c81000
Cpufreq_ondemand 6428 0-Live 0xf8d72000
Cpufreq_conservative 7332 0-Live 0xf8d6f000
Video 16260 0-Live 0xf8cc6000
Tc1100_wmi 6916 0-Live 0xf8d68000
Sony_acpi 5644 0-Live 0xf8d59000
Pcc_acpi 12416 0-Live 0xf8d63000
Hot Key 11556 0-Live 0xf8d55000
Dev_acpi 11140 0-Live 0xf8cee000
Container 4608 0-Live 0xf8ccf000
Button 6672 0-Live 0xf8cb4000
Acpi_sbs 19980 0-Live 0xf8d5d000
Battery 9988 1 acpi_sbs, Live 0xf8ccb000
Ac 5252 1 acpi_sbs, Live 0xf8cc3000
I2c_acpi_ec 5120 1 acpi_sbs, Live 0xf8cb7000
I2c_core 21904 1 i2c_acpi_ec, Live 0xf8cbc000
Nls_utf8 2176 2-Live 0xf8ad2000
Ntfs 103536 2-Live 0xf8cd3000
Nls_iso8859_1 4224 1-Live 0xf8c6d000
Nls_cp437 5888 1-Live 0xf8b16000
Vfat 13440 1-Live 0xf8b11000
Fat 53020 1 vfat, Live 0xf8ca6000
Ipv6 265728 6-Live 0xf8cf2000
Dm_mod 58936 1-Live 0xf8c96000
Md_mod 72532 0-Live 0xf8c83000
Lp 11844 0-Live 0xf8949000
Af_packet 22920 2-Live 0xf8ad8000
Wlan_wep 6912 1-Live 0xf8ac1000
Tg3 101764 0-Live 0xf8b19000
Pcmcia 40508 0-Live 0xf8af1000
Joydev 10048 0-Live 0xf8acc000
Rtc 13492 0-Live 0xf8ac7000
Tsdev 8000 0-Live 0xf8915000
Pcspkr 2180 0-Live 0xf89fc000
Yenta_socket 28428 3-Live 0xf8aac000
Rsrc_nonstatic 13440 1 yenta_socket, Live 0xf8aa7000
Pcmcia_core 42640 3 pcmcia, yenta_socket, rsrc_nonstatic, Live 0xf8ab5000
Floppy 62148 0-Live 0xf8a1f000
Parport_pc 35780 1-Live 0xf8a9d000
Parport 36296 3 ppdev, lp, parport_pc, Live 0xf8a93000
Usbhid 39904 0-Live 0xf8a09000
Psmouse 36100 0-Live 0xf8a15000
Serio_raw 7300 0-Live 0xf894d000
Ath_pci 80540 0-Live 0xf8a7e000
Ath_rate_sample 17160 1 ath_pci, Live 0xf89f3000
Wlan 144924 4 wlan_wep, ath_pci, ath_rate_sample, Live 0xf8a59000
Ath_hal 148816 3 ath_pci, ath_rate_sample, Live 0xf8a33000
Snd_intel8x0 33692 4-Live 0xf89ff000
Snd_ac97_codec 93216 1 snd_intel8x0, Live 0xf89c1000
Snd_ac97_bus 2304 1 snd_ac97_codec, Live 0xf88ca000
Snd_pcm_oss 53664 0-Live 0xf8970000
Snd_mixer_oss 18688 1 snd_pcm_oss, Live 0xf896a000
Snd_pcm 89864 4 snd_intel8x0, snd_ac97_codec, snd_pcm_oss, Live 0xf89dc000
Snd_timer 25220 3 snd_pcm, Live 0xf8952000
Snd 55268 11 snd_intel8x0, snd_ac97_codec, snd_pcm_oss, snd_mixer_oss, snd_pcm, snd_timer, Live 0xf895b000
Soundcore 10208 1 snd, Live 0xf8911000
Snd_page_alloc 10632 2 snd_intel8x0, snd_pcm, Live 0xf890d000
Shpchp 45632 0-Live 0xf8918000
Pci_hotplug 29236 1 shpchp, Live 0xf88ba000
Intel_agp 22940 1-Live 0xf88c3000
Agpgart 34888 2 drm, intel_agp, Live 0xf88fe000
Evdev 9856 2-Live 0xf888d000
Ext3 135816 2-Live 0xf8926000
Jbd 58772 1 ext3, Live 0xf88ee000
Ide_generic 1536 0-Live 0xf8886000
Ehci_hcd 34184 0-Live 0xf88b0000
Uhci_hcd 33808 0-Live 0xf88a6000
Usbcore 130820 4 usbhid, ehci_hcd, uhci_hcd, Live 0xf88cd000
Ide_cd 33028 0-Live 0xf889c000
Cdrom 38560 1 ide_cd, Live 0xf8891000
Ide_disk 17664 7-Live 0xf886e000
Piix 11012 1-Live 0xf8880000
Generic 5124 0-Live 0xf886b000
Thermal13576 0-Live 0xf887b000
Processor 23360 2 speedstep_centrino, thermal, Live 0xf8874000
Fan 4868 0-Live 0xf8868000
Capability 5000 0-Live 0xf8865000
Commoncap 7296 1 capability, Live 0xf880a000
Vga16fb 13704 1-Live 0xf8846000
Vgastate 10368 1 vga16fb, Live 0xf882e000
Fbcon 42784 72-Live 0xf883a000
Tileb00002816 1 fbcon, Live 0xf8806000
Font 8320 1 fbcon, Live 0xf882a000
Bitb00006272 1 fbcon, Live 0xf880d000
Softcursor 2304 1 bitbits, Live 0xf8808000
D7e000
Cpufreq_userspace 4696 1-Live 0xf8d7b000
Cpufreq_stats 5636 0-Live 0xf8d78000
Freq_table 4740 2 speedstep_centrino, cpufreq_stats, Live 0xf8d75000
Cpufreq_powersave 1920 0-Live 0xf8c81000
Cpufreq_ondemand 6428 0-Live 0xf8d72000
Cpufreq_conservative 7332 0-Live 0xf8d6f000
Video 16260 0-Live 0xf8cc6000
Tc1100_wmi 6916 0-Live 0xf8d68000
Sony_acpi 5644 0-Live 0xf8d59000
Pcc_acpi 12416 0-Live 0xf8d63000
Hot Key 11556 0-Live 0xf8d55000
Dev_acpi 11140 0-Live 0xf8cee000
Container 4608 0-Live 0xf8ccf000
Button 6672 0-Live 0xf8cb4000
Acpi_sbs 19980 0-Live 0xf8d5d000
Battery 9988 1 acpi_sbs, Live 0xf8ccb000
Ac 5252 1 acpi_sbs, Live 0xf8cc3000
I2c_acpi_ec 5120 1 acpi_sbs, Live 0xf8cb7000
I2c_core 21904 1 i2c_acpi_ec, Live 0xf8cbc000
Nls_utf8 2176 2-Live 0xf8ad2000
Ntfs 103536 2-Live 0xf8cd3000
Nls_iso8859_1 4224 1-Live 0xf8c6d000
Nls_cp437 5888 1-Live 0xf8b16000
Vfat 13440 1-Live 0xf8b11000
Fat 53020 1 vfat, Live 0xf8ca6000
Ipv6 265728 6-Live 0xf8cf2000
Dm_mod 58936 1-Live 0xf8c96000
Md_mod 72532 0-Live 0xf8c83000
Lp 11844 0-Live 0xf8949000
Af_packet 22920 2-Live 0xf8ad8000
Wlan_wep 6912 1-Live 0xf8ac1000
Tg3 101764 0-Live 0xf8b19000
Pcmcia 40508 0-Live 0xf8af1000
Joydev 10048 0-Live 0xf8acc000
Rtc 13492 0-Live 0xf8ac7000
Tsdev 8000 0-Live 0xf8915000
Pcspkr 2180 0-Live 0xf89fc000
Yenta_socket 28428 3-Live 0xf8aac000
Rsrc_nonstatic 13440 1 yenta_socket, Live 0xf8aa7000
Pcmcia_core 42640 3 pcmcia, yenta_socket, rsrc_nonstatic, Live 0xf8ab5000
Floppy 62148 0-Live 0xf8a1f000
Parport_pc 35780 1-Live 0xf8a9d000
Parport 36296 3 ppdev, lp, parport_pc, Live 0xf8a93000
Usbhid 39904 0-Live 0xf8a09000
Psmouse 36100 0-Live 0xf8a15000
Serio_raw 7300 0-Live 0xf894d000
Ath_pci 80540 0-Live 0xf8a7e000
Ath_rate_sample 17160 1 ath_pci, Live 0xf89f3000
Wlan 144924 4 wlan_wep, ath_pci, ath_rate_sample, Live 0xf8a59000
Ath_hal 148816 3 ath_pci, ath_rate_sample, Live 0xf8a33000
Snd_intel8x0 33692 4-Live 0xf89ff000
Snd_ac97_codec 93216 1 snd_intel8x0, Live 0xf89c1000
Snd_ac97_bus 2304 1 snd_ac97_codec, Live 0xf88ca000
Snd_pcm_oss 53664 0-Live 0xf8970000
Snd_mixer_oss 18688 1 snd_pcm_oss, Live 0xf896a000
Snd_pcm 89864 4 snd_intel8x0, snd_ac97_codec, snd_pcm_oss, Live 0xf89dc000
Snd_timer 25220 3 snd_pcm, Live 0xf8952000
Snd 55268 11 snd_intel8x0, snd_ac97_codec, snd_pcm_oss, snd_mixer_oss, snd_pcm, snd_timer, Live 0xf895b000
Soundcore 10208 1 snd, Live 0xf8911000
Snd_page_alloc 10632 2 snd_intel8x0, snd_pcm, Live 0xf890d000
Shpchp 45632 0-Live 0xf8918000
Pci_hotplug 29236 1 shpchp, Live 0xf88ba000
Intel_agp 22940 1-Live 0xf88c3000
Agpgart 34888 2 drm, intel_agp, Live 0xf88fe000
Evdev 9856 2-Live 0xf888d000
Ext3 135816 2-Live 0xf8926000
Jbd 58772 1 ext3, Live 0xf88ee000
Ide_generic 1536 0-Live 0xf8886000
Ehci_hcd 34184 0-Live 0xf88b0000
Uhci_hcd 33808 0-Live 0xf88a6000
Usbcore 130820 4 usbhid, ehci_hcd, uhci_hcd, Live 0xf88cd000
Ide_cd 33028 0-Live 0xf889c000
Cdrom 38560 1 ide_cd, Live 0xf8891000
Ide_disk 17664 7-Live 0xf886e000
Piix 11012 1-Live 0xf8880000
Generic 5124 0-Live 0xf886b000
Thermal13576 0-Live 0xf887b000
Processor 23360 2 speedstep_centrino, thermal, Live 0xf8874000
Fan 4868 0-Live 0xf8868000
Capability 5000 0-Live 0xf8865000
Commoncap 7296 1 capability, Live 0xf880a000
Vga16fb 13704 1-Live 0xf8846000
Vgastate 10368 1 vga16fb, Live 0xf882e000
Fbcon 42784 72-Live 0xf883a000
Tileb00002816 1 fbcon, Live 0xf8806000
Font 8320 1 fbcon, Live 0xf882a000
Bitb00006272 1 fbcon, Live 0xf880d000
Softcursor 2304 1 bitbits, Live 0xf8808000
We can see that the execution results of these two commands are consistent.

2,
Modinfo:
Modinfo can view the module information and determine the purpose of the module by viewing the module information;
Ty @ tonylinux :~ $ Modinfo bluetooth
Filename:/lib/modules/2.6.15-27-386/kernel/net/bluetooth. ko
Author: Maxim kranyansky , Marcel Holtmann
Description: Bluetooth Core ver 2.8
Version: 2.8
License: GPL
Alias: net-pf-31
Vermagic: 2.6.15-27-386 preempt 486 gcc-4.0
Depends:
Srcversion: 7EE5558C84FD3DB2B68971C

3,
Modprobe mounts new modules and modules dependent on the new modules
The common function of modprobe is to mount a module. When a kernel module is mounted, the modules on which this module depends are also mounted. This is different from the insmod Mount module. Of course, modprobe also provides a list of all kernel modules, as well as the function of removing modules. Next we will give an example to illustrate our common functions and parameters;
Modprobe-c
Odprobe-c can view the modules configuration file, such as the module alias;
Modprobe-l is used to list all modules in the kernel, including mounted and unmounted modules. Through modprobe-l, we can view the modules we need and mount them according to our needs;
[Root @ localhost beinan] # modprobe Module name Note: mount a module;
Root @ localhost beinan] # modprobe-r module name Note: Remove loaded modules, which have the same functions as rmmod;

4,
Rmmod remove mounted modules
Rmmod Module name

5. depmod: List of module dependencies created
This module management tool is used to create a list of module dependencies. Just pay attention to a few parameters. Currently, the Linux release uses the kernel version 2.6x to automatically resolve dependencies, this command is fine. The module also has dependencies before. For example, if we want to drive a USB mobile hard disk, there are currently two types of drivers: udev, which are available in the kernel, however, it is not stable at present. Another method is to use the usb-storage driver, while the usb-storage depends on the scsi module. Therefore, we need to use the usb-storage module, install scsi.
This command creates a dependency for the modules. dep file or ing file. The modules. dep file is located in/lib/modules/2.6.15-27-i386. This is the directory file of my computer.

6. insmod mounting Module
The insmod tool is a bit similar to modprobe, but it does not have a strong modprobe function. In the Mount module, modprobe does not need to specify the path of the module file or the suffix of the file. o or. ko; what insmod needs is the absolute path of the directory where the module is located, and must contain the module File name suffix (modulefile. o or modulesfile. ko );
[Root @ localhost beinan] # insmod/lib/modules/2.6.11-1.1369 _ FC4/kernel/drivers/net/tg3.ko

Module configuration file modules. conf or modprobe. conf
The automatic mounting module of the kernel module is usually located in a configuration file. The common Linux releases all have/etc/modules. conf or/etc/modprobe. conf. For example, the file automatically loaded by the Fedora Core 4.0 kernel module upon startup is/etc/modprobe. conf; in this file, it is generally written to the module's load command or module alias definition. For example, in modules. A similar line may be released in conf;

The driver for source code compilation is generally. /configure; make install, sometimes the program does not provide. /configure, we can make or make install, or execute make; make install; if you cannot make install, We need to copy it by ourselves. o or. go to the/lib/modules/kernel version/kernel/directory or the corresponding driver directory in the/lib/modules/kernel version/kernel/drivers directory;

I 'd like to try it myself. I can't say it clearly. I will know how to solve the problem. The driver's REAME and INSTALL will prevail.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.