Compiling custom driver
Hello all, I have a driver that I need to compile in RedHat 6 Kernel release 2.6.32-504.3.3.el6.x86_64
my Make file is the following
more Makefile
ifneq ($(CFG),Release)
EXTRA_CFLAGS += -g -fno-inline -O0 -Os
else
EXTRA_CFLAGS += -O2 -Wconversion -Os
endif
obj-m += blkwatch.o
blkwatch-objs := init.o devfile.o bitmap.o watch.o device.o queued_pages.o freeze.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(CURDIR) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(CURDIR) clean
When I run make i get an error, no such file or directory.
I checked the build directory to ensure is a soft link to /usr/src/kernels/
Output:
make
make -C /lib/modules/2.6.32-504.3.3.el6.x86_64/build M=/root/src modules
make: *** /lib/modules/2.6.32-504.3.3.el6.x86_64/build: No such file or directory. Stop.
make: *** [all] Error 2
ls -ltr /lib/modules/uname -r/build
lrwxrwxrwx 1 root root 50 Dec 18 18:34 /lib/modules/2.6.32-504.3.3.el6.x86_64/build -> ../../../usr/src/kernels/2.6.32-504.3.3.el6.x86_64
make --debug
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for x86_64-redhat-linux-gnu
Reading makefiles...
Updating goal targets....
File all' does not exist.all'.
Must remake target
make -C /lib/modules/2.6.32-504.3.3.el6.x86_64/build M=/root/src modules
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for x86_64-redhat-linux-gnu
make: *** /lib/modules/2.6.32-504.3.3.el6.x86_64/build: No such file or directory. Stop.
make: *** [all] Error 2
[ src]# ls -ltr
total 196
-rw-r--r-- 1 root root 28682 Aug 24 2014 watch.c
-rw-r--r-- 1 root root 3843 Aug 24 2014 Readme
-rw-r--r-- 1 root root 1478 Aug 24 2014 queued_pages.h
-rw-r--r-- 1 root root 4644 Aug 24 2014 queued_pages.c
-rw-r--r-- 1 root root 360 Aug 24 2014 Makefile
-rw-r--r-- 1 root root 2317 Aug 24 2014 init.c
-rw-r--r-- 1 root root 1323 Aug 24 2014 freeze.h
-rw-r--r-- 1 root root 7440 Aug 24 2014 freeze.c
-rw-r--r-- 1 root root 1356 Aug 24 2014 driver_info.h
-rw-r--r-- 1 root root 3093 Aug 24 2014 device.h
-rw-r--r-- 1 root root 8076 Aug 24 2014 device.c
-rw-r--r-- 1 root root 2140 Aug 24 2014 devfile.h
-rw-r--r-- 1 root root 24937 Aug 24 2014 devfile.c
-rw-r--r-- 1 root root 17987 Aug 24 2014 COPYING
-rw-r--r-- 1 root root 7284 Aug 24 2014 blkwatch.h
-rw-r--r-- 1 root root 10316 Aug 24 2014 blkwatchapi.h
-rw-r--r-- 1 root root 3381 Aug 24 2014 bitmap.h
-rw-r--r-- 1 root root 34268 Aug 24 2014 bitmap.c
Any suggestions will be appreciated.
Thank you
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
