LinuxQuestions.org
Register a domain and help support LQ
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-13-2011, 04:59 PM   #1
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Rep: Reputation: 83
How to build module against headers that are not from the running kernel?


Hi, guys!

I'm trying to debug a module I programmed but I don't want to do it on the running host but against UML (don't want to reboot every 5 minutes).

The UML kernel I downloaded is 2.6.38.2. I have already downloaded the ubuntu kernel headers for this version (they belong to natty though I'm running maverick.... when I installed the .deb file with dpkg I had no problem at all).

Now I'd like to build said module against these headers. How can I do it?

Here's the makefile for my module:
Code:
obj-m := r5r.o

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

all:
        make -C $(KDIR) M=$(PWD) modules
clean:
        make -C $(KDIR) M=$(PWD) clean
Thanks in advance.
 
Old 04-13-2011, 06:09 PM   #2
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
I had to change the Makefile to have a different (static) path for the build directory.

Code:
obj-m := r5r.o

PWD := $(shell pwd)
KDIR := /lib/modules/2.6.38-2-generic/build

all:
        make -C $(KDIR) M=$(PWD) modules
clean:
        make -C $(KDIR) M=$(PWD) clean
 
  


Reply

Tags
build, headers, linux, make, module


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How can I get and install build-essentials and kernel-headers using wget? zoanie Linux - Embedded & Single-board computer 4 11-17-2009 03:41 PM
kernel headers & /lib/modules/uname -r/build fof3 Linux - Newbie 4 12-16-2008 02:58 PM
Am I missing some stuff in /build/ ? Kernel Headers?!?!? yttrium88 Linux - Newbie 1 10-28-2006 08:40 PM
[Error] Kernel Module : No kernel module build environment saman007uk Debian 7 09-09-2006 06:34 PM
LXer: Howto: build Linux kernel module against installed kernel w/o full kernel source tree LXer Syndicated Linux News 0 09-03-2006 08:21 PM


All times are GMT -5. The time now is 04:47 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration