1 #############################################################
4 # Linux 2.4 kernel target for the OpenWRT project
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
11 #############################################################
13 include $(TOPDIR
)/rules.mk
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
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
30 PKG_BUILD_DIR
:= $(LINUX_BUILD_DIR
)/linux-modules
33 KERNEL_IPKG
:=$(LINUX_BUILD_DIR
)/kernel-
$(LINUX_VERSION
)-$(BOARD
)_
$(PKG_RELEASE
)_
$(ARCH
).ipk
34 KERNEL_IDIR
:=$(LINUX_BUILD_DIR
)/kernel-ipkg
36 KPKG_MAKEOPTS
:= IPKG
="$(IPKG_KERNEL)" \
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)"
44 include $(LINUX_KCONFIG
)
46 INSTALL_TARGETS
:= $(KERNEL_IPKG
)
53 ifeq ($(BOARD
),soekris
)
61 $(eval
$(call KMOD_template
,ATM
,atm
,\
62 $(MODULES_DIR
)/kernel
/net
/atm
/atm.o \
63 $(MODULES_DIR
)/kernel
/net
/atm
/br2684.o \
65 $(eval
$(call KMOD_template
,PPPOATM
,pppoatm
,\
66 $(MODULES_DIR
)/kernel
/net
/atm
/pppoatm.o \
68 $(eval
$(call KMOD_template
,USB_ACM
,usb-acm
,\
69 $(MODULES_DIR
)/kernel
/drivers
/usb
/acm.o \
71 $(eval
$(call KMOD_template
,B44
,b44
,\
72 $(MODULES_DIR
)/kernel
/drivers
/net
/b44.o \
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 \
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 \
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
))
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
))
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
,IDE
,ide
,\
139 $(MODULES_DIR
)/kernel
/drivers
/ide
/*.o \
140 $(MODULES_DIR
)/kernel
/drivers
/ide
/*/*.o \
142 $(eval
$(call KMOD_template
,LOOP
,loop
,\
143 $(MODULES_DIR
)/kernel
/drivers
/block
/loop.o \
144 ,CONFIG_BLK_DEV_LOOP
,,20,loop
))
145 $(eval
$(call KMOD_template
,EXT2
,ext2
,\
146 $(MODULES_DIR
)/kernel
/fs
/ext2
/*.o \
147 ,CONFIG_EXT2_FS
,,30,ext2
))
148 $(eval
$(call KMOD_template
,EXT3
,ext3
,\
149 $(MODULES_DIR
)/kernel
/fs
/ext3
/*.o \
150 $(MODULES_DIR
)/kernel
/fs
/jbd
/*.o \
151 ,CONFIG_EXT3_FS
,,30,jbd ext3
))
152 $(eval
$(call KMOD_template
,XFS
,xfs
,\
153 $(MODULES_DIR
)/kernel
/fs
/xfs
/*.o \
154 ,CONFIG_XFS_FS
,,30,xfs
))
155 $(eval
$(call KMOD_template
,HFSPLUS
,hfsplus
,\
156 $(MODULES_DIR
)/kernel
/fs
/hfsplus
/*.o \
157 ,CONFIG_HFSPLUS_FS
,,30,hfsplus
))
158 $(eval
$(call KMOD_template
,VFAT
,vfat
,\
159 $(MODULES_DIR
)/kernel
/fs
/vfat
/vfat.o \
160 $(MODULES_DIR
)/kernel
/fs
/fat
/fat.o \
161 ,CONFIG_VFAT_FS
,,30,fat vfat
))
162 ifneq ($(wildcard $(MODULES_DIR
)/kernel
/crypto
/*.o
),)
165 $(eval
$(call KMOD_template
,CRYPTO
,crypto
,\
166 $(MODULES_DIR
)/kernel
/crypto
/*.o \
168 $(eval
$(call KMOD_template
,PPP
,ppp
,\
169 $(MODULES_DIR
)/kernel
/drivers
/net
/ppp_async.o \
170 $(MODULES_DIR
)/kernel
/drivers
/net
/ppp_generic.o \
171 $(MODULES_DIR
)/kernel
/drivers
/net
/slhc.o \
172 $(MODULES_DIR
)/kernel
/drivers
/net
/pppox.o \
174 $(eval
$(call KMOD_template
,MPPE
,mppe
,\
175 $(MODULES_DIR
)/kernel
/drivers
/net
/ppp_mppe_mppc.o \
176 ,CONFIG_PPP_MPPE_MPPC
))
177 $(eval
$(call KMOD_template
,PPPOE
,pppoe
,\
178 $(MODULES_DIR
)/kernel
/drivers
/net
/pppoe.o \
180 $(eval
$(call KMOD_template
,TUN
,tun
,\
181 $(MODULES_DIR
)/kernel
/drivers
/net
/tun.o \
182 ,CONFIG_TUN
,,20,tun
))
183 $(eval
$(call KMOD_template
,GRE
,gre
,\
184 $(MODULES_DIR
)/kernel
/net
/ipv4
/ip_gre.o \
186 ifneq ($(wildcard $(MODULES_DIR
)/kernel
/net
/sched
/*.o
),)
189 $(eval
$(call KMOD_template
,SCHED
,sched
,\
190 $(MODULES_DIR
)/kernel
/net
/sched
/*.o \
192 $(eval
$(call KMOD_template
,VIDEODEV
,videodev
,\
193 $(MODULES_DIR
)/kernel
/drivers
/media
/video
/videodev.o \
195 $(eval
$(call KMOD_template
,PWC
,pwc
,\
196 $(MODULES_DIR
)/kernel
/drivers
/usb
/pwc.o \
199 $(TARGETS
): $(PACKAGE_DIR
)
202 mkdir
-p
$(PACKAGE_DIR
)
204 $(LINUX_DIR
)/.unpacked
: $(DL_DIR
)/$(LINUX_SOURCE
)
205 -mkdir
-p
$(LINUX_BUILD_DIR
)
206 bzcat
$(DL_DIR
)/$(LINUX_SOURCE
) |
tar -C
$(LINUX_BUILD_DIR
) $(TAR_OPTIONS
) -
208 ln
-s
$(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
) $(LINUX_DIR
)
209 touch
$(LINUX_DIR
)/.unpacked
211 $(LINUX_DIR
)/.patched
: $(LINUX_DIR
)/.unpacked
212 $(PATCH
) $(LINUX_DIR
) .
/patches
/generic
213 [ -d .
/patches
/$(BOARD
) ] && $(PATCH
) $(LINUX_DIR
) .
/patches
/$(BOARD
)
214 touch
$(LINUX_DIR
)/.patched
216 $(LINUX_DIR
)/.configured
: $(LINUX_DIR
)/.patched
217 -cp
$(LINUX_KCONFIG
) $(LINUX_DIR
)/.config
218 $(SED
) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" \
219 $(LINUX_DIR
)/Makefile \
220 $(LINUX_DIR
)/arch
/*/Makefile
221 $(SED
) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR
)/arch
/mips
/Makefile
222 $(MAKE
) -C
$(LINUX_DIR
) ARCH
=$(LINUX_KARCH
) oldconfig
include/linux
/version.h
223 touch
$(LINUX_DIR
)/.configured
225 $(LINUX_DIR
)/.depend_done
: $(LINUX_DIR
)/.configured
226 $(MAKE
) -C
$(LINUX_DIR
) ARCH
=$(LINUX_KARCH
) dep
227 touch
$(LINUX_DIR
)/.depend_done
229 $(LINUX_DIR
)/vmlinux
: $(LINUX_DIR
)/.depend_done
230 $(MAKE
) -C
$(LINUX_DIR
) ARCH
=$(LINUX_KARCH
) PATH
=$(TARGET_PATH
)
232 $(LINUX_KERNEL
): $(LINUX_DIR
)/vmlinux
233 $(TARGET_CROSS
)objcopy
-O binary
-R .reginfo
-R .note
-R .comment
-R .mdebug
-S
$< $@
234 touch
-c
$(LINUX_KERNEL
)
236 $(LINUX_DIR
)/.modules_done
: $(LINUX_KERNEL
) $(LINUX_IMAGE
)
237 rm -rf
$(LINUX_BUILD_DIR
)/modules
238 $(MAKE
) -C
$(LINUX_DIR
) ARCH
=$(LINUX_KARCH
) PATH
=$(TARGET_PATH
) modules
239 $(MAKE
) -C
$(LINUX_DIR
) DEPMOD
=true INSTALL_MOD_PATH
=$(LINUX_BUILD_DIR
)/modules modules_install
240 touch
$(LINUX_DIR
)/.modules_done
242 $(STAGING_DIR
)/include/linux
/version.h
: $(LINUX_DIR
)/.configured
243 mkdir
-p
$(STAGING_DIR
)/include
244 tar -ch
-C
$(LINUX_DIR
)/include -f
- linux |
tar -xf
- -C
$(STAGING_DIR
)/include/
245 tar -ch
-C
$(LINUX_DIR
)/include -f
- asm |
tar -xf
- -C
$(STAGING_DIR
)/include/
247 $(STAMP_DIR
)/.linux-compile
: $(LINUX_DIR
)/.modules_done
248 @mkdir
-p
$(STAMP_DIR
)
250 ln
-sf
$(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
) $(LINUX_DIR
)
251 $(MAKE
) -C
$(TOPDIR
)/target
/linux
/package \
256 $(TARGET_MODULES_DIR
):
257 -mkdir
-p
$(TARGET_MODULES_DIR
)
260 rm -rf
$(KERNEL_IDIR
)
261 mkdir
-p
$(KERNEL_IDIR
)/etc
262 $(SCRIPT_DIR
)/make-ipkg-dir.sh
$(KERNEL_IDIR
) ..
/control
/kernel.control
$(PKG_RELEASE
) $(ARCH
)
263 echo
'Package: kernel-$(LINUX_VERSION)-$(BOARD)' >> $(KERNEL_IDIR
)/CONTROL
/control
264 if
[ -f .
/config
/$(BOARD
).modules
]; then \
265 cp .
/config
/$(BOARD
).modules
$(KERNEL_IDIR
)/etc
/modules
; \
267 $(IPKG_BUILD
) $(KERNEL_IDIR
) $(LINUX_BUILD_DIR
)
269 source
: $(DL_DIR
)/$(LINUX_SOURCE
)
270 prepare
: $(LINUX_DIR
)/.configured
271 compile
: $(STAMP_DIR
)/.linux-compile
273 install: compile
$(TARGET_MODULES_DIR
) $(KERNEL_IPKG
)
274 rm -rf
$(LINUX_BUILD_DIR
)/root
*
275 echo
-e
'dest root /\noption offline_root $(LINUX_BUILD_DIR)/root' > $(LINUX_BUILD_DIR
)/ipkg.conf
276 $(MAKE
) -C
$(TOPDIR
)/package \
277 TARGET_DIR
="$(LINUX_TARGET_DIR)" \
278 IPKG_CONF
="$(LINUX_BUILD_DIR)" \
281 $(MAKE
) -C
$(TOPDIR
)/target
/linux
/package \
284 [ "$(INSTALL_TARGETS)" != "" ] && $(IPKG_KERNEL
) install $(INSTALL_TARGETS
) || true
287 rm -f
$(STAMP_DIR
)/.linux-compile
288 rm -f
$(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
)/.modules_done
289 rm -f
$(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
)/.drivers-unpacked
290 $(MAKE
) -C
$(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
) clean
291 rm -f
$(LINUX_KERNEL
) $(LINUX_IMAGE
)
295 if
[ -f
$(LINUX_KERNEL
) ]; then \
301 rm -f
$(STAMP_DIR
)/.linux-compile
302 rm -rf
$(LINUX_BUILD_DIR
)