473,382 Members | 1,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

kernel module: beginner

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
3 2143
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Camilo Olarte | last post by:
Hi list, I was wondering : If python cgi scripts can be acceletaded by means of mod_python in apache (loading the python interpreter on apache) , then : ?Is there a way of doing the same...
37
by: jwaixs | last post by:
arg... I've lost 1.5 hours of my precious time to try letting re work correcty. There's really not a single good re tutorial or documentation I could found! There are only reference, and if you...
1
by: alice | last post by:
hi all, First of all I would apologize in case this the wrong group for posting this article. I'm trying to write small Linux kernel modules.I compile them with the following command gcc -c...
4
by: SiTTox | last post by:
Hi ppl. Pleace Help me to find information/source : how to encrypt file/ information in Linux/Unix only with Internal functions. without OpenSSL(and others) without writing own RSA,DES,PGP(and...
0
by: pk2068 | last post by:
Hello. I would like to have a built-in ALSA support for my VIA soundcard. When i selected it like a module , all works fine, and the new kernel boots with its appropriate initrd image. ...
0
by: sarang | last post by:
Hi, I want to use gzip compression library in kernel module. I have source of of gzip library. I dont understand how to use this library in kernel module. Please suggest me easiest way to...
0
by: mattng604 | last post by:
Hi, I am trying to typecast a void* pointer to a structure I defined called _sfrdm336_mdb. However, when I try, I get the following error: Oops in fault.c, Unable to handle kernel paging...
20
by: Jimmy | last post by:
Hi to all python now has grown to a versatile language that can accomplish tasks for many different purposes. However, AFAIK, little is known about its ability of kernel coding. So I am...
5
by: hnshashi | last post by:
I have writtem kernel(2.4) module to commu. with user space appl. using netlink socket. I am getting compilation error. kernel module:-> #include <linux/skbuff.h> #include<linux/module.h> ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.