usb audio from dave, thx
[openwrt.git] / openwrt / target / linux / linux-2.4 / Makefile
1 #############################################################
2 # $Id$
3 #
4 # Linux 2.4 kernel target for the OpenWRT project
5 #
6 # patches are sorted by numbers
7 # 0xx needed patches for board, cpu, filesystem
8 # 1xx addon patches for new features (netfilter, ebtables, cifs,..)
9 # 2xx compile fixes, driver fixes
10 #
11 #############################################################
12
13 include $(TOPDIR)/rules.mk
14 include ../rules.mk
15
16 LINUX_VERSION:=2.4.30
17 MODULES_SUBDIR:=lib/modules/$(LINUX_VERSION)
18 LINUX_KCONFIG:=./config/$(BOARD)
19 LINUX_BUILD_DIR:=$(BUILD_DIR)/linux-2.4-$(BOARD)
20 LINUX_TARGET_DIR:=$(LINUX_BUILD_DIR)/root
21 LINUX_KERNEL:=$(LINUX_BUILD_DIR)/vmlinux
22
23 LINUX_BINARY_DRIVER_SITE := http://openwrt.org/downloads/sources/
24 LINUX_SOURCE := linux-$(LINUX_VERSION).tar.bz2
25 LINUX_SOURCE_DIR := $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)
26 MODULES_DIR := $(LINUX_BUILD_DIR)/modules/$(MODULES_SUBDIR)
27 TARGET_MODULES_DIR := $(TARGET_DIR)/lib/modules/$(LINUX_VERSION)
28 IPKG_KERNEL:=IPKG_TMP=$(BUILD_DIR)/tmp IPKG_INSTROOT=$(LINUX_TARGET_DIR) IPKG_CONF_DIR=$(LINUX_BUILD_DIR) $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
29
30 PKG_BUILD_DIR := $(LINUX_BUILD_DIR)/linux-modules
31 PKG_RELEASE := 2
32
33 KERNEL_IPKG:=$(LINUX_BUILD_DIR)/kernel-$(LINUX_VERSION)-$(BOARD)_$(PKG_RELEASE)_$(ARCH).ipk
34 KERNEL_IDIR:=$(LINUX_BUILD_DIR)/kernel-ipkg
35
36 KPKG_MAKEOPTS:= IPKG="$(IPKG_KERNEL)" \
37 BOARD="$(BOARD)" \
38 TARGET_DIR="$(LINUX_TARGET_DIR)" \
39 BUILD_DIR="$(LINUX_BUILD_DIR)" \
40 KERNEL_DIR="$(LINUX_SOURCE_DIR)" \
41 LINUX_VERSION="$(LINUX_VERSION)" \
42 KERNEL_RELEASE="$(PKG_RELEASE)"
43
44 include $(LINUX_KCONFIG)
45
46 INSTALL_TARGETS := $(KERNEL_IPKG)
47 TARGETS :=
48
49 ifeq ($(BOARD),brcm)
50 include ./broadcom.mk
51 endif
52
53 ifeq ($(BOARD),soekris)
54 include ./soekris.mk
55 endif
56
57 ifeq ($(BOARD),ar7)
58 include ./ar7.mk
59 endif
60
61 $(eval $(call KMOD_template,ATM,atm,\
62 $(MODULES_DIR)/kernel/net/atm/atm.o \
63 $(MODULES_DIR)/kernel/net/atm/br2684.o \
64 ,CONFIG_ATM,,50,atm))
65 $(eval $(call KMOD_template,PPPOATM,pppoatm,\
66 $(MODULES_DIR)/kernel/net/atm/pppoatm.o \
67 ,CONFIG_PPPOATM))
68 $(eval $(call KMOD_template,USB_ACM,usb-acm,\
69 $(MODULES_DIR)/kernel/drivers/usb/acm.o \
70 ,CONFIG_USB_ACM))
71 $(eval $(call KMOD_template,B44,b44,\
72 $(MODULES_DIR)/kernel/drivers/net/b44.o \
73 ,CONFIG_B44))
74 $(eval $(call KMOD_template,BLUETOOTH,bluetooth,\
75 $(MODULES_DIR)/kernel/net/bluetooth/*.o \
76 $(MODULES_DIR)/kernel/net/bluetooth/rfcomm/*.o \
77 $(MODULES_DIR)/kernel/drivers/bluetooth/*.o \
78 ,CONFIG_BLUEZ))
79 $(eval $(call KMOD_template,ARPT,arptables,\
80 $(MODULES_DIR)/kernel/net/ipv4/netfilter/arp*.o \
81 ,CONFIG_IP_NF_ARPTABLES))
82 $(eval $(call KMOD_template,EBT,ebtables,\
83 $(MODULES_DIR)/kernel/net/bridge/netfilter/*.o \
84 ,CONFIG_BRIDGE_NF_EBTABLES))
85 $(eval $(call KMOD_template,IPTABLES_V4_EXTRA,iptables-extra,\
86 $(MODULES_DIR)/kernel/net/ipv4/netfilter/ip*.o \
87 ))
88 $(eval $(call KMOD_template,IPTABLES_V6,ip6tables,\
89 $(MODULES_DIR)/kernel/net/ipv6/netfilter/ip*.o \
90 ,CONFIG_IP6_NF_IPTABLES,kmod-ipv6))
91 $(eval $(call KMOD_template,IPV6,ipv6,\
92 $(MODULES_DIR)/kernel/net/ipv6/ipv6.o \
93 ,CONFIG_IPV6,,20,ipv6))
94 $(eval $(call KMOD_template,CIFS,cifs,\
95 $(MODULES_DIR)/kernel/fs/cifs/cifs.o \
96 ,CONFIG_CIFS,,30,cifs))
97 $(eval $(call KMOD_template,NFS,nfs,\
98 $(MODULES_DIR)/kernel/fs/lockd/*.o \
99 $(MODULES_DIR)/kernel/fs/nfs/*.o \
100 $(MODULES_DIR)/kernel/net/sunrpc/*.o \
101 ,CONFIG_NFS_FS,,30,sunrpc lockd nfs))
102 $(eval $(call KMOD_template,USB,usb-core,\
103 $(MODULES_DIR)/kernel/drivers/usb/usbcore.o \
104 ,CONFIG_USB,,50,usbcore))
105 $(eval $(call KMOD_template,USB_UHCI,usb-uhci,\
106 $(MODULES_DIR)/kernel/drivers/usb/host/uhci.o \
107 ,CONFIG_USB_UHCI_ALT,kmod-usb-core,60,uhci))
108 $(eval $(call KMOD_template,USB_OHCI,usb-ohci,\
109 $(MODULES_DIR)/kernel/drivers/usb/host/usb-ohci.o \
110 ,CONFIG_USB_OHCI,kmod-usb-core,60,usb-ohci))
111 $(eval $(call KMOD_template,USB2,usb2,\
112 $(MODULES_DIR)/kernel/drivers/usb/host/ehci-hcd.o \
113 ,CONFIG_USB_EHCI_HCD,kmod-usb-core,60,ehci-hcd))
114
115 $(eval $(call KMOD_template,USB_SERIAL,usb-serial,\
116 $(MODULES_DIR)/kernel/drivers/usb/serial/usbserial.o \
117 ,CONFIG_USB_SERIAL,kmod-usb-core,60,usbserial))
118 $(eval $(call KMOD_template,USB_SERIAL_BELKIN,usb-serial-belkin,\
119 $(MODULES_DIR)/kernel/drivers/usb/serial/belkin_sa.o \
120 ,CONFIG_USB_SERIAL_BELKIN,kmod-usb-serial,61,belkin_sa))
121 $(eval $(call KMOD_template,USB_SERIAL_FTDI,usb-serial-ftdi,\
122 $(MODULES_DIR)/kernel/drivers/usb/serial/ftdi_sio.o \
123 ,CONFIG_USB_SERIAL_IR,kmod-usb-serial,61,ftdi_usb))
124 $(eval $(call KMOD_template,USB_SERIAL_MCT_U232,usb-serial-mct-u232,\
125 $(MODULES_DIR)/kernel/drivers/usb/serial/mct_u232.o \
126 ,CONFIG_USB_SERIAL_MCT_U232,kmod-usb-serial,61,mct_u232))
127 $(eval $(call KMOD_template,USB_SERIAL_PL2303,usb-serial-pl2303,\
128 $(MODULES_DIR)/kernel/drivers/usb/serial/pl2303.o \
129 ,CONFIG_USB_SERIAL_PL2303,kmod-usb-serial,61,pl2303))
130
131 $(eval $(call KMOD_template,USB_STORAGE,usb-storage,\
132 $(MODULES_DIR)/kernel/drivers/scsi/*.o \
133 $(MODULES_DIR)/kernel/drivers/usb/storage/*.o \
134 ,CONFIG_USB_STORAGE,kmod-usb-core,60,scsi_mod sd_mod usb-storage))
135 $(eval $(call KMOD_template,USB_PRINTER,usb-printer,\
136 $(MODULES_DIR)/kernel/drivers/usb/printer.o \
137 ,CONFIG_USB_PRINTER,kmod-usb-core,60,printer))
138 $(eval $(call KMOD_template,USB_AUDIO,usb-audio,\
139 $(MODULES_DIR)/kernel/drivers/sound/soundcore.o \
140 $(MODULES_DIR)/kernel/drivers/usb/audio.o \
141 ,CONFIG_USB_AUDIO,kmod-usb-core,60,soundcore audio))
142 $(eval $(call KMOD_template,IDE,ide,\
143 $(MODULES_DIR)/kernel/drivers/ide/*.o \
144 $(MODULES_DIR)/kernel/drivers/ide/*/*.o \
145 ,CONFIG_IDE))
146 $(eval $(call KMOD_template,LOOP,loop,\
147 $(MODULES_DIR)/kernel/drivers/block/loop.o \
148 ,CONFIG_BLK_DEV_LOOP,,20,loop))
149 $(eval $(call KMOD_template,EXT2,ext2,\
150 $(MODULES_DIR)/kernel/fs/ext2/*.o \
151 ,CONFIG_EXT2_FS,,30,ext2))
152 $(eval $(call KMOD_template,EXT3,ext3,\
153 $(MODULES_DIR)/kernel/fs/ext3/*.o \
154 $(MODULES_DIR)/kernel/fs/jbd/*.o \
155 ,CONFIG_EXT3_FS,,30,jbd ext3))
156 $(eval $(call KMOD_template,XFS,xfs,\
157 $(MODULES_DIR)/kernel/fs/xfs/*.o \
158 ,CONFIG_XFS_FS,,30,xfs))
159 $(eval $(call KMOD_template,HFSPLUS,hfsplus,\
160 $(MODULES_DIR)/kernel/fs/hfsplus/*.o \
161 ,CONFIG_HFSPLUS_FS,,30,hfsplus))
162 $(eval $(call KMOD_template,VFAT,vfat,\
163 $(MODULES_DIR)/kernel/fs/vfat/vfat.o \
164 $(MODULES_DIR)/kernel/fs/fat/fat.o \
165 ,CONFIG_VFAT_FS,,30,fat vfat))
166 ifneq ($(wildcard $(MODULES_DIR)/kernel/crypto/*.o),)
167 CONFIG_CRYPTO:=m
168 endif
169 $(eval $(call KMOD_template,CRYPTO,crypto,\
170 $(MODULES_DIR)/kernel/crypto/*.o \
171 ,CONFIG_CRYPTO))
172 $(eval $(call KMOD_template,PPP,ppp,\
173 $(MODULES_DIR)/kernel/drivers/net/ppp_async.o \
174 $(MODULES_DIR)/kernel/drivers/net/ppp_generic.o \
175 $(MODULES_DIR)/kernel/drivers/net/slhc.o \
176 $(MODULES_DIR)/kernel/drivers/net/pppox.o \
177 ,CONFIG_PPP))
178 $(eval $(call KMOD_template,MPPE,mppe,\
179 $(MODULES_DIR)/kernel/drivers/net/ppp_mppe_mppc.o \
180 ,CONFIG_PPP_MPPE_MPPC))
181 $(eval $(call KMOD_template,PPPOE,pppoe,\
182 $(MODULES_DIR)/kernel/drivers/net/pppoe.o \
183 ,CONFIG_PPPOE))
184 $(eval $(call KMOD_template,TUN,tun,\
185 $(MODULES_DIR)/kernel/drivers/net/tun.o \
186 ,CONFIG_TUN,,20,tun))
187 $(eval $(call KMOD_template,GRE,gre,\
188 $(MODULES_DIR)/kernel/net/ipv4/ip_gre.o \
189 ,CONFIG_NET_IPGRE))
190 ifneq ($(wildcard $(MODULES_DIR)/kernel/net/sched/*.o),)
191 CONFIG_SCHED:=m
192 endif
193 $(eval $(call KMOD_template,SCHED,sched,\
194 $(MODULES_DIR)/kernel/net/sched/*.o \
195 ,CONFIG_SCHED))
196 $(eval $(call KMOD_template,VIDEODEV,videodev,\
197 $(MODULES_DIR)/kernel/drivers/media/video/videodev.o \
198 ,CONFIG_VIDEO_DEV))
199 $(eval $(call KMOD_template,PWC,pwc,\
200 $(MODULES_DIR)/kernel/drivers/usb/pwc.o \
201 ,CONFIG_USB_PWC))
202
203 $(TARGETS): $(PACKAGE_DIR)
204
205 $(PACKAGE_DIR):
206 mkdir -p $(PACKAGE_DIR)
207
208 $(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
209 -mkdir -p $(LINUX_BUILD_DIR)
210 bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(LINUX_BUILD_DIR) $(TAR_OPTIONS) -
211 rm -f $(LINUX_DIR)
212 ln -s $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(LINUX_DIR)
213 touch $(LINUX_DIR)/.unpacked
214
215 $(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked
216 $(PATCH) $(LINUX_DIR) ./patches/generic
217 [ -d ./patches/$(BOARD) ] && $(PATCH) $(LINUX_DIR) ./patches/$(BOARD)
218 touch $(LINUX_DIR)/.patched
219
220 $(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
221 -cp $(LINUX_KCONFIG) $(LINUX_DIR)/.config
222 $(SED) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" \
223 $(LINUX_DIR)/Makefile \
224 $(LINUX_DIR)/arch/*/Makefile
225 $(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile
226 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) oldconfig include/linux/version.h
227 touch $(LINUX_DIR)/.configured
228
229 $(LINUX_DIR)/.depend_done: $(LINUX_DIR)/.configured
230 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) dep
231 touch $(LINUX_DIR)/.depend_done
232
233 $(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.depend_done
234 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH)
235
236 $(LINUX_KERNEL): $(LINUX_DIR)/vmlinux
237 $(TARGET_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $< $@
238 touch -c $(LINUX_KERNEL)
239
240 $(LINUX_DIR)/.modules_done: $(LINUX_KERNEL) $(LINUX_IMAGE)
241 rm -rf $(LINUX_BUILD_DIR)/modules
242 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) modules
243 $(MAKE) -C $(LINUX_DIR) DEPMOD=true INSTALL_MOD_PATH=$(LINUX_BUILD_DIR)/modules modules_install
244 touch $(LINUX_DIR)/.modules_done
245
246 $(STAGING_DIR)/include/linux/version.h: $(LINUX_DIR)/.configured
247 mkdir -p $(STAGING_DIR)/include
248 tar -ch -C $(LINUX_DIR)/include -f - linux | tar -xf - -C $(STAGING_DIR)/include/
249 tar -ch -C $(LINUX_DIR)/include -f - asm | tar -xf - -C $(STAGING_DIR)/include/
250
251 $(STAMP_DIR)/.linux-compile: $(LINUX_DIR)/.modules_done
252 @mkdir -p $(STAMP_DIR)
253 @$(MAKE) $(TARGETS)
254 ln -sf $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(LINUX_DIR)
255 $(MAKE) -C $(TOPDIR)/target/linux/package \
256 $(KPKG_MAKEOPTS) \
257 compile
258 touch $@
259
260 $(TARGET_MODULES_DIR):
261 -mkdir -p $(TARGET_MODULES_DIR)
262
263 $(KERNEL_IPKG):
264 rm -rf $(KERNEL_IDIR)
265 mkdir -p $(KERNEL_IDIR)/etc
266 $(SCRIPT_DIR)/make-ipkg-dir.sh $(KERNEL_IDIR) ../control/kernel.control $(PKG_RELEASE) $(ARCH)
267 echo 'Package: kernel-$(LINUX_VERSION)-$(BOARD)' >> $(KERNEL_IDIR)/CONTROL/control
268 if [ -f ./config/$(BOARD).modules ]; then \
269 cp ./config/$(BOARD).modules $(KERNEL_IDIR)/etc/modules; \
270 fi
271 $(IPKG_BUILD) $(KERNEL_IDIR) $(LINUX_BUILD_DIR)
272
273 source: $(DL_DIR)/$(LINUX_SOURCE)
274 prepare: $(LINUX_DIR)/.configured
275 compile: $(STAMP_DIR)/.linux-compile
276
277 install: compile $(TARGET_MODULES_DIR) $(KERNEL_IPKG)
278 rm -rf $(LINUX_BUILD_DIR)/root*
279 echo -e 'dest root /\noption offline_root $(LINUX_BUILD_DIR)/root' > $(LINUX_BUILD_DIR)/ipkg.conf
280 $(MAKE) -C $(TOPDIR)/package \
281 TARGET_DIR="$(LINUX_TARGET_DIR)" \
282 IPKG_CONF="$(LINUX_BUILD_DIR)" \
283 BOARD="$(BOARD)" \
284 install
285 $(MAKE) -C $(TOPDIR)/target/linux/package \
286 $(KPKG_MAKEOPTS) \
287 install
288 [ "$(INSTALL_TARGETS)" != "" ] && $(IPKG_KERNEL) install $(INSTALL_TARGETS) || true
289
290 mostlyclean:
291 rm -f $(STAMP_DIR)/.linux-compile
292 rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.modules_done
293 rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.drivers-unpacked
294 $(MAKE) -C $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) clean
295 rm -f $(LINUX_KERNEL) $(LINUX_IMAGE)
296
297 rebuild:
298 -$(MAKE) mostlyclean
299 if [ -f $(LINUX_KERNEL) ]; then \
300 $(MAKE) clean; \
301 fi
302 $(MAKE) compile
303
304 clean:
305 rm -f $(STAMP_DIR)/.linux-compile
306 rm -rf $(LINUX_BUILD_DIR)
307 rm -f $(TARGETS)
This page took 0.06922 seconds and 5 git commands to generate.