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
))
114 $(eval
$(call KMOD_template
,USB_STORAGE
,usb-storage
,\
115 $(MODULES_DIR
)/kernel
/drivers
/scsi
/*.o \
116 $(MODULES_DIR
)/kernel
/drivers
/usb
/storage
/*.o \
117 ,CONFIG_USB_STORAGE
,kmod-usb-core
,60,scsi_mod sd_mod usb-storage
))
118 $(eval
$(call KMOD_template
,USB_PRINTER
,usb-printer
,\
119 $(MODULES_DIR
)/kernel
/drivers
/usb
/printer.o \
120 ,CONFIG_USB_PRINTER
,kmod-usb-core
,60,printer
))
121 $(eval
$(call KMOD_template
,IDE
,ide
,\
122 $(MODULES_DIR
)/kernel
/drivers
/ide
/*.o \
123 $(MODULES_DIR
)/kernel
/drivers
/ide
/*/*.o \
125 $(eval
$(call KMOD_template
,LOOP
,loop
,\
126 $(MODULES_DIR
)/kernel
/drivers
/block
/loop.o \
127 ,CONFIG_BLK_DEV_LOOP
,,20,loop
))
128 $(eval
$(call KMOD_template
,EXT2
,ext2
,\
129 $(MODULES_DIR
)/kernel
/fs
/ext2
/*.o \
130 ,CONFIG_EXT2_FS
,,30,ext2
))
131 $(eval
$(call KMOD_template
,EXT3
,ext3
,\
132 $(MODULES_DIR
)/kernel
/fs
/ext3
/*.o \
133 $(MODULES_DIR
)/kernel
/fs
/jbd
/*.o \
134 ,CONFIG_EXT3_FS
,,30,jbd ext3
))
135 $(eval
$(call KMOD_template
,XFS
,xfs
,\
136 $(MODULES_DIR
)/kernel
/fs
/xfs
/*.o \
137 ,CONFIG_XFS_FS
,,30,xfs
))
138 $(eval
$(call KMOD_template
,HFSPLUS
,hfsplus
,\
139 $(MODULES_DIR
)/kernel
/fs
/hfsplus
/*.o \
140 ,CONFIG_HFSPLUS_FS
,,30,hfsplus
))
141 $(eval
$(call KMOD_template
,VFAT
,vfat
,\
142 $(MODULES_DIR
)/kernel
/fs
/vfat
/vfat.o \
143 $(MODULES_DIR
)/kernel
/fs
/fat
/fat.o \
144 ,CONFIG_VFAT_FS
,,30,fat vfat
))
145 $(eval
$(call KMOD_template
,CRYPTO
,crypto
,\
146 $(MODULES_DIR
)/kernel
/crypto
/*.o \
148 $(eval
$(call KMOD_template
,PPP
,ppp
,\
149 $(MODULES_DIR
)/kernel
/drivers
/net
/ppp_async.o \
150 $(MODULES_DIR
)/kernel
/drivers
/net
/ppp_generic.o \
151 $(MODULES_DIR
)/kernel
/drivers
/net
/slhc.o \
153 $(eval
$(call KMOD_template
,MPPE
,mppe
,\
154 $(MODULES_DIR
)/kernel
/drivers
/net
/ppp_mppe_mppc.o \
155 ,CONFIG_PPP_MPPE_MPPC
))
156 $(eval
$(call KMOD_template
,PPPOE
,pppoe
,\
157 $(MODULES_DIR
)/kernel
/drivers
/net
/pppoe.o \
158 $(MODULES_DIR
)/kernel
/drivers
/net
/pppox.o \
160 $(eval
$(call KMOD_template
,TUN
,tun
,\
161 $(MODULES_DIR
)/kernel
/drivers
/net
/tun.o \
162 ,CONFIG_TUN
,,20,tun
))
163 $(eval
$(call KMOD_template
,GRE
,gre
,\
164 $(MODULES_DIR
)/kernel
/net
/ipv4
/ip_gre.o \
166 $(eval
$(call KMOD_template
,SCHED
,sched
,\
167 $(MODULES_DIR
)/kernel
/net
/sched
/*.o \
169 $(eval
$(call KMOD_template
,VIDEODEV
,videodev
,\
170 $(MODULES_DIR
)/kernel
/drivers
/media
/video
/videodev.o \
172 $(eval
$(call KMOD_template
,PWC
,pwc
,\
173 $(MODULES_DIR
)/kernel
/drivers
/usb
/pwc.o \
176 $(TARGETS
): $(PACKAGE_DIR
)
179 mkdir
-p
$(PACKAGE_DIR
)
181 $(LINUX_DIR
)/.unpacked
: $(DL_DIR
)/$(LINUX_SOURCE
)
182 -mkdir
-p
$(LINUX_BUILD_DIR
)
183 bzcat
$(DL_DIR
)/$(LINUX_SOURCE
) |
tar -C
$(LINUX_BUILD_DIR
) $(TAR_OPTIONS
) -
185 ln
-s
$(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
) $(LINUX_DIR
)
186 touch
$(LINUX_DIR
)/.unpacked
188 $(LINUX_DIR
)/.patched
: $(LINUX_DIR
)/.unpacked
189 $(PATCH
) $(LINUX_DIR
) .
/patches
/generic
190 [ -d .
/patches
/$(BOARD
) ] && $(PATCH
) $(LINUX_DIR
) .
/patches
/$(BOARD
)
191 touch
$(LINUX_DIR
)/.patched
193 $(LINUX_DIR
)/.configured
: $(LINUX_DIR
)/.patched
194 -cp
$(LINUX_KCONFIG
) $(LINUX_DIR
)/.config
195 $(SED
) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" \
196 $(LINUX_DIR
)/Makefile \
197 $(LINUX_DIR
)/arch
/*/Makefile
198 $(SED
) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR
)/arch
/mips
/Makefile
199 $(MAKE
) -C
$(LINUX_DIR
) ARCH
=$(LINUX_KARCH
) oldconfig
include/linux
/version.h
200 touch
$(LINUX_DIR
)/.configured
202 $(LINUX_DIR
)/.depend_done
: $(LINUX_DIR
)/.configured
203 $(MAKE
) -C
$(LINUX_DIR
) ARCH
=$(LINUX_KARCH
) dep
204 touch
$(LINUX_DIR
)/.depend_done
206 $(LINUX_DIR
)/vmlinux
: $(LINUX_DIR
)/.depend_done
207 $(MAKE
) -C
$(LINUX_DIR
) ARCH
=$(LINUX_KARCH
) PATH
=$(TARGET_PATH
)
209 $(LINUX_KERNEL
): $(LINUX_DIR
)/vmlinux
210 $(TARGET_CROSS
)objcopy
-O binary
-R .reginfo
-R .note
-R .comment
-R .mdebug
-S
$< $@
211 touch
-c
$(LINUX_KERNEL
)
213 $(LINUX_DIR
)/.modules_done
: $(LINUX_KERNEL
) $(LINUX_IMAGE
)
214 rm -rf
$(LINUX_BUILD_DIR
)/modules
215 $(MAKE
) -C
$(LINUX_DIR
) ARCH
=$(LINUX_KARCH
) PATH
=$(TARGET_PATH
) modules
216 $(MAKE
) -C
$(LINUX_DIR
) DEPMOD
=true INSTALL_MOD_PATH
=$(LINUX_BUILD_DIR
)/modules modules_install
217 touch
$(LINUX_DIR
)/.modules_done
219 $(STAGING_DIR
)/include/linux
/version.h
: $(LINUX_DIR
)/.configured
220 mkdir
-p
$(STAGING_DIR
)/include
221 tar -ch
-C
$(LINUX_DIR
)/include -f
- linux |
tar -xf
- -C
$(STAGING_DIR
)/include/
222 tar -ch
-C
$(LINUX_DIR
)/include -f
- asm |
tar -xf
- -C
$(STAGING_DIR
)/include/
224 $(STAMP_DIR
)/.linux-compile
: $(LINUX_DIR
)/.modules_done
225 @mkdir
-p
$(STAMP_DIR
)
227 ln
-sf
$(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
) $(LINUX_DIR
)
228 $(MAKE
) -C
$(TOPDIR
)/target
/linux
/package \
233 $(TARGET_MODULES_DIR
):
234 -mkdir
-p
$(TARGET_MODULES_DIR
)
237 rm -rf
$(KERNEL_IDIR
)
238 mkdir
-p
$(KERNEL_IDIR
)/etc
239 $(SCRIPT_DIR
)/make-ipkg-dir.sh
$(KERNEL_IDIR
) ..
/control
/kernel.control
$(PKG_RELEASE
) $(ARCH
)
240 echo
'Package: kernel-$(LINUX_VERSION)-$(BOARD)' >> $(KERNEL_IDIR
)/CONTROL
/control
241 if
[ -f .
/config
/$(BOARD
).modules
]; then \
242 cp .
/config
/$(BOARD
).modules
$(KERNEL_IDIR
)/etc
/modules
; \
244 $(IPKG_BUILD
) $(KERNEL_IDIR
) $(LINUX_BUILD_DIR
)
246 source
: $(DL_DIR
)/$(LINUX_SOURCE
)
247 prepare
: $(LINUX_DIR
)/.configured
248 compile
: $(STAMP_DIR
)/.linux-compile
250 install: compile
$(TARGET_MODULES_DIR
) $(KERNEL_IPKG
)
251 rm -rf
$(LINUX_BUILD_DIR
)/root
*
252 echo
-e
'dest root /\noption offline_root $(LINUX_BUILD_DIR)/root' > $(LINUX_BUILD_DIR
)/ipkg.conf
253 $(MAKE
) -C
$(TOPDIR
)/package \
254 TARGET_DIR
="$(LINUX_TARGET_DIR)" \
255 IPKG_CONF
="$(LINUX_BUILD_DIR)" \
258 $(MAKE
) -C
$(TOPDIR
)/target
/linux
/package \
261 [ "$(INSTALL_TARGETS)" != "" ] && $(IPKG_KERNEL
) install $(INSTALL_TARGETS
) || true
264 rm -f
$(STAMP_DIR
)/.linux-compile
265 rm -f
$(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
)/.modules_done
266 rm -f
$(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
)/.drivers-unpacked
267 $(MAKE
) -C
$(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
) clean
268 rm -f
$(LINUX_KERNEL
) $(LINUX_IMAGE
)
272 if
[ -f
$(LINUX_KERNEL
) ]; then \
278 rm -f
$(STAMP_DIR
)/.linux-compile
279 rm -rf
$(LINUX_BUILD_DIR
)