add nls support modules
[openwrt.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.12.5
9 LINUX_KERNEL_MD5SUM:=076f0dc714112c764c790fbaef19e228
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 := $(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),brcm)
51 include ./broadcom.mk
52 endif
53
54 $(eval $(call KMOD_template,ATM,atm,\
55 $(MODULES_DIR)/kernel/net/atm/atm.ko \
56 $(MODULES_DIR)/kernel/net/atm/br2684.ko \
57 ,CONFIG_ATM,,50,atm))
58 $(eval $(call KMOD_template,PPPOATM,pppoatm,\
59 $(MODULES_DIR)/kernel/net/atm/pppoatm.ko \
60 ,CONFIG_PPPOATM))
61 $(eval $(call KMOD_template,USB_ACM,usb-acm,\
62 $(MODULES_DIR)/kernel/drivers/usb/class/cdc-acm.ko \
63 ,CONFIG_USB_ACM))
64 $(eval $(call KMOD_template,B44,b44,\
65 $(MODULES_DIR)/kernel/drivers/net/b44.ko \
66 ,CONFIG_B44))
67 $(eval $(call KMOD_template,BLUETOOTH,bluetooth,\
68 $(MODULES_DIR)/kernel/net/bluetooth/*.ko \
69 $(MODULES_DIR)/kernel/net/bluetooth/rfcomm/*.ko \
70 $(MODULES_DIR)/kernel/drivers/bluetooth/*.ko \
71 ,CONFIG_BLUEZ))
72 $(eval $(call KMOD_template,ARPT,arptables,\
73 $(MODULES_DIR)/kernel/net/ipv4/netfilter/arp*.ko \
74 ,CONFIG_IP_NF_ARPTABLES))
75 $(eval $(call KMOD_template,EBT,ebtables,\
76 $(MODULES_DIR)/kernel/net/bridge/netfilter/*.ko \
77 ,CONFIG_BRIDGE_NF_EBTABLES))
78 $(eval $(call KMOD_template,IPTABLES_V4_EXTRA,iptables-extra,\
79 $(MODULES_DIR)/kernel/net/ipv4/netfilter/ip*.ko \
80 ))
81 $(eval $(call KMOD_template,IPTABLES_V6,ip6tables,\
82 $(MODULES_DIR)/kernel/net/ipv6/netfilter/ip*.ko \
83 ,CONFIG_IP6_NF_IPTABLES,kmod-ipv6))
84 $(eval $(call KMOD_template,IPV6,ipv6,\
85 $(MODULES_DIR)/kernel/net/ipv6/ipv6.ko \
86 ,CONFIG_IPV6,,20,ipv6))
87 $(eval $(call KMOD_template,CIFS,cifs,\
88 $(MODULES_DIR)/kernel/fs/cifs/cifs.ko \
89 ,CONFIG_CIFS,,30,cifs))
90 $(eval $(call KMOD_template,NFS,nfs,\
91 $(MODULES_DIR)/kernel/fs/lockd/*.ko \
92 $(MODULES_DIR)/kernel/fs/nfs/*.ko \
93 $(MODULES_DIR)/kernel/net/sunrpc/*.ko \
94 ,CONFIG_NFS_FS,,30,sunrpc lockd nfs))
95 $(eval $(call KMOD_template,USB,usb-core,\
96 $(MODULES_DIR)/kernel/drivers/usb/core/usbcore.ko \
97 ,CONFIG_USB,,50,usbcore))
98 $(eval $(call KMOD_template,USB_UHCI,usb-uhci,\
99 $(MODULES_DIR)/kernel/drivers/usb/host/uhci.ko \
100 ,CONFIG_USB_UHCI_ALT,kmod-usb-core,60,uhci))
101 $(eval $(call KMOD_template,USB_OHCI,usb-ohci,\
102 $(MODULES_DIR)/kernel/drivers/usb/host/ohci-hcd.ko \
103 ,CONFIG_USB_OHCI_HCD,kmod-usb-core,60,ohci-hcd))
104 $(eval $(call KMOD_template,USB2,usb2,\
105 $(MODULES_DIR)/kernel/drivers/usb/host/ehci-hcd.ko \
106 ,CONFIG_USB_EHCI_HCD,kmod-usb-core,60,ehci-hcd))
107 $(eval $(call KMOD_template,USB_STORAGE,usb-storage,\
108 $(MODULES_DIR)/kernel/drivers/scsi/*.ko \
109 $(MODULES_DIR)/kernel/drivers/usb/storage/*.ko \
110 ,CONFIG_USB_STORAGE,kmod-usb-core,60,scsi_mod sd_mod usb-storage))
111 $(eval $(call KMOD_template,USB_PRINTER,usb-printer,\
112 $(MODULES_DIR)/kernel/drivers/usb/class/usblp.ko \
113 ,CONFIG_USB_PRINTER,kmod-usb-core,60,usblp))
114 $(eval $(call KMOD_template,IDE,ide,\
115 $(MODULES_DIR)/kernel/drivers/ide/*.ko \
116 $(MODULES_DIR)/kernel/drivers/ide/*/*.ko \
117 ,CONFIG_IDE))
118 $(eval $(call KMOD_template,LOOP,loop,\
119 $(MODULES_DIR)/kernel/drivers/block/loop.ko \
120 ,CONFIG_BLK_DEV_LOOP,,20,loop))
121 $(eval $(call KMOD_template,EXT2,ext2,\
122 $(MODULES_DIR)/kernel/fs/ext2/*.ko \
123 ,CONFIG_EXT2_FS,,30,ext2))
124 $(eval $(call KMOD_template,EXT3,ext3,\
125 $(MODULES_DIR)/kernel/fs/ext3/*.ko \
126 $(MODULES_DIR)/kernel/fs/jbd/*.ko \
127 ,CONFIG_EXT3_FS,,30,jbd ext3))
128 $(eval $(call KMOD_template,XFS,xfs,\
129 $(MODULES_DIR)/kernel/fs/xfs/*.ko \
130 ,CONFIG_XFS_FS,,30,xfs))
131 $(eval $(call KMOD_template,HFSPLUS,hfsplus,\
132 $(MODULES_DIR)/kernel/fs/hfsplus/*.ko \
133 ,CONFIG_HFSPLUS_FS,,30,hfsplus))
134 $(eval $(call KMOD_template,VFAT,vfat,\
135 $(MODULES_DIR)/kernel/fs/vfat/vfat.ko \
136 $(MODULES_DIR)/kernel/fs/fat/fat.ko \
137 $(MODULES_DIR)/kernel/fs/nls/nls_base.ko \
138 ,CONFIG_VFAT_FS,,30,fat vfat))
139 $(eval $(call KMOD_template,NLS_BASE,nls-base,\
140 $(MODULES_DIR)/kernel/fs/nls/nls_base.ko \
141 ,CONFIG_NLS,,20,nls_base))
142 $(eval $(call KMOD_template,NLS_UTF8,nls-utf8,\
143 $(MODULES_DIR)/kernel/fs/nls/nls_utf8.ko \
144 ,CONFIG_NLS_UTF8,,20,nls_utf8))
145 $(eval $(call KMOD_template,NLS_ISO8859_1,nls-iso8859-1,\
146 $(MODULES_DIR)/kernel/fs/nls/nls_iso8859-1.ko \
147 ,CONFIG_NLS_ISO8859_1,,20,nls_iso8859-1))
148 $(eval $(call KMOD_template,NLS_CP437,nls-cp437,\
149 $(MODULES_DIR)/kernel/fs/nls/nls_cp437.ko \
150 ,CONFIG_NLS_CODEPAGE_437,,20,nls_cp437))
151 $(eval $(call KMOD_template,NLS_CP850,nls-cp850,\
152 $(MODULES_DIR)/kernel/fs/nls/nls_cp850.ko \
153 ,CONFIG_NLS_CODEPAGE_850,,20,nls_cp850))
154 $(eval $(call KMOD_template,CRYPTO,crypto,\
155 $(MODULES_DIR)/kernel/crypto/*.ko \
156 ))
157 $(eval $(call KMOD_template,PPP,ppp,\
158 $(MODULES_DIR)/kernel/drivers/net/ppp_async.ko \
159 $(MODULES_DIR)/kernel/drivers/net/ppp_generic.ko \
160 $(MODULES_DIR)/kernel/drivers/net/slhc.ko \
161 ,CONFIG_PPP))
162 $(eval $(call KMOD_template,MPPE,mppe,\
163 $(MODULES_DIR)/kernel/drivers/net/ppp_mppe_mppc.ko \
164 ,CONFIG_PPP_MPPE_MPPC))
165 $(eval $(call KMOD_template,PPPOE,pppoe,\
166 $(MODULES_DIR)/kernel/drivers/net/pppoe.ko \
167 $(MODULES_DIR)/kernel/drivers/net/pppox.ko \
168 ,CONFIG_PPPOE))
169 $(eval $(call KMOD_template,TUN,tun,\
170 $(MODULES_DIR)/kernel/drivers/net/tun.ko \
171 ,CONFIG_TUN,,20,tun))
172 $(eval $(call KMOD_template,GRE,gre,\
173 $(MODULES_DIR)/kernel/net/ipv4/ip_gre.ko \
174 ,CONFIG_NET_IPGRE))
175 $(eval $(call KMOD_template,SCHED,sched,\
176 $(MODULES_DIR)/kernel/net/sched/*.ko \
177 ))
178
179 $(TARGETS): $(PACKAGE_DIR)
180
181 $(PACKAGE_DIR):
182 mkdir -p $(PACKAGE_DIR)
183
184 $(DL_DIR)/$(LINUX_SOURCE):
185 -mkdir -p $(DL_DIR)
186 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_SOURCE) $(LINUX_KERNEL_MD5SUM) $(LINUX_SITE)
187
188 $(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
189 -mkdir -p $(LINUX_BUILD_DIR)
190 bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(LINUX_BUILD_DIR) $(TAR_OPTIONS) -
191 rm -f $(LINUX_DIR)
192 ln -s $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(LINUX_DIR)
193 touch $(LINUX_DIR)/.unpacked
194
195 $(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked
196 $(PATCH) $(LINUX_DIR) ./patches/generic
197 [ -d ./patches/$(BOARD) ] && $(PATCH) $(LINUX_DIR) ./patches/$(BOARD)
198 touch $(LINUX_DIR)/.patched
199
200 $(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
201 -cp $(LINUX_KCONFIG) $(LINUX_DIR)/.config
202 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) oldconfig
203 touch $(LINUX_DIR)/.configured
204
205 $(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.configured
206 $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE=$(TARGET_CROSS) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH)
207
208 $(LINUX_KERNEL): $(LINUX_DIR)/vmlinux
209 $(TARGET_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $< $@
210 touch -c $(LINUX_KERNEL)
211
212 $(LINUX_DIR)/.modules_done: $(LINUX_KERNEL) $(LINUX_IMAGE)
213 rm -rf $(LINUX_BUILD_DIR)/modules
214 $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE=$(TARGET_CROSS) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) modules
215 $(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
216 touch $(LINUX_DIR)/.modules_done
217
218 $(STAGING_DIR)/include/linux/version.h: $(LINUX_DIR)/.configured
219 mkdir -p $(STAGING_DIR)/include
220 tar -ch -C $(LINUX_DIR)/include -f - linux | tar -xf - -C $(STAGING_DIR)/include/
221 tar -ch -C $(LINUX_DIR)/include -f - asm | tar -xf - -C $(STAGING_DIR)/include/
222
223 $(TARGET_MODULES_DIR):
224 -mkdir -p $(TARGET_MODULES_DIR)
225
226 $(KERNEL_IPKG):
227 rm -rf $(KERNEL_IDIR)
228 mkdir -p $(KERNEL_IDIR)/etc
229 $(SCRIPT_DIR)/make-ipkg-dir.sh $(KERNEL_IDIR) ../control/kernel.control $(PKG_RELEASE) $(ARCH)
230 echo 'Package: kernel-$(LINUX_VERSION)-$(BOARD)' >> $(KERNEL_IDIR)/CONTROL/control
231 if [ -f ./config/$(BOARD).modules ]; then \
232 cp ./config/$(BOARD).modules $(KERNEL_IDIR)/etc/modules; \
233 fi
234 $(IPKG_BUILD) $(KERNEL_IDIR) $(LINUX_BUILD_DIR)
235
236
237 source: $(DL_DIR)/$(LINUX_SOURCE)
238 prepare: $(LINUX_DIR)/.configured
239 compile: $(LINUX_DIR)/.modules_done $(TARGETS)
240 ln -sf $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(LINUX_DIR)
241 $(MAKE) -C $(TOPDIR)/target/linux/package \
242 $(KPKG_MAKEOPTS) \
243 compile
244
245 install: compile $(TARGET_MODULES_DIR) $(KERNEL_IPKG)
246 rm -rf $(LINUX_BUILD_DIR)/root*
247 echo -e 'dest root /\noption offline_root $(LINUX_BUILD_DIR)/root' > $(LINUX_BUILD_DIR)/ipkg.conf
248 $(MAKE) -C $(TOPDIR)/package \
249 TARGET_DIR="$(LINUX_TARGET_DIR)" \
250 IPKG_CONF="$(LINUX_BUILD_DIR)" \
251 BOARD="$(BOARD)" \
252 install
253 $(MAKE) -C $(TOPDIR)/target/linux/package \
254 $(KPKG_MAKEOPTS) \
255 install
256 [ "$(INSTALL_TARGETS)" != "" ] && $(IPKG_KERNEL) install $(INSTALL_TARGETS) || true
257
258 mostlyclean:
259 rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.modules_done
260 rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.drivers-unpacked
261 $(MAKE) -C $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) clean
262 rm -f $(LINUX_KERNEL) $(LINUX_IMAGE)
263
264 rebuild:
265 -$(MAKE) mostlyclean
266 if [ -f $(LINUX_KERNEL) ]; then \
267 $(MAKE) clean; \
268 fi
269 $(MAKE) compile
270
271 clean:
272 rm -rf $(LINUX_BUILD_DIR)
273 rm -f $(TARGETS)
This page took 0.05373 seconds and 5 git commands to generate.