Skip to contentSkip to conversation

System calls effect after booting phase ??

DISCUSSION selvakumar nagendran 2 participants 4 messages Dec 29, 2004 – Jan 21, 2005

lore
Share & tools
lore
#0 lore raw

Hi,
I intercepted a few system calls pertaining to file
operations like open,close,pipe etc. Now, I implemented this stuff in a loadable kernel module. I am collecting some data from it like which process currently access a pipe,file etc. I have displayed them using printk.
Now, I want to store them in a table. But I want
this operation to be started right after the initial booting phase itself part of the loading kernel itself. What should I do to add my module into the already compiled kernel image just like a standard kernel module?

Thanks,
selva

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

#1 lore raw
Quoted 6 lines · selvakumar nagendran

Now, I want to store them in a table. But I want
this operation to be started right after the initial booting phase itself part of the loading kernel itself. What should I do to add my module into the already compiled kernel image just like a standard kernel module?

Possibility 1:
Load them from an initrd image while booting. If you're already using an initrd, and this is "early enough", you just need to put the module into the initrd, and make sure the /linuxrc or whatever script does an insmod for it. This has the advantage of working for out-of-tree modules.

Possibility 2:
Build them into the kernel. For in-tree modules, this is done with a bit of Kconfig/Makefile magic. In the Kconfig file, you can define a CONFIG_FOO variable, and then in the Makefile, do this:

obj-$(CONFIG_FOO) += foo.o

So if CONFIG_FOO is set to 'y' (build into kernel), it gets added to the obj-y target list and then linked in. If it's set to 'm' (module) or 'n' (don't build at all), it's added to the obj-m or obj-n targets, which then aren't linked into the kernel.

Not sure how you'd go about building an out-of-tree module into the kernel, or if that's even supposed to be possible...

#2 lore raw

Thank u for the help,

In the kconfig.tk file, under which section
should we add the line CONFIG_FOO. Will u plz
elaborate the process?

Thanks,
selva

Quoted 40 lines · --- [email protected] wrote:
Quoted 2 lines · selvakumar nagendran

Now, I want to store them in a table. But I want
this operation to be started right after the

initial

Quoted 4 lines

booting phase itself part of the loading kernel itself. What should I do to add my module into the already compiled kernel image just like a standard kernel module?

Possibility 1:
Load them from an initrd image while booting. If you're already
using an initrd, and this is "early enough", you just need to put the
module into the initrd, and make sure the /linuxrc or whatever script
does an insmod for it. This has the advantage of working for out-of-tree
modules.

Possibility 2:
Build them into the kernel. For in-tree modules, this is done with
a bit of Kconfig/Makefile magic. In the Kconfig file, you can define
a CONFIG_FOO variable, and then in the Makefile, do this:

obj-$(CONFIG_FOO) += foo.o

So if CONFIG_FOO is set to 'y' (build into kernel), it gets
added to the obj-y target list and then linked in. If it's set to
'm' (module) or 'n' (don't build at all), it's added to the obj-m or obj-n
targets, which then aren't linked into the kernel.

Quoted 6 lines

Not sure how you'd go about building an out-of-tree module into the kernel,
or if that's even supposed to be possible...

ATTACHMENT part 2 application/pgp-signature

__________________________________
Do you Yahoo!?
The all-new My Yahoo! - Get yours free!
http://my.yahoo.com

#3 lore raw
In reply to [email protected]
Quoted 10 lines · --- [email protected] wrote:

Possibility 1:
Load them from an initrd image while booting. If you're already
using an initrd, and this is "early enough", you just need to put the
module into the initrd, and make sure the /linuxrc or whatever script
does an insmod for it. This has the advantage of working for out-of-tree
modules.

Now, I am using an initrd image. How can I load my
module there? In which file, should I insert the corresponding line? Can u tell me more regarding this on how to do it? I am using kernel 2.4.28. should I have to recompile the whole kernel once again?

Thanks,
selva

__________________________________
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today!
http://my.yahoo.com