ts-7000
[Top] [All Lists]

Re: [ts-7000] Re: Compiling device driver module for the linux-2.6.21-ts

To:
Subject: Re: [ts-7000] Re: Compiling device driver module for the linux-2.6.21-ts kernel
From: David Hawkins <>
Date: Mon, 23 Jun 2008 09:19:31 -0700
Hi Vijay,

> I still am not sure how to name my module anything other than module.o
> I would rather have my module named glcd.o but that is one of the
> files I already have (glcd.c)...
> 
> I am not sure how to provide a custom module name if one has multiple
> files to compile one module. 

Below is a 2.6 driver Makefile example. The drivers built are;

   plx.ko        - built from plx_device.o and plx_driver.o
   cobra.ko      - plx_device.o cobra_driver.o
   plx_serial.ko - plx_device.o ring_buffer.o plx_serial_driver.o

see how the plx-objs list corresponds to the driver name,
and how multiple files can be listed.

If you have both kernel code, and user-space applications
code, then I would recommend keeping them in separate
folders with separate Makefiles. That way if you want to
have identical filenames, or object names for the kernel
code and the user-space code, you won't get any weird
conflicts.

Cheers,
Dave


# COBRA Driver Makefile
#
# Device driver makefile
#
# For details on kernel modules Makefiles, see
#
# p24 "Linux Device Drivers", 3rd Ed, Rubini et al
# $KERNEL_SOURCE/Documentation/kbuild/makefiles.txt, modules.txt
#
# The COBRA_INCLUDE parameter is used to pass the include
# directory down to the kernel makefiles, as per the LDD3
# examples Makefile, eg. ldd3/examples/scull/Makefile
#

ifneq ($(KERNELRELEASE),)
        obj-m := \
                plx.o\
                cobra.o\
                plx_serial.o
plx-objs := plx_device.o plx_driver.o
cobra-objs := plx_device.o cobra_driver.o
plx_serial-objs := plx_device.o ring_buffer.o plx_serial_driver.o
#       EXTRA_CFLAGS += -DDEBUG
        EXTRA_CFLAGS += -I$(COBRA_INCLUDE)
else
        KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build
        PWD := $(shell pwd)

default: modules

# Kernel modules
modules:
        $(MAKE) -C $(KERNEL_DIR) M=$(PWD) COBRA_INCLUDE=$(PWD)/../include 
modules

endif

clean:
        rm -rf .tmp*.o *.o *.ko *.mod.* .*.cmd .tmp_versions


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU