upgrade kernel to 2.6.15 final
[openwrt/staging/mkresin.git] / openwrt / target / linux / linux-2.6 / Makefile
1 # $Id$
2 # Linux 2.6 kernel target for the OpenWRT project
3
4 include $(TOPDIR)/rules.mk
5 include ../rules.mk
6
7 KERNEL:=2.6
8 LINUX_VERSION:=2.6.15
9 LINUX_KERNEL_MD5SUM:=cdf95e00f5111e31f78e1d97304d9522
10 LINUX_SITE=http://www.fi.kernel.org/pub/linux/kernel/v2.6 \
11 http://www.fr.kernel.org/pub/linux/kernel/v2.6 \
12 http://www.kernel.org/pub/linux/kernel/v2.6 \
13 http://www.de.kernel.org/pub/linux/kernel/v2.6
14 MODULES_SUBDIR:=lib/modules/$(LINUX_VERSION)
15 LINUX_KCONFIG:=./config/$(BOARD)
16 LINUX_BUILD_DIR:=$(BUILD_DIR)/linux-2.6-$(BOARD)
17 LINUX_TARGET_DIR:=$(LINUX_BUILD_DIR)/root
18 LINUX_KERNEL:=$(LINUX_BUILD_DIR)/vmlinux
19 LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \
20 -e 's/mipsel/mips/' \
21 -e 's/powerpc/ppc/' \
22 -e 's/sh[234]/sh/' \
23 )
24
25 LINUX_SOURCE := linux-$(LINUX_VERSION).tar.bz2
26 LINUX_SOURCE_DIR := $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)
27 MODULES_DIR := $(LINUX_BUILD_DIR)/modules/$(MODULES_SUBDIR)
28 TARGET_MODULES_DIR := $(LINUX_TARGET_DIR)/lib/modules/$(LINUX_VERSION)
29 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
30
31 PKG_BUILD_DIR := $(LINUX_BUILD_DIR)/linux-modules
32 PKG_RELEASE := 1
33
34 KERNEL_IPKG:=$(LINUX_BUILD_DIR)/kernel_$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE)_$(ARCH).ipk
35 KERNEL_IDIR:=$(LINUX_BUILD_DIR)/kernel-ipkg
36
37 KPKG_MAKEOPTS:= IPKG="$(IPKG_KERNEL)" \
38 BOARD="$(BOARD)" \
39 TARGET_DIR="$(LINUX_TARGET_DIR)" \
40 BUILD_DIR="$(LINUX_BUILD_DIR)" \
41 KERNEL_DIR="$(LINUX_SOURCE_DIR)" \
42 LINUX_VERSION="$(LINUX_VERSION)" \
43 KERNEL_RELEASE="$(PKG_RELEASE)"
44
45 include $(LINUX_KCONFIG)
46
47 INSTALL_TARGETS := $(KERNEL_IPKG)
48 TARGETS :=
49
50 ifeq ($(BOARD),x86)
51 include ./x86.mk
52 endif
53
54 include ../netfilter.mk
55
56 # Networking
57
58 $(eval $(call KMOD_template,ATM,atm,\
59 $(MODULES_DIR)/kernel/net/atm/atm.ko \
60 $(MODULES_DIR)/kernel/net/atm/br2684.ko \
61 $(MODULES_DIR)/kernel/drivers/atm/atmtcp.ko \
62 ,CONFIG_ATM,,50,atm))
63
64 $(eval $(call KMOD_template,GRE,gre,\
65 $(MODULES_DIR)/kernel/net/ipv4/ip_gre.ko \
66 ,CONFIG_NET_IPGRE))
67
68 $(eval $(call KMOD_template,IMQ,imq,\
69 $(MODULES_DIR)/kernel/net/*/netfilter/*IMQ*.ko \
70 $(MODULES_DIR)/kernel/drivers/net/imq.ko \
71 ))
72
73 $(eval $(call KMOD_template,IPV6,ipv6,\
74 $(MODULES_DIR)/kernel/net/ipv6/ipv6.ko \
75 ,CONFIG_IPV6,,20,ipv6))
76
77 $(eval $(call KMOD_template,PPP,ppp,\
78 $(MODULES_DIR)/kernel/drivers/net/ppp_async.ko \
79 $(MODULES_DIR)/kernel/drivers/net/ppp_generic.ko \
80 $(MODULES_DIR)/kernel/drivers/net/slhc.ko \
81 ,CONFIG_PPP))
82
83 #$(eval $(call KMOD_template,MPPE,mppe,\
84 # $(MODULES_DIR)/kernel/drivers/net/ppp_mppe_mppc.ko \
85 #,CONFIG_PPP_MPPE_MPPC))
86
87 $(eval $(call KMOD_template,PPPOATM,pppoatm,\
88 $(MODULES_DIR)/kernel/net/atm/pppoatm.ko \
89 ,CONFIG_PPPOATM))
90
91 $(eval $(call KMOD_template,PPPOE,pppoe,\
92 $(MODULES_DIR)/kernel/drivers/net/pppoe.ko \
93 $(MODULES_DIR)/kernel/drivers/net/pppox.ko \
94 ,CONFIG_PPPOE))
95
96 $(eval $(call KMOD_template,SCHED,sched,\
97 $(MODULES_DIR)/kernel/net/sched/*.ko \
98 ))
99
100 $(eval $(call KMOD_template,TUN,tun,\
101 $(MODULES_DIR)/kernel/drivers/net/tun.ko \
102 ,CONFIG_TUN,,20,tun))
103
104
105 # Filtering / Firewalling
106
107 $(eval $(call KMOD_template,ARPTABLES,arptables,\
108 $(MODULES_DIR)/kernel/net/ipv4/netfilter/arp*.ko \
109 ,CONFIG_IP_NF_ARPTABLES))
110
111 $(eval $(call KMOD_template,EBTABLES,ebtables,\
112 $(MODULES_DIR)/kernel/net/bridge/netfilter/*.ko \
113 ,CONFIG_BRIDGE_NF_EBTABLES))
114
115 # metapackage for compatibility ...
116 $(eval $(call KMOD_template,IPTABLES_EXTRA,iptables-extra,\
117 ,,kmod-ipt-conntrack kmod-ipt-extra kmod-ipt-filter kmod-ipt-ipopt kmod-ipt-ipsec kmod-ipt-nat kmod-ipt-nat-extra kmod-ipt-queue kmod-ipt-ulogd))
118
119 $(eval $(call KMOD_template,IPT_CONNTRACK,ipt-conntrack,\
120 $(foreach mod,$(IPT_CONNTRACK-m),$(MODULES_DIR)/kernel/net/ipv4/netfilter/$(mod).ko) \
121 ))
122
123 $(eval $(call KMOD_template,IPT_EXTRA,ipt-extra,\
124 $(foreach mod,$(IPT_EXTRA-m),$(MODULES_DIR)/kernel/net/ipv4/netfilter/$(mod).ko) \
125 ))
126
127 $(eval $(call KMOD_template,IPT_FILTER,ipt-filter,\
128 $(foreach mod,$(IPT_FILTER-m),$(MODULES_DIR)/kernel/net/ipv4/netfilter/$(mod).ko) \
129 ))
130
131 $(eval $(call KMOD_template,IPT_IPOPT,ipt-ipopt,\
132 $(foreach mod,$(IPT_IPOPT-m),$(MODULES_DIR)/kernel/net/ipv4/netfilter/$(mod).ko) \
133 ))
134
135 $(eval $(call KMOD_template,IPT_IPSEC,ipt-ipsec,\
136 $(foreach mod,$(IPT_IPSEC-m),$(MODULES_DIR)/kernel/net/ipv4/netfilter/$(mod).ko) \
137 ))
138
139 $(eval $(call KMOD_template,IPT_NAT,ipt-nat,\
140 $(foreach mod,$(IPT_NAT-m),$(MODULES_DIR)/kernel/net/ipv4/netfilter/$(mod).ko) \
141 ))
142
143 $(eval $(call KMOD_template,IPT_NAT_EXTRA,ipt-nat-extra,\
144 $(foreach mod,$(IPT_NAT_EXTRA-m),$(MODULES_DIR)/kernel/net/ipv4/netfilter/$(mod).ko) \
145 ,,,40,$(IPT_NAT_EXTRA-m)))
146
147 $(eval $(call KMOD_template,IPT_QUEUE,ipt-queue,\
148 $(foreach mod,$(IPT_QUEUE-m),$(MODULES_DIR)/kernel/net/ipv4/netfilter/$(mod).ko) \
149 ))
150
151 $(eval $(call KMOD_template,IPT_ULOG,ipt-ulog,\
152 $(foreach mod,$(IPT_ULOG-m),$(MODULES_DIR)/kernel/net/ipv4/netfilter/$(mod).ko) \
153 ))
154
155 $(eval $(call KMOD_template,IP6TABLES,ip6tables,\
156 $(MODULES_DIR)/kernel/net/ipv6/netfilter/ip*.ko \
157 ,CONFIG_IP6_NF_IPTABLES,kmod-ipv6))
158
159
160 # Block devices
161
162 $(eval $(call KMOD_template,IDE,ide,\
163 $(MODULES_DIR)/kernel/drivers/ide/*.ko \
164 $(MODULES_DIR)/kernel/drivers/ide/*/*.ko \
165 ,CONFIG_IDE))
166
167 $(eval $(call KMOD_template,LOOP,loop,\
168 $(MODULES_DIR)/kernel/drivers/block/loop.ko \
169 ,CONFIG_BLK_DEV_LOOP,,20,loop))
170
171 $(eval $(call KMOD_template,NBD,nbd,\
172 $(MODULES_DIR)/kernel/drivers/block/nbd.ko \
173 ,CONFIG_BLK_DEV_NBD,,20,nbd))
174
175
176 # Crypto
177
178 $(eval $(call KMOD_template,CRYPTO,crypto,\
179 $(MODULES_DIR)/kernel/crypto/*.ko \
180 ))
181
182
183 # Filesystems
184
185 $(eval $(call KMOD_template,FS_CIFS,fs-cifs,\
186 $(MODULES_DIR)/kernel/fs/cifs/cifs.ko \
187 ,CONFIG_CIFS,kmod-nls-base,30,cifs))
188
189 $(eval $(call KMOD_template,FS_EXT2,fs-ext2,\
190 $(MODULES_DIR)/kernel/fs/ext2/ext2.ko \
191 ,CONFIG_EXT2_FS,,30,ext2))
192
193 $(eval $(call KMOD_template,FS_EXT3,fs-ext3,\
194 $(MODULES_DIR)/kernel/fs/ext3/ext3.ko \
195 $(MODULES_DIR)/kernel/fs/jbd/jbd.ko \
196 ,CONFIG_EXT3_FS,,30,jbd ext3))
197
198 $(eval $(call KMOD_template,FS_HFSPLUS,fs-hfsplus,\
199 $(MODULES_DIR)/kernel/fs/hfsplus/hfsplus.ko \
200 ,CONFIG_HFSPLUS_FS,kmod-nls-base,30,hfsplus))
201
202 $(eval $(call KMOD_template,FS_NFS,fs-nfs,\
203 $(MODULES_DIR)/kernel/fs/lockd/lockd.ko \
204 $(MODULES_DIR)/kernel/fs/nfs/nfs.ko \
205 $(MODULES_DIR)/kernel/net/sunrpc/sunrpc.ko \
206 ,CONFIG_NFS_FS,,30,sunrpc lockd nfs))
207
208 $(eval $(call KMOD_template,FS_VFAT,fs-vfat,\
209 $(MODULES_DIR)/kernel/fs/fat/fat.ko \
210 $(MODULES_DIR)/kernel/fs/vfat/vfat.ko \
211 ,CONFIG_VFAT_FS,kmod-nls-base,30,fat vfat))
212
213 $(eval $(call KMOD_template,FS_XFS,fs-xfs,\
214 $(MODULES_DIR)/kernel/fs/xfs/xfs.ko \
215 ,CONFIG_XFS_FS,,30,xfs))
216
217
218 # Multimedia
219
220 $(eval $(call KMOD_template,PWC,pwc,\
221 $(MODULES_DIR)/kernel/drivers/usb/media/pwc/pwc.ko \
222 ,CONFIG_USB_PWC,kmod-videodev,63,pwc))
223
224 $(eval $(call KMOD_template,SOUNDCORE,soundcore,\
225 $(MODULES_DIR)/kernel/sound/soundcore.ko \
226 ,CONFIG_SOUND,,30,soundcore))
227
228 $(eval $(call KMOD_template,VIDEODEV,videodev,\
229 $(MODULES_DIR)/kernel/drivers/media/video/v4l1-compat.ko \
230 $(MODULES_DIR)/kernel/drivers/media/video/v4l2-common.ko \
231 $(MODULES_DIR)/kernel/drivers/media/video/videodev.ko \
232 ,CONFIG_VIDEO_DEV,,62,videodev))
233
234
235 # NLS
236
237 $(eval $(call KMOD_template,NLS_BASE,nls-base,\
238 $(MODULES_DIR)/kernel/fs/nls/nls_base.ko \
239 ,CONFIG_NLS,,20,nls_base))
240
241 $(eval $(call KMOD_template,NLS_CP437,nls-cp437,\
242 $(MODULES_DIR)/kernel/fs/nls/nls_cp437.ko \
243 ,CONFIG_NLS_CODEPAGE_437,,20,nls_cp437))
244
245 $(eval $(call KMOD_template,NLS_CP850,nls-cp850,\
246 $(MODULES_DIR)/kernel/fs/nls/nls_cp850.ko \
247 ,CONFIG_NLS_CODEPAGE_850,,20,nls_cp850))
248
249 $(eval $(call KMOD_template,NLS_ISO8859_1,nls-iso8859-1,\
250 $(MODULES_DIR)/kernel/fs/nls/nls_iso8859-1.ko \
251 ,CONFIG_NLS_ISO8859_1,,20,nls_iso8859-1))
252
253 $(eval $(call KMOD_template,NLS_ISO8859_15,nls-iso8859-15,\
254 $(MODULES_DIR)/kernel/fs/nls/nls_iso8859-15.ko \
255 ,CONFIG_NLS_ISO8859_15,,20,nls_iso8859-15))
256
257 $(eval $(call KMOD_template,NLS_UTF8,nls-utf8,\
258 $(MODULES_DIR)/kernel/fs/nls/nls_utf8.ko \
259 ,CONFIG_NLS_UTF8,,20,nls_utf8))
260
261
262 # Network devices
263
264 $(eval $(call KMOD_template,NET_3C59X,net-3c59x,\
265 $(MODULES_DIR)/kernel/drivers/net/3c59x.ko \
266 ,CONFIG_VORTEX,,10,3c59x))
267
268 $(eval $(call KMOD_template,NET_8139TOO,net-8139too,\
269 $(MODULES_DIR)/kernel/drivers/net/8139too.ko \
270 ,CONFIG_8139TOO,,10,8139too))
271
272 $(eval $(call KMOD_template,NET_AIRO,net-airo,\
273 $(MODULES_DIR)/kernel/drivers/net/wireless/airo.ko \
274 ,CONFIG_AIRO,,10,airo))
275
276 $(eval $(call KMOD_template,NET_B44,net-b44,\
277 $(MODULES_DIR)/kernel/drivers/net/b44.ko \
278 ,CONFIG_B44,,10,b44))
279
280 $(eval $(call KMOD_template,NET_E100,net-e100,\
281 $(MODULES_DIR)/kernel/drivers/net/e100.ko \
282 ,CONFIG_E100,,10,e100))
283
284 $(eval $(call KMOD_template,NET_HERMES,net-hermes,\
285 $(MODULES_DIR)/kernel/drivers/net/wireless/hermes.ko \
286 $(MODULES_DIR)/kernel/drivers/net/wireless/orinoco.ko \
287 ,CONFIG_HERMES,,10,hermes orinoco))
288
289 $(eval $(call KMOD_template,NET_HERMES_PCI,net-hermes-pci,\
290 $(MODULES_DIR)/kernel/drivers/net/wireless/orinoco_pci.ko \
291 ,CONFIG_PCI_HERMES,kmod-net-hermes,11,orinoco_pci))
292
293 $(eval $(call KMOD_template,NET_HERMES_PCI,net-hermes-plx,\
294 $(MODULES_DIR)/kernel/drivers/net/wireless/orinoco_plx.ko \
295 ,CONFIG_PLX_HERMES,kmod-net-hermes,11,orinoco_plx))
296
297 $(eval $(call KMOD_template,NET_NATSEMI,net-natsemi,\
298 $(MODULES_DIR)/kernel/drivers/net/natsemi.ko \
299 ,CONFIG_NATSEMI,,10,natsemi))
300
301 $(eval $(call KMOD_template,NET_PRISM54,net-prism54,\
302 $(MODULES_DIR)/kernel/drivers/net/wireless/prism54/prism54.ko \
303 ,CONFIG_PRISM54,,10,prism54))
304
305
306 # PCMCIA/CardBus
307
308 $(eval $(call KMOD_template,PCMCIA_CORE,pcmcia-core,\
309 $(MODULES_DIR)/kernel/drivers/pcmcia/pcmcia.ko \
310 $(MODULES_DIR)/kernel/drivers/pcmcia/pcmcia_core.ko \
311 $(MODULES_DIR)/kernel/drivers/pcmcia/yenta_socket.ko \
312 $(MODULES_DIR)/kernel/drivers/pcmcia/rsrc_nonstatic.ko \
313 ,CONFIG_PCMCIA,,50,pcmcia_core pcmcia yenta_socket rsrc_nonstatic))
314
315 $(eval $(call KMOD_template,PCMCIA_SERIAL,pcmcia-serial,\
316 $(MODULES_DIR)/kernel/drivers/serial/serial_cs.ko \
317 ,CONFIG_SERIAL_8250_CS))
318
319
320 # USB
321
322 $(eval $(call KMOD_template,USB,usb-core,\
323 $(MODULES_DIR)/kernel/drivers/usb/core/usbcore.ko \
324 ,CONFIG_USB,,50,usbcore))
325
326 $(eval $(call KMOD_template,USB_OHCI,usb-ohci,\
327 $(MODULES_DIR)/kernel/drivers/usb/host/ohci-hcd.ko \
328 ,CONFIG_USB_OHCI_HCD,kmod-usb-core,60,ohci-hcd))
329
330 $(eval $(call KMOD_template,USB_UHCI,usb-uhci,\
331 $(MODULES_DIR)/kernel/drivers/usb/host/uhci.ko \
332 ,CONFIG_USB_UHCI_ALT,kmod-usb-core,60,uhci))
333
334 $(eval $(call KMOD_template,USB2,usb2,\
335 $(MODULES_DIR)/kernel/drivers/usb/host/ehci-hcd.ko \
336 ,CONFIG_USB_EHCI_HCD,kmod-usb-core,60,ehci-hcd))
337
338 $(eval $(call KMOD_template,USB_ACM,usb-acm,\
339 $(MODULES_DIR)/kernel/drivers/usb/class/cdc-acm.ko \
340 ,CONFIG_USB_ACM))
341
342 #$(eval $(call KMOD_template,USB_AUDIO,usb-audio,\
343 # $(MODULES_DIR)/kernel/drivers/usb/class/audio.ko \
344 #,CONFIG_USB_AUDIO,kmod-soundcore kmod-usb-core,61,audio))
345
346 $(eval $(call KMOD_template,USB_PRINTER,usb-printer,\
347 $(MODULES_DIR)/kernel/drivers/usb/class/usblp.ko \
348 ,CONFIG_USB_PRINTER,kmod-usb-core,60,usblp))
349
350 $(eval $(call KMOD_template,USB_SERIAL,usb-serial,\
351 $(MODULES_DIR)/kernel/drivers/usb/serial/usbserial.ko \
352 ,CONFIG_USB_SERIAL,kmod-usb-core,60,usbserial))
353
354 $(eval $(call KMOD_template,USB_SERIAL_BELKIN,usb-serial-belkin,\
355 $(MODULES_DIR)/kernel/drivers/usb/serial/belkin_sa.ko \
356 ,CONFIG_USB_SERIAL_BELKIN,kmod-usb-serial,61,belkin_sa))
357
358 $(eval $(call KMOD_template,USB_SERIAL_FTDI,usb-serial-ftdi,\
359 $(MODULES_DIR)/kernel/drivers/usb/serial/ftdi_sio.ko \
360 ,CONFIG_USB_SERIAL_FTDI_SIO,kmod-usb-serial,61,ftdi_sio))
361
362 $(eval $(call KMOD_template,USB_SERIAL_MCT_U232,usb-serial-mct-u232,\
363 $(MODULES_DIR)/kernel/drivers/usb/serial/mct_u232.ko \
364 ,CONFIG_USB_SERIAL_MCT_U232,kmod-usb-serial,61,mct_u232))
365
366 $(eval $(call KMOD_template,USB_SERIAL_PL2303,usb-serial-pl2303,\
367 $(MODULES_DIR)/kernel/drivers/usb/serial/pl2303.ko \
368 ,CONFIG_USB_SERIAL_PL2303,kmod-usb-serial,61,pl2303))
369
370 $(eval $(call KMOD_template,USB_SERIAL_VISOR,usb-serial-visor,\
371 $(MODULES_DIR)/kernel/drivers/usb/serial/visor.ko \
372 ,CONFIG_USB_SERIAL_VISOR,kmod-usb-serial,61,visor))
373
374 $(eval $(call KMOD_template,USB_STORAGE,usb-storage,\
375 $(MODULES_DIR)/kernel/drivers/scsi/scsi_mod.ko \
376 $(MODULES_DIR)/kernel/drivers/scsi/sd_mod.ko \
377 $(MODULES_DIR)/kernel/drivers/usb/storage/usb-storage.ko \
378 ,CONFIG_USB_STORAGE,kmod-usb-core,60,scsi_mod sd_mod usb-storage))
379
380 $(eval $(call KMOD_template,USB_ATM,usb-atm,\
381 $(MODULES_DIR)/kernel/drivers/usb/atm/usbatm.ko \
382 ,CONFIG_USB_ATM,kmod-usb-atm,50,usb-atm))
383
384 # Misc. devices
385
386 $(eval $(call KMOD_template,AX25,ax25,\
387 $(MODULES_DIR)/kernel/net/ax25/ax25.ko \
388 $(MODULES_DIR)/kernel/drivers/net/hamradio/mkiss.ko \
389 ,CONFIG_AX25,,90,ax25 mkiss))
390
391 $(eval $(call KMOD_template,BLUETOOTH,bluetooth,\
392 $(MODULES_DIR)/kernel/net/bluetooth/bluetooth.ko \
393 $(MODULES_DIR)/kernel/net/bluetooth/l2cap.ko \
394 $(MODULES_DIR)/kernel/net/bluetooth/sco.ko \
395 $(MODULES_DIR)/kernel/net/bluetooth/rfcomm/rfcomm.ko \
396 $(MODULES_DIR)/kernel/drivers/bluetooth/hci_uart.ko \
397 ,CONFIG_BLUEZ))
398
399
400 $(TARGETS): $(PACKAGE_DIR)
401
402 $(PACKAGE_DIR):
403 mkdir -p $(PACKAGE_DIR)
404
405 $(DL_DIR)/$(LINUX_SOURCE):
406 -mkdir -p $(DL_DIR)
407 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_SOURCE) $(LINUX_KERNEL_MD5SUM) $(LINUX_SITE) $(MAKE_TRACE)
408
409 $(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
410 -mkdir -p $(LINUX_BUILD_DIR)
411 bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(LINUX_BUILD_DIR) $(TAR_OPTIONS) -
412 rm -f $(LINUX_DIR)
413 ln -s $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(LINUX_DIR)
414 touch $(LINUX_DIR)/.unpacked
415
416 $(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked
417 $(PATCH) $(LINUX_DIR) ./patches/generic $(MAKE_TRACE)
418 [ -d ./patches/$(BOARD) ] && $(PATCH) $(LINUX_DIR) ./patches/$(BOARD) $(MAKE_TRACE)
419 touch $(LINUX_DIR)/.patched
420
421 $(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
422 -cp $(LINUX_KCONFIG) $(LINUX_DIR)/.config
423 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) oldconfig $(MAKE_TRACE)
424 touch $(LINUX_DIR)/.configured
425
426 $(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.configured
427 $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE=$(TARGET_CROSS) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) $(MAKE_TRACE)
428
429 $(LINUX_KERNEL): $(LINUX_DIR)/vmlinux
430 $(TARGET_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $< $@ $(MAKE_TRACE)
431 touch -c $(LINUX_KERNEL)
432
433 $(LINUX_DIR)/.modules_done: $(LINUX_KERNEL) $(LINUX_IMAGE)
434 rm -rf $(LINUX_BUILD_DIR)/modules
435 $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE=$(TARGET_CROSS) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) modules $(MAKE_TRACE)
436 $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE=$(TARGET_CROSS) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) DEPMOD=true INSTALL_MOD_PATH=$(LINUX_BUILD_DIR)/modules modules_install $(MAKE_TRACE)
437 touch $(LINUX_DIR)/.modules_done
438
439 $(STAGING_DIR)/include/linux/version.h: $(LINUX_DIR)/.configured
440 mkdir -p $(STAGING_DIR)/include
441 tar -ch -C $(LINUX_DIR)/include -f - linux | tar -xf - -C $(STAGING_DIR)/include/
442 tar -ch -C $(LINUX_DIR)/include -f - asm | tar -xf - -C $(STAGING_DIR)/include/
443
444 $(STAMP_DIR)/.linux-compile: $(LINUX_DIR)/.modules_done
445 @mkdir -p $(STAMP_DIR)
446 @$(MAKE) $(TARGETS)
447 ln -sf $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(LINUX_DIR)
448 @$(TRACE) target/linux/package
449 $(MAKE) -C $(TOPDIR)/target/linux/package \
450 $(KPKG_MAKEOPTS) \
451 compile
452 touch $@
453
454 $(TARGET_MODULES_DIR):
455 -mkdir -p $(TARGET_MODULES_DIR)
456
457 $(KERNEL_IPKG):
458 rm -rf $(KERNEL_IDIR)
459 mkdir -p $(KERNEL_IDIR)/etc
460 $(SCRIPT_DIR)/make-ipkg-dir.sh $(KERNEL_IDIR) ../control/kernel.control $(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE) $(ARCH)
461 if [ -f ./config/$(BOARD).modules ]; then \
462 cp ./config/$(BOARD).modules $(KERNEL_IDIR)/etc/modules; \
463 fi
464 $(IPKG_BUILD) $(KERNEL_IDIR) $(LINUX_BUILD_DIR) $(MAKE_TRACE)
465
466 source: $(DL_DIR)/$(LINUX_SOURCE)
467 prepare: $(LINUX_DIR)/.configured
468 compile:
469 $(MAKE) $(STAMP_DIR)/.linux-compile $(MAKE_TRACE)
470
471 install: compile $(TARGET_MODULES_DIR) $(KERNEL_IPKG)
472 rm -rf $(LINUX_BUILD_DIR)/root*
473 cp -fpR $(BUILD_DIR)/root $(LINUX_BUILD_DIR)/
474 echo -e 'dest root /\noption offline_root $(LINUX_BUILD_DIR)/root' > $(LINUX_BUILD_DIR)/ipkg.conf
475 $(MAKE) -C $(TOPDIR)/target/linux/package \
476 $(KPKG_MAKEOPTS) \
477 install
478 @{ [ "$(INSTALL_TARGETS)" != "" ] && $(IPKG_KERNEL) install $(INSTALL_TARGETS) || true; } $(MAKE_TRACE)
479
480 mostlyclean:
481 rm -f $(STAMP_DIR)/.linux-compile
482 rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.modules_done
483 rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.drivers-unpacked
484 $(MAKE) -C $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) clean $(MAKE_TRACE)
485 rm -f $(LINUX_KERNEL) $(LINUX_IMAGE)
486
487 rebuild:
488 -$(MAKE) mostlyclean
489 if [ -f $(LINUX_KERNEL) ]; then \
490 $(MAKE) clean $(MAKE_TRACE); \
491 fi
492 $(MAKE) compile $(MAKE_TRACE)
493
494 clean:
495 rm -f $(STAMP_DIR)/.linux-compile
496 rm -rf $(LINUX_BUILD_DIR)
497 rm -f $(TARGETS)