LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-07-2011, 11:53 AM   #1
lionaneesh
LQ Newbie
 
Registered: Apr 2010
Posts: 1

Rep: Reputation: 0
Angry Compiling Kernel Modules in Ubuntu 10.10


After Being Fully Enthusiastic and ready to make my own Kernel Modules I started the work to be done to get started into kernel programming...
I have managed to successfully compile my own kernel...But while compiling my modules
After trying continuously for about 4-5 hrs....... I am totally frustrated and Asking for your help!!!

System Information :-

Linux Version : Ubuntu 10.10 i386
Kernel Version : 2.6.32.26

The Problem :-

The main problem is the make part...
I have a hello-1.c code from http://www.faqs.org/docs/kernel/x204.html
Code:
/*  hello-1.c - The simplest kernel module.

 */

#include <linux/module.h>  /* Needed by all modules */

#include <linux/kernel.h>  /* Needed for KERN_ALERT */

int init_module(void)

{

   printk("<1>Hello world 1.\n");

	

   // A non 0 return means init_module failed; module can't be loaded.

   return 0;

}

void cleanup_module(void)

{

  printk(KERN_ALERT "Goodbye world 1.\n");

}
and a Makefile is from different source as the above source provides makefile for kernel 2.4
Code:
ifneq ($(KERNELRELEASE),)

# We were called by kbuild



obj-m += target.o



else  # We were called from command line



KDIR := /lib/modules/$(shell uname -r)/build

#KDIR := /home/cynove/src/kernel/linux-source-2.6.31

PWD  := $(shell pwd)



default:

	@echo '    Building target module 2.6 kernel.'

	@echo '    PLEASE IGNORE THE "Overriding SUBDIRS" WARNING'

	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules



install:

	./do_install.sh *.ko



endif  # End kbuild check

######################### Version independent targets ##########################



clean:

	rm -f -r *.o *.ko .*cmd .tmp* core *.i
I am constantly getting the same errors :-
Code:
    Building target module 2.6 kernel.

    PLEASE IGNORE THE "Overriding SUBDIRS" WARNING

make -C /lib/modules/2.6.32.26+drm33.12-explict-hax0r/build SUBDIRS=/home/aneesh/semtex modules

make[1]: Entering directory `/home/aneesh/source/linux-source-2.6.32'

make[2]: *** No rule to make target `/home/aneesh/semtex/target.c', needed by `/home/aneesh/semtex/target.o'.  Stop.

make[1]: *** [_module_/home/aneesh/semtex] Error 2

make[1]: Leaving directory `/home/aneesh/source/linux-source-2.6.32'

make: *** [default] Error 2
I am totally discouraged and frustrated by not getting results after trying so hard...
I checked the Makefile and seems it all is right ….
Really I am unable to get a clue what's wrong...
I thing maybe something is missing... But what?Where?Why?

Thanks in Advance

Your's faithfully
`uname -r`
 
Old 01-08-2011, 04:57 AM   #2
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
The dots in RED should be replaced by a TAB only!

Makefile:
Code:
obj-m += hello-1.o

all:
......make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
......make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
 
1 members found this post helpful.
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/lib/modules/2.4.33.3/kernel/sound folder is missing after compiling kernel Paulo Góes Slackware - Installation 2 04-15-2007 08:42 PM
Compiling too many modules into kernel samac Slackware 13 02-27-2006 06:35 PM
Modules in Kernel Compiling SlackwareInAZ Slackware 1 07-29-2005 05:10 AM
need some help in Compiling Kernel modules bharat83 SUSE / openSUSE 1 01-07-2005 07:21 AM
Compiling kernel modules? jrjarrett Linux - Software 0 09-09-2003 10:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:44 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
Open Source Consulting | Domain Registration