add kernel driver for SPCA5XX based USB cameras
[openwrt.git] / target / linux / package / spca5xx / patches / 01-kmod-build.patch
1 diff -ruN spca5xx-20051105-old/Makefile spca5xx-20051105-new/Makefile
2 --- spca5xx-20051105-old/Makefile       2005-11-05 19:18:26.000000000 +0100
3 +++ spca5xx-20051105-new/Makefile       2005-12-08 21:50:20.000000000 +0100
4 @@ -68,157 +68,18 @@
5  
6  else   # kernel version test
7  
8 -#############################################################################
9 -# For Linux 2.4 users.
10 -# Change the following lines according to your system configuration.
11 -# It is important to configure your particular source tree ("make dep") before
12 -# compiling this module!
13 -#############################################################################
14 -###
15 -# This makefile will build the spca50x driver module external to the kernel
16 -# source tree. It makes it easier to swap kernels.
17 -
18 -
19 -KERNEL_VERSION = `uname -r`
20 -
21 -###
22 -# Location of the header files (most importantly the config files)
23 -# for the kernel you want to build the module against.
24 -# This should be correct for the currently installed kernel on your machine.
25 -KINCLUDE   = /lib/modules/$(KERNEL_VERSION)/build/include
26 -KERNEL_ACFILE = $(KINCLUDE)/linux/autoconf.h
27 -KERNEL_MODVERSIONSFILE = $(KINCLUDE)/linux/modversions.h
28 -MODULE_INSTALLDIR = /lib/modules/$(KERNEL_VERSION)/kernel/drivers/usb/
29 -
30 -# Detect module versioning support
31 -ifneq ($(strip $(shell grep 'define CONFIG_MODVERSIONS 1' $(KERNEL_ACFILE))),)
32 -       DEFINES += -DMODVERSIONS -include $(KERNEL_MODVERSIONSFILE)
33 -endif
34 -
35 -# Detect SMP support
36 -ifneq ($(strip $(shell grep 'define CONFIG_SMP 1' $(KERNEL_ACFILE))),)
37 -       DEFINES += -D__SMP__ -DSMP
38 -endif
39 -
40 -# Setup the tools
41 -CC         = gcc
42 -LD         = ld
43 -
44 -# Setup compiler warnings
45 -WARNINGS   = -Wall -Wpointer-arith
46 -WARNINGS  += -Wcast-align -Wwrite-strings -Wstrict-prototypes
47 -WARNINGS  += -Wuninitialized -Wreturn-type -Wunused -Wparentheses
48 -
49 -# Setup compiler flags
50 -CFLAGS     = -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe
51 -CFLAGS    += -mpreferred-stack-boundary=2 
52 -CFLAGS    += -I$(KINCLUDE) -Idrivers/usb
53 -
54 -# Setup link flags
55 -LDFLAGS    = --strip-debug -r
56 -
57 -# Setup the list of files to be included in a distribution
58 -DIST_FILES = CHANGELOG \
59 -             README \
60 -             Makefile \
61 -             drivers/usb/Config.in \
62 -             drivers/usb/spcadecoder.c \
63 -             drivers/usb/spcadecoder.h \
64 -             drivers/usb/jpeg_header.h \
65 -            drivers/usb/jpeg_qtables.h \
66 -            drivers/usb/spcagamma.h \
67 -            drivers/usb/spcaCompat.h \
68 -            drivers/usb/spcausb.h \
69 -             drivers/usb/spca500_init.h \
70 -             drivers/usb/spca501_init.h \
71 -            drivers/usb/sp5xxfw2.dat \
72 -             drivers/usb/sp5xxfw2.h \
73 -             drivers/usb/spca505_init.h \
74 -             drivers/usb/spca506.h \
75 -             drivers/usb/spca508_init.h \
76 -            drivers/usb/spca561.h \
77 -            drivers/usb/sonix.h \
78 -             drivers/usb/cs2102.h \
79 -             drivers/usb/hv7131b.h \
80 -            drivers/usb/icm105a.h \
81 -             drivers/usb/hv7131c.h \
82 -            drivers/usb/hdcs2020.h \
83 -             drivers/usb/pb0330.h \
84 -            drivers/usb/tas5130c.h \
85 -            drivers/usb/zc3xx.h\
86 -            drivers/usb/tv8532.h\
87 -            drivers/usb/cxlib.h\
88 -            drivers/usb/sn9cxxx.h\
89 -            drivers/usb/cx11646.h\
90 -            drivers/usb/pac207.h\
91 -            drivers/usb/spca5xx.c \
92 -             drivers/usb/spca5xx.h 
93 -
94 -OBJS       = drivers/usb/spcadecoder.o \
95 -             drivers/usb/spca5xx.o
96 -
97 -BINARY     = spca5xx.o
98 -
99 -###
100 -# Targets follow here
101 -
102 -binary:        $(OBJS)
103 -       @echo Linking $(BINARY)
104 -       @$(LD) $(LDFLAGS) -o $(BINARY) $(OBJS)
105 -
106 -install: binary
107 -       @echo Installing.. Your root password may be required.
108 -       su -c "make install-root"
109 -
110 -install-root:
111 -       @echo Installing..
112 -       @mkdir -p /lib/modules/`uname -r`/kernel/drivers/usb
113 -       @rm -f /lib/modules/`uname -r`/kernel/drivers/usb/spca50x.o
114 -       @rm -f /lib/modules/`uname -r`/kernel/drivers/usb/et61x.o
115 -       @cp spca5xx.o /lib/modules/`uname -r`/kernel/drivers/usb/spca5xx.o
116 -       @/sbin/depmod
117 -
118 -dist:  clean binary
119 -       @echo Making distributable archives
120 -       @rm -f spca5xx-src-$(VERSION).tar.gz
121 -       @tar zcf spca5xx-src-$(VERSION).tar.gz $(DIST_FILES)
122 -       @rm -f spca5xx-module-$(VERSION).tar.gz
123 -       @cp $(BINARY) spca5xx-$(VERSION).o
124 -       @tar zcf spca5xx-module-$(VERSION).tar.gz spca5xx-$(VERSION).o README
125 -       @rm spca5xx-$(VERSION).o
126 -
127 -.c.o:  Makefile $*.c
128 -       @echo Compiling $*.c
129 -       @$(CC) $(CFLAGS) $(WARNINGS) $(DEFINES) -c $*.c -o $*.o
130 -
131 -###
132 -# Dependencies follow here
133 -
134 -drivers/usb/spca5xx.o: drivers/usb/spca5xx.h \
135 -                      drivers/usb/spcaCompat.h \
136 -                      drivers/usb/spcausb.h \
137 -                      drivers/usb/sonix.h \
138 -                       drivers/usb/spca500_init.h \
139 -                       drivers/usb/spca501_init.h \
140 -                      drivers/usb/sp5xxfw2.h \
141 -                       drivers/usb/spca505_init.h \
142 -                      drivers/usb/spca506.h \
143 -                       drivers/usb/spca508_init.h \
144 -                      drivers/usb/spca561.h \
145 -                      drivers/usb/zc3xx.h\
146 -                      drivers/usb/tv8532.h\
147 -                      drivers/usb/cx11646.h\
148 -                      drivers/usb/mr97311.h\
149 -                      drivers/usb/sn9cxxx.h\
150 -                      drivers/usb/pac207.h\
151 -                       
152 -
153 -drivers/usb/spcadecoder.o: drivers/usb/spcadecoder.h \
154 -                          drivers/usb/spcagamma.h \
155 -                           drivers/usb/jpeg_header.h
156 +EXTRA_CFLAGS += $(DEFINES) 
157  
158 -endif  # End kernel version test
159 +spca5xx-objs := drivers/usb/spca5xx.o drivers/usb/spcadecoder.o 
160 +
161 +obj-m += spca5xx.o
162 +obj-y := $(spca5xx-objs)
163 +
164 +O_TARGET := $(obj-m)
165  
166 +-include $(TOPDIR)/Rules.make
167 +
168 +endif  # End kernel version test
169  
170  ############################################################################## 
171  # OTHER TARGETS