Where to call my init() from (without LKM)?

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Sun Aug 4 13:21:55 EDT 2013


On Sun, 04 Aug 2013 10:40:42 +0100, George White said:

> Most of my code is implemented in a new file I created  under /kernel/
> myfile.c and added in the main Makefile (other parts of the code are spread
> around the existing code as edits).

> Question A:  Is that a good idea? Alternatives?

Convince us it should be under kernel/ and not elsewhere in the tree.

> Question B: Where is the best place to I call this init function from?

There's a nice 'initcall' infrastructure which will get your code called during
system boot.  You even have some control over *when* it gets called (early, or
with other devices, or other kernel code, or late).

> Question C: Is using procfs the best option for setting up config options 

Probably not.  sysfs exists for a reason.  Also, depending on what the
code does and when it needs to initialize, procfs may not be an option (if
you have to touch the vallue before userspace gets cranking, it won't work
and you need to use a kernel commandline option).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130804/a5f32201/attachment.bin 


More information about the Kernelnewbies mailing list