LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-18-2003, 04:23 AM   #1
oskernel
LQ Newbie
 
Registered: Sep 2003
Location: China
Posts: 25

Rep: Reputation: 15
How to write a kernel module on linux-2.6.0?


here is an example, anything wrong ?

//---------hello.c----------------
#include <linux/kernel.h>
#include <linux/module.h>
int init_module(void)
{
printk("hello world\n");
return 0;
}
void cleanup_module(void)
{
printk("bye\n");
}
//-----------end-----------

I compiled it with command:
gcc -I/usr/src/linux-2.6.0-test7/include -D_KERNEL_ -DMODULE -DKBUILD_MODNAME=hello -c hello.c
ant then I got may "undeclared" errors.

This is the first time for me to write kernel module on 2.6, and I even don't know how to generate a .ko file.

Last edited by oskernel; 10-18-2003 at 07:02 AM.
 
Old 10-18-2003, 06:52 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

http://www.linuxquestions.org/rules.php
 
Old 10-18-2003, 07:04 AM   #3
oskernel
LQ Newbie
 
Registered: Sep 2003
Location: China
Posts: 25

Original Poster
Rep: Reputation: 15
FAINT!
Is it your reply!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[Error] Kernel Module : No kernel module build environment saman007uk Debian 7 09-09-2006 07:34 PM
Linux kernel debugging and Linux kernel module programming Igor007 Programming 2 08-13-2005 06:12 AM
Linux kernel debugging and Linux kernel module programming Igor007 Linux - Enterprise 3 08-12-2005 03:47 PM
Compiling kernel module for linux kernel 2.4 in 2.6 guam Linux - Software 0 01-13-2005 03:02 AM
How to write a kernel module(kernel object, .ko) on linux-2.6.0? oskernel Programming 1 10-21-2003 03:20 PM


All times are GMT -5. The time now is 03:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration