Location for Linux kernel module support files
I have written a device driver (module) that needs a configuration file. Where is the standard place to put such files?
I originally put it in the same directory as the .o file but 'depmod -a' complains that it's not an ELF file.
--
Tim Moloney
ManTech Real-time Systems Laboratory
2015 Cattlemen Road \ /
Sarasota, FL 34232 .________\(O)/________.
(941) 377-6775 x208 ' ' O(.)O ' '
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Quoted 3 lines · Tim Moloney
I have written a device driver (module) that needs a configuration file. Where is the standard place to put such files?
There isn't. Device drivers, being part of the kernel, should not be reading random files from the user's file system. If the driver needs configuration, the normal method is for userland scripts (either startup or hotplug) to issue commands to poke the configuration into the driver at runtime.
Quoted 2 lines
I originally put it in the same directory as the .o file but 'depmod -a' complains that it's not an ELF file.
--
David Gibson | For every complex problem there is a
[email protected] | solution which is simple, neat and
| wrong.
http://www.ozlabs.org/people/dgibson
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Quoted 13 lines · David Gibson
Quoted 2 lines · Tim Moloney
I have written a device driver (module) that needs a configuration file. Where is the standard place to put such files?
There isn't. Device drivers, being part of the kernel, should not be reading random files from the user's file system. If the driver needs configuration, the normal method is for userland scripts (either startup or hotplug) to issue commands to poke the configuration into the driver at runtime.
Quoted 2 lines
I originally put it in the same directory as the .o file but 'depmod -a' complains that it's not an ELF file.
The file the device driver needs is an FPGA program file that
- is data that I don't want compiled into the driver wasting space
- will initially be specified when the driver is loaded via rc script
- that can be reloaded by a program to customize it for a particular application
I know that this isn't a a typical situation and I have only seen one other device driver like this. It is a 1553 driver that creates a /usr/lib/<module_name> directory for its configuration file. Is there a better location?
--
Tim Moloney
ManTech Real-time Systems Laboratory
2015 Cattlemen Road \ /
Sarasota, FL 34232 .________\(O)/________.
(941) 377-6775 x208 ' ' O(.)O ' '
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Quoted 20 lines · Tim Moloney
Quoted 12 lines · David Gibson
Quoted 2 lines · Tim Moloney
I have written a device driver (module) that needs a configuration file. Where is the standard place to put such files?
There isn't. Device drivers, being part of the kernel, should not be reading random files from the user's file system. If the driver needs configuration, the normal method is for userland scripts (either startup or hotplug) to issue commands to poke the configuration into the driver at runtime.
Quoted 2 lines
I originally put it in the same directory as the .o file but 'depmod -a' complains that it's not an ELF file.
The file the device driver needs is an FPGA program file that
- is data that I don't want compiled into the driver wasting space
- will initially be specified when the driver is loaded via rc script
- that can be reloaded by a program to customize it for a particular application
Quoted 4 lines
I know that this isn't a a typical situation and I have only seen one other device driver like this. It is a 1553 driver that creates a /usr/lib/<module_name> directory for its configuration file. Is there a better location?
So your kernel driver should create a /proc entry where the rc script can write the FPGA program file to after insmod.
If the FPGA program file is to be reloaded by the application, it can just write the new data to the same /proc entry.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/