Results 1 to 10 of 14
I am using the source code provided by the book of orielly's linux device driver. The makefile for scull looks like this
# Comment/uncomment the following line to disable/enable debugging
...
- 11-17-2007 #1Just Joined!
- Join Date
- Nov 2007
- Posts
- 10
Doubt Regarding Device Driver
I am using the source code provided by the book of orielly's linux device driver. The makefile for scull looks like this
# Comment/uncomment the following line to disable/enable debugging
#DEBUG = y
# Add your debugging flag (or not) to CFLAGS
ifeq ($(DEBUG),y)
DEBFLAGS = -O -g -DSCULL_DEBUG # "-O" is needed to expand inlines
else
DEBFLAGS = -O2
endif
CFLAGS += $(DEBFLAGS)
CFLAGS += -I$(LDDINC)
ifneq ($(KERNELRELEASE),)
# call from kernel build system
scull-objs := main.o pipe.o access.o
obj-m := scull.o
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) LDDINC=$(PWD)/../include modules
endif
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
depend .depend dep:
$(CC) $(CFLAGS) -M *.c > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif
when I am trying to 'make', I am getting error as 'No such file or directory in the /lib/modules/2.6.19/build' where 2.6.19 is my uname -r. And when I see in the path, build is actually there in the directory but its not accessible, I mean, we are not able to enter the build directory. Please help in this regard. Thanks.
- 11-17-2007 #2
I'm not sure if this will be much use to you but ...
the equivalent on my system is /lib/modules/2.6.13-15.18-default which contains a build link ... the link points to /usr/src/linux-2.6.13-15.18-obj/i386/default to which I have view & modify contents permissions.
It sounds as though you do not have the right permissions.
- 11-18-2007 #3Just Joined!
- Join Date
- Nov 2007
- Posts
- 10
Ya exactly as you told..but how to solve this problem...I mean Is there any way that we need to do make...Please help me...Thanks..
- 11-18-2007 #4
Sounds to me like there is not a proper symlink between /lib/modules/*/build and the kernel source which should be in /usr/src. Is the kernel source installed? What distro are you running?
- 11-18-2007 #5Just Joined!
- Join Date
- Nov 2007
- Posts
- 10
The distro I am using is Knoppix 5.1. so what do u mean by kernel source installed? what should I do for it and I think you got my problem correctly. I am getting error as 'No such file or directory found' when I am doing make for Makefile I just shown above. should I need to change anything in that or tell me where and what should I do? Thanks.
- 11-18-2007 #6
I don't use Knoppix so I'm going from intuition/memory here, but go:
And see if there is any kernel headers there. If not, from the command line as su do:Code:ls /usr/src
and see if it throws up one called linux-headers-2.6.19 or linux-headers-2.6.19-generic. If it does, then I think that is what you need to install...Code:aptitude search linux-headers-
or whichever it is that corresponds to your present kernel. This is presuming you are presently running kernel 2.6.19. If in doubt, do:Code:apt-get install linux-headers-2.6.19
to know for sure.Code:uname -a
- 11-19-2007 #7Just Joined!
- Join Date
- Nov 2007
- Posts
- 10
I think there should be one kernel header in the path /usr/src. If its already there then do I need to install it? Do u think the problem is due to some missing files? Thanks..
- 11-19-2007 #8
IF the directory in /lib/modules is called 2.6.19, do:
Then:Code:cd /lib/modules/2.6.19
Does it show that the file "build" is pointing back to the kernel headers that you say are in /usr/src? If not, you would go as an example:Code:ls -l
To make the link...Code:rm build
You need to tailor the above for your exact kernel versions and names, but that is essentially how you do it. Don't make the possible mistake of pointing build back to a different version of the headers than the same numerical value as the directory where build is in /lib/modules. They should be the same. Once /lib/modules/2.6.19/build is pointing back to the correct headers in /usr/src, try compiling again.Code:ln -s /usr/src/linux-headers-2.6.19 /lib/modules/2.6.19/build
- 11-20-2007 #9Just Joined!
- Join Date
- Nov 2007
- Posts
- 10
When I am trying to give command as aptitude search linux-headers it gives me an error as aptitude command not found. Please tell me what should I do. Thanks.
- 11-20-2007 #10
Argh! Surely I thought Knoppix would have had aptitude installed by default. So to install it, do as su:
Code:apt-get install aptitude


Reply With Quote
