LinuxQuestions.org
Help answer threads with 0 replies.
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-24-2007, 03:15 PM   #1
lzwierko
LQ Newbie
 
Registered: Mar 2007
Posts: 2

Rep: Reputation: 0
Problems with kernel headers


Hi,

I have a problem writing my first module for linux. I use ubuntu 6.10. The module code starts with:

#define MODULE
#include <linux/module.h>

unfortunately in /usr/include/linux there is no such file...

Ok I say, still i have /usr/src/linux-headers-2.6.17-11/include/linux which holds all headers that are in /usr/include/linux/ and more (including module.h)

So I linked /usr/src/linux-headers-2.6.17-11/include/linux directory to /user/local/incude/linux (ln -s).

but...

Whan I compile I get about 100 errors being in these hearers... seems I'm doing something totally wrong way.

Thanks for feedback

Łukasz Z
 
Old 03-25-2007, 01:49 AM   #2
lzwierko
LQ Newbie
 
Registered: Mar 2007
Posts: 2

Original Poster
Rep: Reputation: 0
Fix

Ok, I figured it out myself.
The thing is, on from kernel 2.6 (if i'm right?) compiling with kernel headres linked directlty does not work (some problems with dependecies/pathes ?)

shat you should do is create Makefile similiar to :

obj-m := modtest.o
KDIR := /lib/modules/2.6.17-11-generic/build -> this is where headers are
PWD := $(shell pwd) -> or just directory where the make file is
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

hope it helps anyone

Ł
 
  


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 are the problems installing kernel headers 2.6.17.13? backthefup Slackware 2 03-05-2007 09:33 PM
Help - strange problems with kernel headers and 'make' -=Graz=- Ubuntu 6 05-24-2006 06:54 AM
Errors Compiling Kernel 2.6 on Slackware 10.2 - Old kernel headers required? Dave S. Slackware 8 03-04-2006 12:15 AM
trying to find/install kernel-source or kernel-headers timsch75 Slackware 3 10-22-2005 09:17 AM
send packets with kernel routing and without kernel messing with headers bassdemon Programming 5 02-08-2005 06:29 PM

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

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