Difference between revisions of "Linux drivers generalities"

From ArmadeusWiki
Jump to: navigation, search
(creation)
 
(be more accurate)
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:
+
When compiled as "static" (<*> in Linux menuconfig) they are integrated in the Linux image (''buildroot/binaries/armadeus/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, the 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
 
  # modprobe fpga_loader
 
or  
 
or  
 
  # insmod /lib/modules/drivers/armadeus/fpga/fpga_loader.ko
 
  # insmod /lib/modules/drivers/armadeus/fpga/fpga_loader.ko
  
modprobe knows where to find the correspondig .ko file and find all its dependancies thanks to the ''/etc/modules.dep'' file
+
''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_arm/armadeus/root/lib/modules/2.6.2x/modules.dep''.

Revision as of 09:40, 18 October 2008

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

What

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)

When compiled as "static" (<*> in Linux menuconfig) they are integrated in the Linux image (buildroot/binaries/armadeus/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, the 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/drivers/armadeus/fpga/fpga_loader.ko

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_arm/armadeus/root/lib/modules/2.6.2x/modules.dep.