Difference between revisions of "Linux drivers generalities"
(be more accurate) |
m (→What) |
||
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) | ||
+ | ==How to use them== | ||
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 "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). | ||
Line 14: | Line 15: | ||
# insmod /lib/modules/drivers/armadeus/fpga/fpga_loader.ko | # insmod /lib/modules/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_arm/armadeus/root/lib/modules/2.6.2x/modules.dep''. | ''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''. | ||
+ | All modules are located in ''/lib/modules/drivers/'' subdirectories on your target and ''buildroot/project_build_arm/armadeus/root/lib/modules/drivers'' on your Host. |
Revision as of 10:45, 19 October 2008
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/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
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_arm/armadeus/root/lib/modules/2.6.2x/modules.dep. All modules are located in /lib/modules/drivers/ subdirectories on your target and buildroot/project_build_arm/armadeus/root/lib/modules/drivers on your Host.