LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Problem with make file (https://www.linuxquestions.org/questions/linux-newbie-8/problem-with-make-file-767113/)

libinpk 11-05-2009 12:35 PM

Problem with make file
 
hi..i have been using the following make file to get .ko files in red hat linux. which i later used to insmod..

obj-m := mydriver.o

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

default:
$(MAKE) -C $(KERNDIR) M=`pwd` modules

clean:
rm -f *.ko *.mod.c *.o

but i installed ubuntu 6.06 recently and my make is no longer sucessful since ubuntu doesnt have /lib/modules/$(shell uname -r)/build path..

what do i do?any help is much appreciated.

PS: This is my first post..

TB0ne 11-05-2009 01:41 PM

Quote:

Originally Posted by libinpk (Post 3745973)
hi..i have been using the following make file to get .ko files in red hat linux. which i later used to insmod..

obj-m := mydriver.o

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

default:
$(MAKE) -C $(KERNDIR) M=`pwd` modules

clean:
rm -f *.ko *.mod.c *.o

but i installed ubuntu 6.06 recently and my make is no longer sucessful since ubuntu doesnt have /lib/modules/$(shell uname -r)/build path..

what do i do?any help is much appreciated.

PS: This is my first post..

Well, first off, Ubuntu 6.06 is VERY old, so if you recently installed it, I'd suggest installing the current version. After that, you don't say what version of RedHat you're coming from, but if you don't have the /lib/modules path, you probably don't have the kernel source installed. You could TRY to install it for 6.06, but I'd suggest loading the current version, and choosing it at build time for installation.

imagine_me2 11-05-2009 01:58 PM

check if you have /lib/modules/[kernel name]/build by browsing your filesystem.
Sometimes it is linked to /usr/src/kernels/[kernel name], so check for that too.

[kernel name] can be found by typing
$uname -r

its actually your kernel source tree.

If you cant find the source tree in default location, it may not have come with your distro. So first install the kernel source tree, then to can use its path in the Make file.

If you have a little bit of time (and resource) you may choose to compile a whole new kernel and use it.
Then you will have the source tree for sure.

libinpk 11-06-2009 09:57 AM

thanks for your reply.. but it didnt solve my problem. i found that my /usr/src directory is empty. so what do i do? install it..?okay,but how do i do it?

imagine_me2 11-06-2009 11:49 AM

I guess can you can get the kernel source tree from the distribution's official website. It will also contain the details how to install it.

Regarding installation of a new kernel its a time taking process which may not always be successful.
Let me know then , after you have considered the first option.


All times are GMT -5. The time now is 10:58 PM.