LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-10-2006, 04:59 PM   #1
Ralc
LQ Newbie
 
Registered: Mar 2006
Location: Brazil
Posts: 4

Rep: Reputation: 0
problems with Hello World kernel2.6 module


I'm having problems to compile a simple Hello World module. I'm using the kernel 2.6 with a SUSE 10.0 distribution and gcc 4.0.2.
The problem is that the Makefile doesn't compile the module, it doesnt create .o or .ko objects. Can anyone help?

*** Here is the code:

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>

MODULE_LICENSE("GPL");

static int hello_init(void)
{
printk(KERN_ALERT "Hello World\n");
return 0;
}
static void hello_cleanup(void) {
printk(KERN_ALERT "Bye!\n");
}
module_init(hello_init);
module_exit(hello_cleanup);

*** The Makefile:

obj-m := hello.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

*** The Output:

unit1:/home/rui/module # make
make -C /lib/modules/2.6.13-15-smp/build SUBDIRS=/home/rui/module modules
make[1]: Entering directory `/usr/src/linux-2.6.13-15-obj/i386/smp'
make -C ../../../linux-2.6.13-15 O=../linux-2.6.13-15-obj/i386/smp modules
Building modules, stage 2.
MODPOST
make[1]: Leaving directory `/usr/src/linux-2.6.13-15-obj/i386/smp'
 
  


Reply



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
hello world module the_uplink2x Programming 19 04-12-2005 02:14 PM
kernel2.6.3-19mdkcustom : version? -> No module christophe.dr Linux - Software 2 12-05-2004 01:34 PM
problems with kernel2.6.4 kefen Slackware 3 03-23-2004 10:04 AM
Kernel2.6/NVIDIA GeForce2 Problems Y2J Linux - Newbie 1 12-21-2003 08:31 PM
hello world module aliyildiz Linux - General 1 12-09-2001 05:04 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:08 AM.

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
Open Source Consulting | Domain Registration