LinuxQuestions.org
Review your favorite Linux distribution.
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 04-09-2006, 03:14 AM   #1
pat_and_cami
LQ Newbie
 
Registered: Feb 2006
Posts: 16

Rep: Reputation: 0
How/Where To Make *.ko file so I can insmod module into Kernel?


I am trying the following, but am unable to build my helloworld.ko file so that I can insmod it into my Kernel. I am using Suse 9.3, and tried logged on as 'root' and as myself. I am running Linux 2.6 (so trying 2.6 Makefile format:

1) I have source file helloworld.c as:

#include <linux/module.h>
#include <linux/kernel.h>
int init_module(void)
{
printk(KERN_INFO "hello - I've just loaded myself into the kernel\n");
return 0;
}
void __exit cleanup_module(void)
{
printk(KERN_INFO "goodbye \n");
}

MODULE_AUTHOR("(c) Me");
MODULE_DESCRIPTION("Hello ");
MODULE_LICENSE("GPL");

2) I am running linux 2.6, so have Makefile as:

obj-m += helloworld.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


3) I run 'make' and get the following error:

psullivan@linux:~> make
make: Nothing to be done for `all'.
psullivan@linux:~>

---

Can someone please tell me:

- Why am I getting the above error "Nothing to be done for all"?
- Which subdirectory do I try to build the *.ko file from?
- Which subdirectory should the above Makefile go into?
- Do I need to be logged on as 'root' (I am, but it doesn't seem to help above)?



Thanks, Patrick//
 
Old 04-09-2006, 03:48 AM   #2
baskar_k
LQ Newbie
 
Registered: Mar 2006
Posts: 12

Rep: Reputation: 1
Hi,
Have you set your TARGET,CC and CFLAGS in your Makefile.
hope suggestions are of use.
 
  


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
What can you ACTUALLY make a module for in the kernel? djuhl30 Linux - Hardware 2 01-30-2006 02:34 AM
compile kernel module without 'make' whysyn Linux - Software 2 01-29-2006 12:56 AM
editing a kernel module make file shanenin Linux - Software 1 11-10-2005 09:00 AM
kernel module insertion using insmod on kernel 2.4.20-8, rh 9.0 gooner Red Hat 1 05-27-2004 05:31 AM
Compiling a kernel module results in "insmod" version mvega Linux - General 2 07-30-2003 09:03 AM

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

All times are GMT -5. The time now is 07:25 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