Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just 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.

  2. #2
    Linux Guru Jonathan183's Avatar
    Join Date
    Oct 2007
    Posts
    3,045
    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.

  3. #3
    Just 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..

  4. $spacer_open
    $spacer_close
  5. #4
    Trusted Penguin Dapper Dan's Avatar
    Join Date
    Oct 2004
    Location
    The Sovereign State of South Carolina
    Posts
    4,630
    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?
    Linux Mint + IceWM Registered: #371367 New Members: click here

  6. #5
    Just 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.

  7. #6
    Trusted Penguin Dapper Dan's Avatar
    Join Date
    Oct 2004
    Location
    The Sovereign State of South Carolina
    Posts
    4,630
    I don't use Knoppix so I'm going from intuition/memory here, but go:
    Code:
    ls  /usr/src
    And see if there is any kernel headers there. If not, from the command line as su do:
    Code:
    aptitude search linux-headers-
    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:
    apt-get install linux-headers-2.6.19
    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:
    uname -a
    to know for sure.
    Linux Mint + IceWM Registered: #371367 New Members: click here

  8. #7
    Just 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..

  9. #8
    Trusted Penguin Dapper Dan's Avatar
    Join Date
    Oct 2004
    Location
    The Sovereign State of South Carolina
    Posts
    4,630
    IF the directory in /lib/modules is called 2.6.19, do:
    Code:
    cd /lib/modules/2.6.19
    Then:
    Code:
    ls -l
    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:
    rm build
    To make the link...
    Code:
    ln -s /usr/src/linux-headers-2.6.19 /lib/modules/2.6.19/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.
    Linux Mint + IceWM Registered: #371367 New Members: click here

  10. #9
    Just 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. #10
    Trusted Penguin Dapper Dan's Avatar
    Join Date
    Oct 2004
    Location
    The Sovereign State of South Carolina
    Posts
    4,630
    Argh! Surely I thought Knoppix would have had aptitude installed by default. So to install it, do as su:
    Code:
    apt-get install aptitude
    Linux Mint + IceWM Registered: #371367 New Members: click here

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •