LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How to build module against headers that are not from the running kernel? (https://www.linuxquestions.org/questions/programming-9/how-to-build-module-against-headers-that-are-not-from-the-running-kernel-874861/)

eantoranz 04-13-2011 04:59 PM

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.

eantoranz 04-13-2011 06:09 PM

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



All times are GMT -5. The time now is 06:24 PM.