Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Write an article for LinuxForums Today! Win Great Prizes!
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > GNU Linux Zone > The Linux Kernel > Modules insertion in My kernel...

Forgot Password?
 The Linux Kernel   Compiling, theory, programming or other discussion about the linux kernel

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds
Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 03-30-2007   #1 (permalink)
Just Joined!
 
Join Date: Mar 2007
Posts: 20
Modules insertion in My kernel...

Hai Guys,...
As i had been assigned with a project reagarding the /proc file system.. I need to insert modules ... But i m facing a lot of troubles to compile them and insert them... A lot of version troubles...could some one help me to get out of it.....My kernel version is 2.6.15-1.2054_FC5

I couldn compile my simple hello.c program to get a Hello.Ko output file.....


Pease help me guys !!!!
winifred_mit is offline  



Reply With Quote
Old 03-30-2007   #2 (permalink)
Linux User
 
cyberinstru's Avatar
 
Join Date: Jan 2007
Location: India
Posts: 352
Whatz the error that you get?

Do you have the source of your running kernel, itz required for building your module.
__________________
---------------------------------
Registered Linux User #440311
Forget what the World thinks...
Just follow your Heart...
---------------------------------
cyberinstru is offline   Reply With Quote
Old 03-30-2007   #3 (permalink)
Just Joined!
 
Join Date: Mar 2007
Posts: 20
Modules !!!

I don think i have the source....wer do i find themm.....
winifred_mit is offline   Reply With Quote
Old 03-30-2007   #4 (permalink)
Linux User
 
cyberinstru's Avatar
 
Join Date: Jan 2007
Location: India
Posts: 352
You can get it from www.kernel.org

Configure, compile, and have a running kernel.

Then compile your module.
__________________
---------------------------------
Registered Linux User #440311
Forget what the World thinks...
Just follow your Heart...
---------------------------------
cyberinstru is offline   Reply With Quote
Old 03-31-2007   #5 (permalink)
Just Joined!
 
Join Date: Mar 2007
Posts: 42
Quote:
Originally Posted by cyberinstru
You can get it from www.kernel.org

Configure, compile, and have a running kernel.

Then compile your module.
Don't forget backup you're running kernel first....
Or don't override the running kernel.... while compiling the new kernel
jin_1644 is offline   Reply With Quote
Old 03-31-2007   #6 (permalink)
Just Joined!
 
Join Date: Mar 2007
Posts: 20
Thanx

But how do i take a back up... and then re-compile a new kernel !!!!
Gimme the steps yaar....
Thanx for helping...
winifred_mit is offline   Reply With Quote
Old 04-01-2007   #7 (permalink)
Linux Guru
 
Juan Pablo's Avatar
 
Join Date: Mar 2006
Location: /home/south_america/ecuador/quito
Posts: 2,060
Send a message via MSN to Juan Pablo
You will need to do some research yourself, Google is your friend.
There are a lot of tutorials detailing how to write a simple module that prints "Hello world" in dmesg out there
__________________
Put your hand in an oven for a minute and it will be like an hour, sit beside a beautiful woman for an hour and it will be like a minute, that is relativity. --Albert Einstein
Linux User #425940

Don't PM me with questions, instead post in the forums
Juan Pablo is offline   Reply With Quote
Old 04-02-2007   #8 (permalink)
Just Joined!
 
Join Date: Aug 2006
Location: india
Posts: 57
hi winifred,
I am at the same situation where ur standing, when ur including the driver what is the makefile u wrote for it.
look at my make:
************************************************** ***************************
obj-m += hello.ko

all:
make -C /lib/modules/2.6.x.x/build M=$(PWD) modules
************************************************** ***************************
it has to look into /usr/src for that source 2.6kernel that is not happening for me it is saying no rule in makefile
pls give me ur makefile
****cyberinstructer please help buddy***
kingraja84 is offline   Reply With Quote
Old 04-03-2007   #9 (permalink)
Linux User
 
cyberinstru's Avatar
 
Join Date: Jan 2007
Location: India
Posts: 352
Try this.

Code:
MYKERNEL=`uname -r`

ifneq ($(KERNELRELEASE),)
# call from kernel build system

obj-m   := hello.o

else
 
KERNELDIR ?= /lib/modules/$(MYKERNEL)/build
PWD       := $(shell pwd)

default:
        $(MAKE) -C $(KERNELDIR) M=$(PWD) modules

endif

clean:
        rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions

depend .depend dep:
        $(CC) $(CFLAGS) -M *.c > .depend


ifeq (.depend,$(wildcard .depend))
include .depend
endif
__________________
---------------------------------
Registered Linux User #440311
Forget what the World thinks...
Just follow your Heart...
---------------------------------
cyberinstru is offline   Reply With Quote
Old 04-05-2007   #10 (permalink)
Just Joined!
 
Join Date: Aug 2006
Location: india
Posts: 57
i am using ur makefile only cyberinstructer but one more pbm

build link in my /lib/modules is looking for this source ,( it is a broken link)
usr/src/kernels/2.6.15-1.2054_FC5-i686
i included a wrong source i guess it is showing error as ...(kernel-2.6.15-1.2054_FC5.src is what i included)
[root@localhost hello]# make -f Makefile.txt
make -C /lib/modules/`uname -r`/build M=/home/rajasekhar/hello modules
make: *** /lib/modules/2.6.15-1.2054_FC5/build: No such file or directory. Stop.
make: *** [default] Error 2

if so please send me the correct i686 source ,i search on kernel.org but i think i am a bad searcher
kingraja84 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
A Newbie's Getting Started Guide to Linux
Learn the basics of the Linux operating systems. Get to know what it is all about, and familiarize yourself with the practical side. Basically, if you're a complete Linux newbie and looking for a quick and easy guide to get you started this is it.
subscribe
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
subscribe
Open Source Security Myths Dispelled
Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization
subscribe
InformationWeek
InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
subscribe



All times are GMT. The time now is 06:01 AM.






© 2000 - - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.1