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 ifneq (${shell ls
$(MODULES_DIR
)/kernel
/crypto
/*.o
},)
148 $(eval
$(call KMOD_template
,CRYPTO
,crypto
,\
149 $(MODULES_DIR
)/kernel
/crypto
/*.o \
151 $(eval
$(call KMOD_template
,PPP
,ppp
,\
152 $(MODULES_DIR
)/kernel
/drivers
/net
/ppp_async.o \
153 $(MODULES_DIR
)/kernel
/drivers
/net
/ppp_generic.o \
154 $(MODULES_DIR
)/kernel
/drivers
/net
/slhc.o \
155 $(MODULES_DIR
)/kernel
/drivers
/net
/pppox.o \
157 $(eval
$(call KMOD_template
,MPPE
,mppe
,\
158 $(MODULES_DIR
)/kernel
/drivers
/net
/ppp_mppe_mppc.o \
159 ,CONFIG_PPP_MPPE_MPPC
))
160 $(eval
$(call KMOD_template
,PPPOE
,pppoe
,\
161 $(MODULES_DIR
)/kernel
/drivers
/net
/pppoe.o \
163 $(eval
$(call KMOD_template
,TUN
,tun
,\
164 $(MODULES_DIR
)/kernel
/drivers
/net
/tun.o \
165 ,CONFIG_TUN
,,20,tun
))
166 $(eval
$(call KMOD_template
,GRE
,gre
,\
167 $(MODULES_DIR
)/kernel
/net
/ipv4
/ip_gre.o \
169 ifneq (${shell ls
$(MODULES_DIR
)/kernel
/net
/sched
/*.o
},)
172 $(eval
$(call KMOD_template
,SCHED
,sched
,\
173 $(MODULES_DIR
)/kernel
/net
/sched
/*.o \
175 $(eval
$(call KMOD_template
,VIDEODEV
,videodev
,\
176 $(MODULES_DIR
)/kernel
/drivers
/media
/video
/videodev.o \
178 $(eval
$(call KMOD_template
,PWC
,pwc
,\
179 $(MODULES_DIR
)/kernel
/drivers
/usb
/pwc.o \
182 $(TARGETS
): $(PACKAGE_DIR
)
185 mkdir
-p
$(PACKAGE_DIR
)
187 $(LINUX_DIR
)/.unpacked
: $(DL_DIR
)/$(LINUX_SOURCE
)
188 -mkdir
-p
$(LINUX_BUILD_DIR
)
189 bzcat
$(DL_DIR
)/$(LINUX_SOURCE
) |
tar -C
$(LINUX_BUILD_DIR
) $(TAR_OPTIONS
) -
191 ln
-s
$(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
) $(LINUX_DIR
)
192 touch
$(LINUX_DIR
)/.unpacked
194 $(LINUX_DIR
)/.patched
: $(LINUX_DIR
)/.unpacked
195 $(PATCH
) $(LINUX_DIR
) .
/patches
/generic
196 [ -d .
/patches
/$(BOARD
) ] && $(PATCH
) $(LINUX_DIR
) .
/patches
/$(BOARD
)
197 touch
$(LINUX_DIR
)/.patched
199 $(LINUX_DIR
)/.configured
: $(LINUX_DIR
)/.patched
200 -cp
$(LINUX_KCONFIG
) $(LINUX_DIR
)/.config
201 $(SED
) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" \
202 $(LINUX_DIR
)/Makefile \
203 $(LINUX_DIR
)/arch
/*/Makefile
204 $(SED
) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR
)/arch
/mips
/Makefile
205 $(MAKE
) -C
$(LINUX_DIR
) ARCH
=$(LINUX_KARCH
) oldconfig
include/linux
/version.h
206 touch
$(LINUX_DIR
)/.configured
208 $(LINUX_DIR
)/.depend_done
: $(LINUX_DIR
)/.configured
209 $(MAKE
) -C
$(LINUX_DIR
) ARCH
=$(LINUX_KARCH
) dep
210 touch
$(LINUX_DIR
)/.depend_done
212 $(LINUX_DIR
)/vmlinux
: $(LINUX_DIR
)/.depend_done
213 $(MAKE
) -C
$(LINUX_DIR
) ARCH
=$(LINUX_KARCH
) PATH
=$(TARGET_PATH
)
215 $(LINUX_KERNEL
): $(LINUX_DIR
)/vmlinux
216 $(TARGET_CROSS
)objcopy
-O binary
-R .reginfo
-R .note
-R .comment
-R .mdebug
-S
$< $@
217 touch
-c
$(LINUX_KERNEL
)
219 $(LINUX_DIR
)/.modules_done
: $(LINUX_KERNEL
) $(LINUX_IMAGE
)
220 rm -rf
$(LINUX_BUILD_DIR
)/modules
221 $(MAKE
) -C
$(LINUX_DIR
) ARCH
=$(LINUX_KARCH
) PATH
=$(TARGET_PATH
) modules
222 $(MAKE
) -C
$(LINUX_DIR
) DEPMOD
=true INSTALL_MOD_PATH
=$(LINUX_BUILD_DIR
)/modules modules_install
223 touch
$(LINUX_DIR
)/.modules_done
225 $(STAGING_DIR
)/include/linux
/version.h
: $(LINUX_DIR
)/.configured
226 mkdir
-p
$(STAGING_DIR
)/include
227 tar -ch
-C
$(LINUX_DIR
)/include -f
- linux |
tar -xf
- -C
$(STAGING_DIR
)/include/
228 tar -ch
-C
$(LINUX_DIR
)/include -f
- asm |
tar -xf
- -C
$(STAGING_DIR
)/include/
230 $(STAMP_DIR
)/.linux-compile
: $(LINUX_DIR
)/.modules_done
231 @mkdir
-p
$(STAMP_DIR
)
233 ln
-sf
$(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
) $(LINUX_DIR
)
234 $(MAKE
) -C
$(TOPDIR
)/target
/linux
/package \
239 $(TARGET_MODULES_DIR
):
240 -mkdir
-p
$(TARGET_MODULES_DIR
)
243 rm -rf
$(KERNEL_IDIR
)
244 mkdir
-p
$(KERNEL_IDIR
)/etc
245 $(SCRIPT_DIR
)/make-ipkg-dir.sh
$(KERNEL_IDIR
) ..
/control
/kernel.control
$(PKG_RELEASE
) $(ARCH
)
246 echo
'Package: kernel-$(LINUX_VERSION)-$(BOARD)' >> $(KERNEL_IDIR
)/CONTROL
/control
247 if
[ -f .
/config
/$(BOARD
).modules
]; then \
248 cp .
/config
/$(BOARD
).modules
$(KERNEL_IDIR
)/etc
/modules
; \
250 $(IPKG_BUILD
) $(KERNEL_IDIR
) $(LINUX_BUILD_DIR
)
252 source
: $(DL_DIR
)/$(LINUX_SOURCE
)
253 prepare
: $(LINUX_DIR
)/.configured
254 compile
: $(STAMP_DIR
)/.linux-compile
256 install: compile
$(TARGET_MODULES_DIR
) $(KERNEL_IPKG
)
257 rm -rf
$(LINUX_BUILD_DIR
)/root
*
258 echo
-e
'dest root /\noption offline_root $(LINUX_BUILD_DIR)/root' > $(LINUX_BUILD_DIR
)/ipkg.conf
259 $(MAKE
) -C
$(TOPDIR
)/package \
260 TARGET_DIR
="$(LINUX_TARGET_DIR)" \
261 IPKG_CONF
="$(LINUX_BUILD_DIR)" \
264 $(MAKE
) -C
$(TOPDIR
)/target
/linux
/package \
267 [ "$(INSTALL_TARGETS)" != "" ] && $(IPKG_KERNEL
) install $(INSTALL_TARGETS
) || true
270 rm -f
$(STAMP_DIR
)/.linux-compile
271 rm -f
$(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
)/.modules_done
272 rm -f
$(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
)/.drivers-unpacked
273 $(MAKE
) -C
$(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
) clean
274 rm -f
$(LINUX_KERNEL
) $(LINUX_IMAGE
)
278 if
[ -f
$(LINUX_KERNEL
) ]; then \
284 rm -f
$(STAMP_DIR
)/.linux-compile
285 rm -rf
$(LINUX_BUILD_DIR
)