Difference between revisions of "Linux drivers generalities"

From ArmadeusWiki
Jump to: navigation, search
(creation)
 
m (Where should I copy modules ?)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
This page summarizes all the important things to know when talking about Linux drivers in general.
 
This page summarizes all the important things to know when talking about Linux drivers in general.
  
==What==
+
==What are they ?==
 
Linux drivers are the piece of code running inside the kernel itself that are assigned to a specific peripheral driving.
 
Linux drivers are the piece of code running inside the kernel itself that are assigned to a specific peripheral driving.
 
They can exist in 2 forms:
 
They can exist in 2 forms:
Line 7: Line 7:
 
* or they can be compiled as loadable modules (the famous .ko files)
 
* or they can be compiled as loadable modules (the famous .ko files)
  
When compiled as module (<M> in linux menuconfig) they can be dynamically loaded at runtime, when necessary. For example if you need to load the FPGA at a particular time you can do a:
+
==How to use them==
 +
When compiled as "static" ('''<*>''', in Linux menuconfig) they are integrated in the Linux image (''buildroot/binaries/apfxx/linux-kernel-2.6.xx-arm.bin''), so when you reflash your kernel, the driver are immediately available. But if you don't use them, they consume some place in memory (RAM).
 +
 
 +
When compiled as "module" ('''<M>''', in Linux menuconfig) they can be dynamically loaded at runtime, when necessary. For example if you need to load the FPGA at a particular time you can do a:
 +
<pre class="apf">
 
  # modprobe fpga_loader
 
  # modprobe fpga_loader
 +
</pre>
 
or  
 
or  
  # insmod /lib/modules/drivers/armadeus/fpga/fpga_loader.ko
+
<pre class="apf">
 +
  # insmod /lib/modules/2.6.xx/drivers/armadeus/fpga/fpga_loader.ko
 +
</pre>
 +
 
 +
==Where should I copy modules ?==
 +
''modprobe'' knows where to find the corresponding .ko file and find all its dependencies thanks to the ''/lib/modules/2.6.2x/modules.dep'' file. So If you compile new drivers as module and copy them on your board "manually" (ie TFTP or NFS), don't forget to update ''/lib/modules/2.6.2x/modules.dep'' too. On your Host this file can be found in ''buildroot/project_build_armvxx/apfxx/root/lib/modules/2.6.2x/modules.dep''.
 +
All modules are located in ''/lib/modules/2.6.xx/drivers/'' subdirectories on your target and ''buildroot/project_build_armvxx/apfxx/root/lib/modules/drivers'' on your Host.
  
modprobe knows where to find the correspondig .ko file and find all its dependancies thanks to the ''/etc/modules.dep'' file
+
[[Category:Linux drivers]]

Latest revision as of 22:42, 11 June 2009

This page summarizes all the important things to know when talking about Linux drivers in general.

What are they ?

Linux drivers are the piece of code running inside the kernel itself that are assigned to a specific peripheral driving. They can exist in 2 forms:

  • they can be statically linked to the kernel image. In that case we refer to static drivers
  • or they can be compiled as loadable modules (the famous .ko files)

How to use them

When compiled as "static" (<*>, in Linux menuconfig) they are integrated in the Linux image (buildroot/binaries/apfxx/linux-kernel-2.6.xx-arm.bin), so when you reflash your kernel, the driver are immediately available. But if you don't use them, they consume some place in memory (RAM).

When compiled as "module" (<M>, in Linux menuconfig) they can be dynamically loaded at runtime, when necessary. For example if you need to load the FPGA at a particular time you can do a:

 # modprobe fpga_loader

or

 # insmod /lib/modules/2.6.xx/drivers/armadeus/fpga/fpga_loader.ko

Where should I copy modules ?

modprobe knows where to find the corresponding .ko file and find all its dependencies thanks to the /lib/modules/2.6.2x/modules.dep file. So If you compile new drivers as module and copy them on your board "manually" (ie TFTP or NFS), don't forget to update /lib/modules/2.6.2x/modules.dep too. On your Host this file can be found in buildroot/project_build_armvxx/apfxx/root/lib/modules/2.6.2x/modules.dep. All modules are located in /lib/modules/2.6.xx/drivers/ subdirectories on your target and buildroot/project_build_armvxx/apfxx/root/lib/modules/drivers on your Host.