update to new upstream release (v0.99.154),
[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_VORTEX,,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_HERMES,net-hermes,\
215 $(MODULES_DIR)/kernel/drivers/net/wireless/hermes.o \
216 $(MODULES_DIR)/kernel/drivers/net/wireless/orinoco.o \
217 ,CONFIG_HERMES,,10,hermes orinoco))
218
219 $(eval $(call KMOD_template,NET_HERMES_PCI,net-hermes-pci,\
220 $(MODULES_DIR)/kernel/drivers/net/wireless/orinoco_pci.o \
221 ,CONFIG_PCI_HERMES,kmod-net-hermes,11,orinoco_pci))
222
223 $(eval $(call KMOD_template,NET_HERMES_PCI,net-hermes-plx,\
224 $(MODULES_DIR)/kernel/drivers/net/wireless/orinoco_plx.o \
225 ,CONFIG_PLX_HERMES,kmod-net-hermes,11,orinoco_plx))
226
227 $(eval $(call KMOD_template,NET_NATSEMI,net-natsemi,\
228 $(MODULES_DIR)/kernel/drivers/net/natsemi.o \
229 ,CONFIG_NATSEMI,,10,natsemi))
230
231 $(eval $(call KMOD_template,NET_PRISM54,net-prism54,\
232 $(MODULES_DIR)/kernel/drivers/net/wireless/prism54/prism54.o \
233 ,CONFIG_PRISM54,,10,prism54))
234
235
236 # USB
237
238 $(eval $(call KMOD_template,USB,usb-core,\
239 $(MODULES_DIR)/kernel/drivers/usb/usbcore.o \
240 ,CONFIG_USB,,50,usbcore))
241
242 $(eval $(call KMOD_template,USB_UHCI,usb-uhci,\
243 $(MODULES_DIR)/kernel/drivers/usb/host/uhci.o \
244 ,CONFIG_USB_UHCI_ALT,kmod-usb-core,60,uhci))
245
246 $(eval $(call KMOD_template,USB_OHCI,usb-ohci,\
247 $(MODULES_DIR)/kernel/drivers/usb/host/usb-ohci.o \
248 ,CONFIG_USB_OHCI,kmod-usb-core,60,usb-ohci))
249
250 $(eval $(call KMOD_template,USB2,usb2,\
251 $(MODULES_DIR)/kernel/drivers/usb/host/ehci-hcd.o \
252 ,CONFIG_USB_EHCI_HCD,kmod-usb-core,60,ehci-hcd))
253
254 $(eval $(call KMOD_template,USB_ACM,usb-acm,\
255 $(MODULES_DIR)/kernel/drivers/usb/acm.o \
256 ,CONFIG_USB_ACM))
257
258 $(eval $(call KMOD_template,USB_AUDIO,usb-audio,\
259 $(MODULES_DIR)/kernel/drivers/usb/audio.o \
260 ,CONFIG_USB_AUDIO,kmod-soundcore kmod-usb-core,61,audio))
261
262 $(eval $(call KMOD_template,USB_PRINTER,usb-printer,\
263 $(MODULES_DIR)/kernel/drivers/usb/printer.o \
264 ,CONFIG_USB_PRINTER,kmod-usb-core,60,printer))
265
266 $(eval $(call KMOD_template,USB_SERIAL,usb-serial,\
267 $(MODULES_DIR)/kernel/drivers/usb/serial/usbserial.o \
268 ,CONFIG_USB_SERIAL,kmod-usb-core,60,usbserial))
269
270 $(eval $(call KMOD_template,USB_SERIAL_BELKIN,usb-serial-belkin,\
271 $(MODULES_DIR)/kernel/drivers/usb/serial/belkin_sa.o \
272 ,CONFIG_USB_SERIAL_BELKIN,kmod-usb-serial,61,belkin_sa))
273
274 $(eval $(call KMOD_template,USB_SERIAL_FTDI,usb-serial-ftdi,\
275 $(MODULES_DIR)/kernel/drivers/usb/serial/ftdi_sio.o \
276 ,CONFIG_USB_SERIAL_IR,kmod-usb-serial,61,ftdi_usb))
277
278 $(eval $(call KMOD_template,USB_SERIAL_MCT_U232,usb-serial-mct-u232,\
279 $(MODULES_DIR)/kernel/drivers/usb/serial/mct_u232.o \
280 ,CONFIG_USB_SERIAL_MCT_U232,kmod-usb-serial,61,mct_u232))
281
282 $(eval $(call KMOD_template,USB_SERIAL_PL2303,usb-serial-pl2303,\
283 $(MODULES_DIR)/kernel/drivers/usb/serial/pl2303.o \
284 ,CONFIG_USB_SERIAL_PL2303,kmod-usb-serial,61,pl2303))
285
286 $(eval $(call KMOD_template,USB_STORAGE,usb-storage,\
287 $(MODULES_DIR)/kernel/drivers/scsi/*.o \
288 $(MODULES_DIR)/kernel/drivers/usb/storage/*.o \
289 ,CONFIG_USB_STORAGE,kmod-usb-core,60,scsi_mod sd_mod usb-storage))
290
291
292 # Misc. devices
293
294 $(eval $(call KMOD_template,AX25,ax25,\
295 $(MODULES_DIR)/kernel/net/ax25/ax25.o \
296 $(MODULES_DIR)/kernel/drivers/net/hamradio/mkiss.o \
297 ,CONFIG_AX25,,90,ax25 mkiss))
298
299 $(eval $(call KMOD_template,BLUETOOTH,bluetooth,\
300 $(MODULES_DIR)/kernel/net/bluetooth/*.o \
301 $(MODULES_DIR)/kernel/net/bluetooth/rfcomm/*.o \
302 $(MODULES_DIR)/kernel/drivers/bluetooth/*.o \
303 ,CONFIG_BLUEZ))
304
305
306 $(TARGETS): $(PACKAGE_DIR)
307
308 $(PACKAGE_DIR):
309 mkdir -p $(PACKAGE_DIR)
310
311 $(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
312 -mkdir -p $(LINUX_BUILD_DIR)
313 bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(LINUX_BUILD_DIR) $(TAR_OPTIONS) -
314 rm -f $(LINUX_DIR)
315 ln -s $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(LINUX_DIR)
316 touch $(LINUX_DIR)/.unpacked
317
318 $(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked
319 $(PATCH) $(LINUX_DIR) ./patches/generic $(MAKE_TRACE)
320 [ -d ./patches/$(BOARD) ] && $(PATCH) $(LINUX_DIR) ./patches/$(BOARD) $(MAKE_TRACE)
321 touch $(LINUX_DIR)/.patched
322
323 $(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
324 -cp $(LINUX_KCONFIG) $(LINUX_DIR)/.config
325 $(SED) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" \
326 $(LINUX_DIR)/Makefile \
327 $(LINUX_DIR)/arch/*/Makefile
328 $(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile
329 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) oldconfig include/linux/version.h $(MAKE_TRACE)
330 touch $(LINUX_DIR)/.configured
331
332 $(LINUX_DIR)/.depend_done: $(LINUX_DIR)/.configured
333 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) dep $(MAKE_TRACE)
334 touch $(LINUX_DIR)/.depend_done
335
336 $(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.depend_done
337 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) $(MAKE_TRACE)
338
339 $(LINUX_KERNEL): $(LINUX_DIR)/vmlinux
340 $(TARGET_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $< $@ $(MAKE_TRACE)
341 touch -c $(LINUX_KERNEL)
342
343 $(LINUX_DIR)/.modules_done: $(LINUX_KERNEL) $(LINUX_IMAGE)
344 rm -rf $(LINUX_BUILD_DIR)/modules
345 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) modules $(MAKE_TRACE)
346 $(MAKE) -C $(LINUX_DIR) DEPMOD=true INSTALL_MOD_PATH=$(LINUX_BUILD_DIR)/modules modules_install $(MAKE_TRACE)
347 touch $(LINUX_DIR)/.modules_done
348
349 $(STAGING_DIR)/include/linux/version.h: $(LINUX_DIR)/.configured
350 mkdir -p $(STAGING_DIR)/include
351 tar -ch -C $(LINUX_DIR)/include -f - linux | tar -xf - -C $(STAGING_DIR)/include/
352 tar -ch -C $(LINUX_DIR)/include -f - asm | tar -xf - -C $(STAGING_DIR)/include/
353
354 $(STAMP_DIR)/.linux-compile: $(LINUX_DIR)/.modules_done
355 @mkdir -p $(STAMP_DIR)
356 @$(MAKE) $(TARGETS)
357 ln -sf $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(LINUX_DIR)
358 @$(TRACE) target/linux/package
359 $(MAKE) -C $(TOPDIR)/target/linux/package \
360 $(KPKG_MAKEOPTS) \
361 compile
362 touch $@
363
364 $(TARGET_MODULES_DIR):
365 -mkdir -p $(TARGET_MODULES_DIR)
366
367 $(KERNEL_IPKG):
368 rm -rf $(KERNEL_IDIR)
369 mkdir -p $(KERNEL_IDIR)/etc
370 $(SCRIPT_DIR)/make-ipkg-dir.sh $(KERNEL_IDIR) ../control/kernel.control $(PKG_RELEASE) $(ARCH)
371 echo 'Package: kernel-$(LINUX_VERSION)-$(BOARD)' >> $(KERNEL_IDIR)/CONTROL/control
372 if [ -f ./config/$(BOARD).modules ]; then \
373 cp ./config/$(BOARD).modules $(KERNEL_IDIR)/etc/modules; \
374 fi
375 $(IPKG_BUILD) $(KERNEL_IDIR) $(LINUX_BUILD_DIR) $(MAKE_TRACE)
376
377 source: $(DL_DIR)/$(LINUX_SOURCE)
378 prepare: $(LINUX_DIR)/.configured
379 compile:
380 $(MAKE) $(STAMP_DIR)/.linux-compile $(MAKE_TRACE)
381
382 install: compile $(TARGET_MODULES_DIR) $(KERNEL_IPKG)
383 rm -rf $(LINUX_BUILD_DIR)/root*
384 cp -fpR $(BUILD_DIR)/root $(LINUX_BUILD_DIR)/
385 echo -e 'dest root /\noption offline_root $(LINUX_BUILD_DIR)/root' > $(LINUX_BUILD_DIR)/ipkg.conf
386 $(MAKE) -C $(TOPDIR)/target/linux/package \
387 $(KPKG_MAKEOPTS) \
388 install
389 @{ [ "$(INSTALL_TARGETS)" != "" ] && $(IPKG_KERNEL) install $(INSTALL_TARGETS) || true; } $(MAKE_TRACE)
390
391 mostlyclean:
392 rm -f $(STAMP_DIR)/.linux-compile
393 rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.modules_done
394 rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.drivers-unpacked
395 $(MAKE) -C $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) clean $(MAKE_TRACE)
396 rm -f $(LINUX_KERNEL) $(LINUX_IMAGE)
397
398 rebuild:
399 -$(MAKE) mostlyclean
400 if [ -f $(LINUX_KERNEL) ]; then \
401 $(MAKE) clean $(MAKE_TRACE); \
402 fi
403 $(MAKE) compile $(MAKE_TRACE)
404
405 clean:
406 rm -f $(STAMP_DIR)/.linux-compile
407 rm -rf $(LINUX_BUILD_DIR)
408 rm -f $(TARGETS)
This page took 0.055475 seconds and 5 git commands to generate.