linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Location for Linux kernel module support files
@ 2002-09-30 15:46 Tim Moloney
  2002-10-01  0:32 ` David Gibson
  0 siblings, 1 reply; 9+ messages in thread
From: Tim Moloney @ 2002-09-30 15:46 UTC (permalink / raw)
  To: linuxppc-dev


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/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Location for Linux kernel module support files
  2002-09-30 15:46 Tim Moloney
@ 2002-10-01  0:32 ` David Gibson
  2002-10-01 14:33   ` Tim Moloney
  0 siblings, 1 reply; 9+ messages in thread
From: David Gibson @ 2002-10-01  0:32 UTC (permalink / raw)
  To: linuxppc-dev


On Mon, Sep 30, 2002 at 11:46:22AM -0400, Tim Moloney wrote:
>
> 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.

> 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
david@gibson.dropbear.id.au	| 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/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Location for Linux kernel module support files
  2002-10-01  0:32 ` David Gibson
@ 2002-10-01 14:33   ` Tim Moloney
  2002-10-01 16:25     ` Geert Uytterhoeven
  0 siblings, 1 reply; 9+ messages in thread
From: Tim Moloney @ 2002-10-01 14:33 UTC (permalink / raw)
  To: linuxppc-dev


David Gibson wrote:

> On Mon, Sep 30, 2002 at 11:46:22AM -0400, Tim Moloney wrote:
>
>>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.
>
>>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/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Location for Linux kernel module support files
  2002-10-01 14:33   ` Tim Moloney
@ 2002-10-01 16:25     ` Geert Uytterhoeven
  0 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2002-10-01 16:25 UTC (permalink / raw)
  To: Tim Moloney; +Cc: Linux/PPC Development


On Tue, 1 Oct 2002, Tim Moloney wrote:
> David Gibson wrote:
> > On Mon, Sep 30, 2002 at 11:46:22AM -0400, Tim Moloney wrote:
> >>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.
> >
> >>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?

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 -- geert@linux-m68k.org

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/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Location for Linux kernel module support files
@ 2002-10-01 17:07 Eugene Surovegin
  2002-10-01 19:06 ` Tim Moloney
  0 siblings, 1 reply; 9+ messages in thread
From: Eugene Surovegin @ 2002-10-01 17:07 UTC (permalink / raw)
  To: linuxppc-dev


Tim,

At 07:33 AM 10/1/2002, you wrote:

>David Gibson wrote:
>
>>On Mon, Sep 30, 2002 at 11:46:22AM -0400, Tim Moloney wrote:
>>
>>>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.
>>
>>>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?

For similar situation (I also need to load FPGA on our custom board) I just
coded
a simple "char" device (e.g. /dev/fpga).
User mode program or simple script writes into this device and
the driver sends this data to the PLD chip.

For debugging I use something like
     # cp fpga.bin /dev/fpga

With this design driver itself doesn't have any knowledge about particular
location of
the FPGA program.

Thanks,

  Eugene Surovegin <mailto:ebs@innocent.com>


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Location for Linux kernel module support files
  2002-10-01 17:07 Location for Linux kernel module support files Eugene Surovegin
@ 2002-10-01 19:06 ` Tim Moloney
  2002-10-02  3:25   ` Michael Heironimus
                     ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Tim Moloney @ 2002-10-01 19:06 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Eugene Surovegin, geert


Tim Moloney wrote:

> 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?

Eugene Surovegin wrote:

> For similar situation (I also need to load FPGA on our custom board) I just
> coded
> a simple "char" device (e.g. /dev/fpga).
> User mode program or simple script writes into this device and
> the driver sends this data to the PLD chip.
>
> For debugging I use something like
>     # cp fpga.bin /dev/fpga
>
> With this design driver itself doesn't have any knowledge about particular
> location of
> the FPGA program.

Geert Uytterhoeven wrote:

 > 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.

I do something like this now but neither of these answer *where* to put
the file that is being copied to the /proc entry.

I want to distribute a standard FPGA program file with the module and
have it loaded at system boot time.  I can create an rc script to copy
this file to the /proc entry.  I can package the module, rc script, and
FPGA file in an RPM.  I just need to determine a reasonable location for
the FPGA file (since I know where to put the module and rc script).

The custom FPGA files can be distributed with their respective
applications and can be packaged in RPMs.

Perhaps there is no good answer to this.  I thought that this situation
happened enough that people had found a reasonable location for support
files.

--
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/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Location for Linux kernel module support files
  2002-10-01 19:06 ` Tim Moloney
@ 2002-10-02  3:25   ` Michael Heironimus
  2002-10-02  7:54   ` Ethan Benson
  2002-10-02  8:06   ` Geert Uytterhoeven
  2 siblings, 0 replies; 9+ messages in thread
From: Michael Heironimus @ 2002-10-02  3:25 UTC (permalink / raw)
  To: linuxppc-dev


On Tue, Oct 01, 2002 at 03:06:03PM -0400, Tim Moloney wrote:
> Perhaps there is no good answer to this.  I thought that this situation
> happened enough that people had found a reasonable location for support
> files.

Support files required at boot time should probably go somewhere under
/etc or /lib, since those are more or less guaranteed to be mounted.
Other common locations for support files are /usr/lib or /usr/share, but
for something running at boot you may be faced with /usr not being
mounted yet.

--
Michael Heironimus

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Location for Linux kernel module support files
  2002-10-01 19:06 ` Tim Moloney
  2002-10-02  3:25   ` Michael Heironimus
@ 2002-10-02  7:54   ` Ethan Benson
  2002-10-02  8:06   ` Geert Uytterhoeven
  2 siblings, 0 replies; 9+ messages in thread
From: Ethan Benson @ 2002-10-02  7:54 UTC (permalink / raw)
  To: linuxppc-dev


On Tue, Oct 01, 2002 at 03:06:03PM -0400, Tim Moloney wrote:
> I want to distribute a standard FPGA program file with the module and
> have it loaded at system boot time.  I can create an rc script to copy
> this file to the /proc entry.  I can package the module, rc script, and
> FPGA file in an RPM.  I just need to determine a reasonable location for
> the FPGA file (since I know where to put the module and rc script).
>
> The custom FPGA files can be distributed with their respective
> applications and can be packaged in RPMs.
>
> Perhaps there is no good answer to this.  I thought that this situation
> happened enough that people had found a reasonable location for support
> files.

http://www.pathname.com/fhs/

if its not a configuration file which is intended to be edited by the
admin then it does NOT belong in /etc.  if its a architecture specific
file, but not a command executable then it belongs in /usr/lib unless
its required before filesystems are mounted in which cases it belongs
in /lib.

if its a architecture independent, non-executable file then it belongs
in /usr/share

the /lib /usr/lib and /usr/share cases indicate a subdirectory since
its not a actual shared library.

your Makefile make install step should install things in
/usr/local/lib or /usr/local/share (agian unless this is required to
get filesystems mounted, in that case it has to go in /lib).  debian
packages or rpms would install things under /usr/lib.

--
Ethan Benson
http://www.alaska.net/~erbenson/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Location for Linux kernel module support files
  2002-10-01 19:06 ` Tim Moloney
  2002-10-02  3:25   ` Michael Heironimus
  2002-10-02  7:54   ` Ethan Benson
@ 2002-10-02  8:06   ` Geert Uytterhoeven
  2 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2002-10-02  8:06 UTC (permalink / raw)
  To: Tim Moloney; +Cc: Linux/PPC Development, Eugene Surovegin


On Tue, 1 Oct 2002, Tim Moloney wrote:
> Tim Moloney wrote:
> > 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?
>
> Eugene Surovegin wrote:
> > For similar situation (I also need to load FPGA on our custom board) I just
> > coded
> > a simple "char" device (e.g. /dev/fpga).
> > User mode program or simple script writes into this device and
> > the driver sends this data to the PLD chip.
> >
> > For debugging I use something like
> >     # cp fpga.bin /dev/fpga
> >
> > With this design driver itself doesn't have any knowledge about particular
> > location of
> > the FPGA program.
>
> Geert Uytterhoeven wrote:
>  > 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.
>
> I do something like this now but neither of these answer *where* to put
> the file that is being copied to the /proc entry.
>
> I want to distribute a standard FPGA program file with the module and
> have it loaded at system boot time.  I can create an rc script to copy
> this file to the /proc entry.  I can package the module, rc script, and
> FPGA file in an RPM.  I just need to determine a reasonable location for
> the FPGA file (since I know where to put the module and rc script).
>
> The custom FPGA files can be distributed with their respective
> applications and can be packaged in RPMs.
>
> Perhaps there is no good answer to this.  I thought that this situation
> happened enough that people had found a reasonable location for support
> files.

IC. I think it should be in /usr/lib/<your-package-name>/.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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/

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2002-10-02  8:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-01 17:07 Location for Linux kernel module support files Eugene Surovegin
2002-10-01 19:06 ` Tim Moloney
2002-10-02  3:25   ` Michael Heironimus
2002-10-02  7:54   ` Ethan Benson
2002-10-02  8:06   ` Geert Uytterhoeven
  -- strict thread matches above, loose matches on Subject: below --
2002-09-30 15:46 Tim Moloney
2002-10-01  0:32 ` David Gibson
2002-10-01 14:33   ` Tim Moloney
2002-10-01 16:25     ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).