By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,171 Members | 1,020 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,171 IT Pros & Developers. It's quick & easy.

kernel module: beginner

P: n/a
hi.. I m new to kernel programming..for my in-house project, I chose
to create a device driver for mouse for which I am required to
understand Kernel module programming..I tried to execute this small
module ..though it is getting complied but after trying hard with
insmod and makefile commands.. I am still not able to execute it..

Below is my program written on localhost in linux version 2.4.20-8

#define MODULE
#include <linux/module.h>

int init_module()
{
printk("init_module invokded\ n");
printk("the message is printed from the kernel space\n");
return 0;
}
void cleanup_module()
{printk("cleanup_module invoked\n");
printk("module is now going to be unloaded from kernel \n");
}

[student@localhost student]$ gcc -c simple.c
simple.c:6:8: warning: unknown escape sequence: '\040'

[student@localhost student]$ insmod simple.c
bash: insmod: command not found

Please help me out ... looking forward to your reply.
Thanx

Jun 28 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
h.********@gmail.com wrote:
hi.. I m new to kernel programming..for my in-house project, I chose
to create a device driver for mouse for which I am required to
understand Kernel module programming..I tried to execute this small
module ..though it is getting complied but after trying hard with
insmod and makefile commands.. I am still not able to execute it..

You should take this to a Linux kernel group, it's off topic here.

--
Ian Collins.
Jun 28 '06 #2

P: n/a
Ian Collins wrote:
h.********@gmail.com wrote:
hi.. I m new to kernel programming..for my in-house project, I chose
to create a device driver for mouse for which I am required to
understand Kernel module programming..I tried to execute this small
module ..though it is getting complied but after trying hard with
insmod and makefile commands.. I am still not able to execute it..

You should take this to a Linux kernel group, it's off topic here.


Actually I think this is a C question, the gcc warning suggests
the problem is the space after '\':
printk("init_module invokded\ n");

I'd guess the OP meant '\n' (and "invoked" too). Get good at typing
(and reviewing), typos can cause endless pain when programming.

But yes, any questions about actually doing kernel programming
should be sent to a kernel group. I'd imagine there's a kernel
mailing list for people learning to program modules.

--
imalone
Jun 28 '06 #3

P: n/a
Ian Malone wrote:
Ian Collins wrote:
h.********@gmail.com wrote:
hi.. I m new to kernel programming..for my in-house project, I chose
to create a device driver for mouse for which I am required to
understand Kernel module programming..I tried to execute this small
module ..though it is getting complied but after trying hard with
insmod and makefile commands.. I am still not able to execute it..

You should take this to a Linux kernel group, it's off topic here.


Actually I think this is a C question, the gcc warning suggests
the problem is the space after '\':
printk("init_module invokded\ n");

I'd guess the OP meant '\n' (and "invoked" too). Get good at typing
(and reviewing), typos can cause endless pain when programming.

But yes, any questions about actually doing kernel programming
should be sent to a kernel group. I'd imagine there's a kernel
mailing list for people learning to program modules.


Theres also a manual and several thousand websites dedicated to this
topic. A quick search on google for "kernel module programming" should
bring up some informative results.
Jun 28 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.