add new broadcom system code and new wlan driver (old driver still used by default)
[openwrt.git] / openwrt / target / linux / linux-2.4 / Makefile
1 # $Id$
2 # Linux 2.4 kernel target for the OpenWRT project
3
4 include $(TOPDIR)/rules.mk
5 include ../rules.mk
6
7 KERNEL:=2.4
8 LINUX_VERSION:=2.4.30
9 MODULES_SUBDIR:=lib/modules/$(LINUX_VERSION)
10 LINUX_KCONFIG:=./config/$(BOARD)
11 LINUX_BUILD_DIR:=$(BUILD_DIR)/linux-2.4-$(BOARD)
12 LINUX_TARGET_DIR:=$(LINUX_BUILD_DIR)/root
13 LINUX_KERNEL:=$(LINUX_BUILD_DIR)/vmlinux
14
15 LINUX_BINARY_DRIVER_SITE := http://openwrt.org/downloads/sources/
16 LINUX_SOURCE := linux-$(LINUX_VERSION).tar.bz2
17 LINUX_SOURCE_DIR := $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)
18 MODULES_DIR := $(LINUX_BUILD_DIR)/modules/$(MODULES_SUBDIR)
19 TARGET_MODULES_DIR := $(LINUX_TARGET_DIR)/lib/modules/$(LINUX_VERSION)
20 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
21
22 PKG_BUILD_DIR := $(LINUX_BUILD_DIR)/linux-modules
23 PKG_RELEASE := 2
24
25 KERNEL_IPKG:=$(LINUX_BUILD_DIR)/kernel_$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE)_$(ARCH).ipk
26 KERNEL_IDIR:=$(LINUX_BUILD_DIR)/kernel-ipkg
27
28 KPKG_MAKEOPTS:= IPKG="$(IPKG_KERNEL)" \
29 BOARD="$(BOARD)" \
30 TARGET_DIR="$(LINUX_TARGET_DIR)" \
31 BUILD_DIR="$(LINUX_BUILD_DIR)" \
32 KERNEL_DIR="$(LINUX_SOURCE_DIR)" \
33 LINUX_VERSION="$(LINUX_VERSION)" \
34 KERNEL_RELEASE="$(PKG_RELEASE)"
35
36 include $(LINUX_KCONFIG)
37
38 INSTALL_TARGETS := $(KERNEL_IPKG)
39 TARGETS :=
40
41 ifeq ($(BOARD),brcm)
42 include ./broadcom.mk
43 endif
44
45 ifeq ($(BOARD),x86)
46 include ./x86.mk
47 endif
48
49 ifeq ($(BOARD),ar7)
50 include ./ar7.mk
51 endif
52
53
54 # Networking
55
56 $(eval $(call KMOD_template,ATM,atm,\
57 $(MODULES_DIR)/kernel/net/atm/atm.o \
58 $(MODULES_DIR)/kernel/net/atm/br2684.o \
59 ,CONFIG_ATM,,50,atm))
60
61 $(eval $(call KMOD_template,GRE,gre,\
62 $(MODULES_DIR)/kernel/net/ipv4/ip_gre.o \
63 ,CONFIG_NET_IPGRE))
64
65 $(eval $(call KMOD_template,IPV6,ipv6,\
66 $(MODULES_DIR)/kernel/net/ipv6/ipv6.o \
67 ,CONFIG_IPV6,,20,ipv6))
68
69 $(eval $(call KMOD_template,PPP,ppp,\
70 $(MODULES_DIR)/kernel/drivers/net/ppp_async.o \
71 $(MODULES_DIR)/kernel/drivers/net/ppp_generic.o \
72 $(MODULES_DIR)/kernel/drivers/net/slhc.o \
73 $(MODULES_DIR)/kernel/drivers/net/pppox.o \
74 ,CONFIG_PPP))
75
76 $(eval $(call KMOD_template,MPPE,mppe,\
77 $(MODULES_DIR)/kernel/drivers/net/ppp_mppe_mppc.o \
78 ,CONFIG_PPP_MPPE_MPPC))
79
80 $(eval $(call KMOD_template,PPPOATM,pppoatm,\
81 $(MODULES_DIR)/kernel/net/atm/pppoatm.o \
82 ,CONFIG_PPPOATM))
83
84 $(eval $(call KMOD_template,PPPOE,pppoe,\
85 $(MODULES_DIR)/kernel/drivers/net/pppoe.o \
86 ,CONFIG_PPPOE))
87
88 ifneq ($(wildcard $(MODULES_DIR)/kernel/net/sched/*.o),)
89 CONFIG_SCHED:=m
90 endif
91 $(eval $(call KMOD_template,SCHED,sched,\
92 $(MODULES_DIR)/kernel/net/sched/*.o \
93 ,CONFIG_SCHED))
94
95 $(eval $(call KMOD_template,TUN,tun,\
96 $(MODULES_DIR)/kernel/drivers/net/tun.o \
97 ,CONFIG_TUN,,20,tun))
98
99
100 # Filtering / Firewalling
101
102 $(eval $(call KMOD_template,ARPTABLES,arptables,\
103 $(MODULES_DIR)/kernel/net/ipv4/netfilter/arp*.o \
104 ,CONFIG_IP_NF_ARPTABLES))
105
106 $(eval $(call KMOD_template,EBTABLES,ebtables,\
107 $(MODULES_DIR)/kernel/net/bridge/netfilter/*.o \
108 ,CONFIG_BRIDGE_NF_EBTABLES))
109
110 $(eval $(call KMOD_template,IPTABLES_V4_EXTRA,iptables-extra,\
111 $(MODULES_DIR)/kernel/net/ipv4/netfilter/ip*.o \
112 ))
113
114 $(eval $(call KMOD_template,IPTABLES_V6,ip6tables,\
115 $(MODULES_DIR)/kernel/net/ipv6/netfilter/ip*.o \
116 ,CONFIG_IP6_NF_IPTABLES,kmod-ipv6))
117
118
119 # Block devices
120
121 $(eval $(call KMOD_template,IDE,ide,\
122 $(MODULES_DIR)/kernel/drivers/ide/*.o \
123 $(MODULES_DIR)/kernel/drivers/ide/*/*.o \
124 ,CONFIG_IDE))
125
126 $(eval $(call KMOD_template,LOOP,loop,\
127 $(MODULES_DIR)/kernel/drivers/block/loop.o \
128 ,CONFIG_BLK_DEV_LOOP,,20,loop))
129
130 $(eval $(call KMOD_template,NBD,nbd,\
131 $(MODULES_DIR)/kernel/drivers/block/nbd.o \
132 ,CONFIG_BLK_DEV_NBD,,20,nbd))
133
134
135 # Crypto
136
137 ifneq ($(wildcard $(MODULES_DIR)/kernel/crypto/*.o),)
138 CONFIG_CRYPTO:=m
139 endif
140 $(eval $(call KMOD_template,CRYPTO,crypto,\
141 $(MODULES_DIR)/kernel/crypto/*.o \
142 ,CONFIG_CRYPTO))
143
144
145 # Filesystems
146
147 $(eval $(call KMOD_template,FS_CIFS,fs-cifs,\
148 $(MODULES_DIR)/kernel/fs/cifs/cifs.o \
149 ,CONFIG_CIFS,,30,cifs))
150
151 $(eval $(call KMOD_template,FS_EXT2,fs-ext2,\
152 $(MODULES_DIR)/kernel/fs/ext2/*.o \
153 ,CONFIG_EXT2_FS,,30,ext2))
154
155 $(eval $(call KMOD_template,FS_EXT3,fs-ext3,\
156 $(MODULES_DIR)/kernel/fs/ext3/*.o \
157 $(MODULES_DIR)/kernel/fs/jbd/*.o \
158 ,CONFIG_EXT3_FS,,30,jbd ext3))
159
160 $(eval $(call KMOD_template,FS_HFSPLUS,fs-hfsplus,\
161 $(MODULES_DIR)/kernel/fs/hfsplus/*.o \
162 ,CONFIG_HFSPLUS_FS,,30,hfsplus))
163
164 $(eval $(call KMOD_template,FS_NFS,fs-nfs,\
165 $(MODULES_DIR)/kernel/fs/lockd/*.o \
166 $(MODULES_DIR)/kernel/fs/nfs/*.o \
167 $(MODULES_DIR)/kernel/net/sunrpc/*.o \
168 ,CONFIG_NFS_FS,,30,sunrpc lockd nfs))
169
170 $(eval $(call KMOD_template,FS_VFAT,fs-vfat,\
171 $(MODULES_DIR)/kernel/fs/vfat/vfat.o \
172 $(MODULES_DIR)/kernel/fs/fat/fat.o \
173 ,CONFIG_VFAT_FS,,30,fat vfat))
174
175 $(eval $(call KMOD_template,FS_XFS,fs-xfs,\
176 $(MODULES_DIR)/kernel/fs/xfs/*.o \
177 ,CONFIG_XFS_FS,,30,xfs))
178
179
180 # Multimedia
181
182 $(eval $(call KMOD_template,PWC,pwc,\
183 $(MODULES_DIR)/kernel/drivers/usb/pwc.o \
184 ,CONFIG_USB_PWC,kmod-videodev,63,pwc))
185
186 $(eval $(call KMOD_template,SOUNDCORE,soundcore,\
187 $(MODULES_DIR)/kernel/drivers/sound/soundcore.o \
188 ,CONFIG_SOUND,,30,soundcore))
189
190 $(eval $(call KMOD_template,VIDEODEV,videodev,\
191 $(MODULES_DIR)/kernel/drivers/media/video/videodev.o \
192 ,CONFIG_VIDEO_DEV,,62,videodev))
193
194
195 # Network devices
196
197 $(eval $(call KMOD_template,NET_3C59X,net-3c59x,\
198 $(MODULES_DIR)/kernel/drivers/net/3c59x.o \
199 ,CONFIG_VORTEX,,10,3c59x))
200
201 $(eval $(call KMOD_template,NET_8139TOO,net-8139too,\
202 $(MODULES_DIR)/kernel/drivers/net/8139too.o \
203 $(MODULES_DIR)/kernel/drivers/net/mii.o \
204 ,CONFIG_8139TOO,,10,mii 8139too))
205
206 $(eval $(call KMOD_template,NET_AIRO,net-airo,\
207 $(MODULES_DIR)/kernel/drivers/net/wireless/airo.o \
208 ,CONFIG_AIRO,,10,airo))
209
210 $(eval $(call KMOD_template,NET_B44,net-b44,\
211 $(MODULES_DIR)/kernel/drivers/net/b44.o \
212 ,CONFIG_B44,,10,b44))
213
214 $(eval $(call KMOD_template,NET_E100,net-e100,\
215 $(MODULES_DIR)/kernel/drivers/net/e100.o \
216 ,CONFIG_E100,,10,e100))
217
218 $(eval $(call KMOD_template,NET_HERMES,net-hermes,\
219 $(MODULES_DIR)/kernel/drivers/net/wireless/hermes.o \
220 $(MODULES_DIR)/kernel/drivers/net/wireless/orinoco.o \
221 ,CONFIG_HERMES,,10,hermes orinoco))
222
223 $(eval $(call KMOD_template,NET_HERMES_PCI,net-hermes-pci,\
224 $(MODULES_DIR)/kernel/drivers/net/wireless/orinoco_pci.o \
225 ,CONFIG_PCI_HERMES,kmod-net-hermes,11,orinoco_pci))
226
227 $(eval $(call KMOD_template,NET_HERMES_PCI,net-hermes-plx,\
228 $(MODULES_DIR)/kernel/drivers/net/wireless/orinoco_plx.o \
229 ,CONFIG_PLX_HERMES,kmod-net-hermes,11,orinoco_plx))
230
231 $(eval $(call KMOD_template,NET_NATSEMI,net-natsemi,\
232 $(MODULES_DIR)/kernel/drivers/net/natsemi.o \
233 ,CONFIG_NATSEMI,,10,natsemi))
234
235 $(eval $(call KMOD_template,NET_PRISM54,net-prism54,\
236 $(MODULES_DIR)/kernel/drivers/net/wireless/prism54/prism54.o \
237 ,CONFIG_PRISM54,,10,prism54))
238
239
240 # PCMCIA/CardBus
241
242 $(eval $(call KMOD_template,PCMCIA_CORE,pcmcia-core,\
243 $(MODULES_DIR)/kernel/drivers/pcmcia/pcmcia_core.o \
244 $(MODULES_DIR)/kernel/drivers/pcmcia/ds.o \
245 $(MODULES_DIR)/kernel/drivers/pcmcia/yenta_socket.o \
246 ,CONFIG_PCMCIA,,50,pcmcia_core))
247
248
249 # USB
250
251 $(eval $(call KMOD_template,USB,usb-core,\
252 $(MODULES_DIR)/kernel/drivers/usb/usbcore.o \
253 ,CONFIG_USB,,50,usbcore))
254
255 $(eval $(call KMOD_template,USB_OHCI,usb-ohci,\
256 $(MODULES_DIR)/kernel/drivers/usb/host/usb-ohci.o \
257 ,CONFIG_USB_OHCI,kmod-usb-core,60,usb-ohci))
258
259 $(eval $(call KMOD_template,USB_UHCI,usb-uhci,\
260 $(MODULES_DIR)/kernel/drivers/usb/host/uhci.o \
261 ,CONFIG_USB_UHCI_ALT,kmod-usb-core,60,uhci))
262
263 $(eval $(call KMOD_template,USB2,usb2,\
264 $(MODULES_DIR)/kernel/drivers/usb/host/ehci-hcd.o \
265 ,CONFIG_USB_EHCI_HCD,kmod-usb-core,60,ehci-hcd))
266
267 $(eval $(call KMOD_template,USB_ACM,usb-acm,\
268 $(MODULES_DIR)/kernel/drivers/usb/acm.o \
269 ,CONFIG_USB_ACM))
270
271 $(eval $(call KMOD_template,USB_AUDIO,usb-audio,\
272 $(MODULES_DIR)/kernel/drivers/usb/audio.o \
273 ,CONFIG_USB_AUDIO,kmod-soundcore kmod-usb-core,61,audio))
274
275 $(eval $(call KMOD_template,USB_PRINTER,usb-printer,\
276 $(MODULES_DIR)/kernel/drivers/usb/printer.o \
277 ,CONFIG_USB_PRINTER,kmod-usb-core,60,printer))
278
279 $(eval $(call KMOD_template,USB_SERIAL,usb-serial,\
280 $(MODULES_DIR)/kernel/drivers/usb/serial/usbserial.o \
281 ,CONFIG_USB_SERIAL,kmod-usb-core,60,usbserial))
282
283 $(eval $(call KMOD_template,USB_SERIAL_BELKIN,usb-serial-belkin,\
284 $(MODULES_DIR)/kernel/drivers/usb/serial/belkin_sa.o \
285 ,CONFIG_USB_SERIAL_BELKIN,kmod-usb-serial,61,belkin_sa))
286
287 $(eval $(call KMOD_template,USB_SERIAL_FTDI,usb-serial-ftdi,\
288 $(MODULES_DIR)/kernel/drivers/usb/serial/ftdi_sio.o \
289 ,CONFIG_USB_SERIAL_FTDI_SIO,kmod-usb-serial,61,ftdi_sio))
290
291 $(eval $(call KMOD_template,USB_SERIAL_MCT_U232,usb-serial-mct-u232,\
292 $(MODULES_DIR)/kernel/drivers/usb/serial/mct_u232.o \
293 ,CONFIG_USB_SERIAL_MCT_U232,kmod-usb-serial,61,mct_u232))
294
295 $(eval $(call KMOD_template,USB_SERIAL_PL2303,usb-serial-pl2303,\
296 $(MODULES_DIR)/kernel/drivers/usb/serial/pl2303.o \
297 ,CONFIG_USB_SERIAL_PL2303,kmod-usb-serial,61,pl2303))
298
299 $(eval $(call KMOD_template,USB_STORAGE,usb-storage,\
300 $(MODULES_DIR)/kernel/drivers/scsi/*.o \
301 $(MODULES_DIR)/kernel/drivers/usb/storage/*.o \
302 ,CONFIG_USB_STORAGE,kmod-usb-core,60,scsi_mod sd_mod usb-storage))
303
304
305 # Misc. devices
306
307 $(eval $(call KMOD_template,AX25,ax25,\
308 $(MODULES_DIR)/kernel/net/ax25/ax25.o \
309 $(MODULES_DIR)/kernel/drivers/net/hamradio/mkiss.o \
310 ,CONFIG_AX25,,90,ax25 mkiss))
311
312 $(eval $(call KMOD_template,BLUETOOTH,bluetooth,\
313 $(MODULES_DIR)/kernel/net/bluetooth/*.o \
314 $(MODULES_DIR)/kernel/net/bluetooth/rfcomm/*.o \
315 $(MODULES_DIR)/kernel/drivers/bluetooth/*.o \
316 ,CONFIG_BLUEZ))
317
318
319 $(TARGETS): $(PACKAGE_DIR)
320
321 $(PACKAGE_DIR):
322 mkdir -p $(PACKAGE_DIR)
323
324 $(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
325 -mkdir -p $(LINUX_BUILD_DIR)
326 bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(LINUX_BUILD_DIR) $(TAR_OPTIONS) -
327 rm -f $(LINUX_DIR)
328 ln -s $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(LINUX_DIR)
329 touch $(LINUX_DIR)/.unpacked
330
331 $(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked
332 $(PATCH) $(LINUX_DIR) ./patches/generic $(MAKE_TRACE)
333 [ -d ./patches/$(BOARD) ] && $(PATCH) $(LINUX_DIR) ./patches/$(BOARD) $(MAKE_TRACE)
334 touch $(LINUX_DIR)/.patched
335
336 $(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
337 -cp $(LINUX_KCONFIG) $(LINUX_DIR)/.config
338 $(SED) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" \
339 $(LINUX_DIR)/Makefile \
340 $(LINUX_DIR)/arch/*/Makefile
341 $(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile
342 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) oldconfig include/linux/version.h $(MAKE_TRACE)
343 touch $(LINUX_DIR)/.configured
344
345 $(LINUX_DIR)/.depend_done: $(LINUX_DIR)/.configured
346 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) dep $(MAKE_TRACE)
347 touch $(LINUX_DIR)/.depend_done
348
349 $(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.depend_done
350 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) $(MAKE_TRACE)
351
352 $(LINUX_KERNEL): $(LINUX_DIR)/vmlinux
353 $(TARGET_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $< $@ $(MAKE_TRACE)
354 touch -c $(LINUX_KERNEL)
355
356 $(LINUX_DIR)/.modules_done: $(LINUX_KERNEL) $(LINUX_IMAGE)
357 rm -rf $(LINUX_BUILD_DIR)/modules
358 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) modules $(MAKE_TRACE)
359 $(MAKE) -C $(LINUX_DIR) DEPMOD=true INSTALL_MOD_PATH=$(LINUX_BUILD_DIR)/modules modules_install $(MAKE_TRACE)
360 touch $(LINUX_DIR)/.modules_done
361
362 $(STAGING_DIR)/include/linux/version.h: $(LINUX_DIR)/.configured
363 mkdir -p $(STAGING_DIR)/include
364 tar -ch -C $(LINUX_DIR)/include -f - linux | tar -xf - -C $(STAGING_DIR)/include/
365 tar -ch -C $(LINUX_DIR)/include -f - asm | tar -xf - -C $(STAGING_DIR)/include/
366
367 $(STAMP_DIR)/.linux-compile: $(LINUX_DIR)/.modules_done
368 @mkdir -p $(STAMP_DIR)
369 @$(MAKE) $(TARGETS)
370 ln -sf $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(LINUX_DIR)
371 @$(TRACE) target/linux/package
372 $(MAKE) -C $(TOPDIR)/target/linux/package \
373 $(KPKG_MAKEOPTS) \
374 compile
375 touch $@
376
377 $(TARGET_MODULES_DIR):
378 -mkdir -p $(TARGET_MODULES_DIR)
379
380 $(KERNEL_IPKG):
381 rm -rf $(KERNEL_IDIR)
382 mkdir -p $(KERNEL_IDIR)/etc
383 $(SCRIPT_DIR)/make-ipkg-dir.sh $(KERNEL_IDIR) ../control/kernel.control $(PKG_RELEASE) $(ARCH)
384 echo 'Package: kernel-$(LINUX_VERSION)-$(BOARD)' >> $(KERNEL_IDIR)/CONTROL/control
385 if [ -f ./config/$(BOARD).modules ]; then \
386 cp ./config/$(BOARD).modules $(KERNEL_IDIR)/etc/modules; \
387 fi
388 $(IPKG_BUILD) $(KERNEL_IDIR) $(LINUX_BUILD_DIR) $(MAKE_TRACE)
389
390 source: $(DL_DIR)/$(LINUX_SOURCE)
391 prepare: $(LINUX_DIR)/.configured
392 compile:
393 $(MAKE) $(STAMP_DIR)/.linux-compile $(MAKE_TRACE)
394
395 install: compile $(TARGET_MODULES_DIR) $(KERNEL_IPKG)
396 rm -rf $(LINUX_BUILD_DIR)/root*
397 cp -fpR $(BUILD_DIR)/root $(LINUX_BUILD_DIR)/
398 echo -e 'dest root /\noption offline_root $(LINUX_BUILD_DIR)/root' > $(LINUX_BUILD_DIR)/ipkg.conf
399 $(MAKE) -C $(TOPDIR)/target/linux/package \
400 $(KPKG_MAKEOPTS) \
401 install
402 @{ [ "$(INSTALL_TARGETS)" != "" ] && $(IPKG_KERNEL) install $(INSTALL_TARGETS) || true; } $(MAKE_TRACE)
403
404 mostlyclean:
405 rm -f $(STAMP_DIR)/.linux-compile
406 rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.modules_done
407 rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.drivers-unpacked
408 $(MAKE) -C $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) clean $(MAKE_TRACE)
409 rm -f $(LINUX_KERNEL) $(LINUX_IMAGE)
410
411 rebuild:
412 -$(MAKE) mostlyclean
413 if [ -f $(LINUX_KERNEL) ]; then \
414 $(MAKE) clean $(MAKE_TRACE); \
415 fi
416 $(MAKE) compile $(MAKE_TRACE)
417
418 clean:
419 rm -f $(STAMP_DIR)/.linux-compile
420 rm -rf $(LINUX_BUILD_DIR)
421 rm -f $(TARGETS)
This page took 0.055505 seconds and 5 git commands to generate.