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
22 MODULES_SUBDIR
:=lib
/modules
/$(LINUX_VERSION
)
23 LINUX_KCONFIG
:=.
/config
/$(BOARD
)
24 LINUX_BUILD_DIR
:=$(BUILD_DIR
)/linux-2.4
-$(BOARD
)
25 LINUX_TARGET_DIR
:=$(LINUX_BUILD_DIR
)/root
26 LINUX_KERNEL
:=$(LINUX_BUILD_DIR
)/vmlinux
28 LINUX_KARCH
:=$(shell echo
$(ARCH
) | sed
-e
's/i[3-9]86/i386/' \
34 LINUX_BINARY_DRIVER_SITE
:= http
://openwrt.org
/downloads
/
35 LINUX_SOURCE
:= linux-
$(LINUX_VERSION
).
tar.bz2
36 LINUX_BINLOC
:= arch
/$(LINUX_KARCH
)/bcm947xx
/compressed
/piggy
37 LINUX_SOURCE_DIR
:= $(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
)
38 MODULES_DIR
:= $(LINUX_BUILD_DIR
)/modules
/$(MODULES_SUBDIR
)
39 TARGET_MODULES_DIR
:= $(TARGET_DIR
)/lib
/modules
/$(LINUX_VERSION
)
40 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
42 PKG_BUILD_DIR
:= $(LINUX_BUILD_DIR
)/linux-modules
45 KERNEL_IPKG
:=$(LINUX_BUILD_DIR
)/kernel_
$(LINUX_VERSION
)-$(BOARD
)-$(PKG_RELEASE
)_
$(ARCH
).ipk
46 KERNEL_IDIR
:=$(LINUX_BUILD_DIR
)/kernel-ipkg
48 include $(LINUX_KCONFIG
)
54 INSTALL_TARGETS
:= $(KERNEL_IPKG
)
56 $(eval
$(call KMOD_template
,DIAG
,diag
,\
57 $(MODULES_DIR
)/kernel
/drivers
/net
/diag
/diag.o \
59 $(eval
$(call KMOD_template
,BRCM_WL
,brcm-wl
,\
60 $(MODULES_DIR
)/kernel
/drivers
/net
/wl
/wl.o \
62 $(eval
$(call KMOD_template
,B44
,b44
,\
63 $(MODULES_DIR
)/kernel
/drivers
/net
/b44.o \
65 $(eval
$(call KMOD_template
,BRCM_ET
,brcm-et
,\
66 $(MODULES_DIR
)/kernel
/drivers
/net
/et
/et.o \
68 $(eval
$(call KMOD_template
,ARPT
,arptables
,\
69 $(MODULES_DIR
)/kernel
/net
/ipv4
/netfilter
/arp
*.o \
70 ,CONFIG_IP_NF_ARPTABLES
))
71 $(eval
$(call KMOD_template
,EBT
,ebtables
,\
72 $(MODULES_DIR
)/kernel
/net
/bridge
/netfilter
/*.o \
73 ,CONFIG_BRIDGE_NF_EBTABLES
))
74 $(eval
$(call KMOD_template
,IPTABLES_V4_EXTRA
,iptables-extra
,\
75 $(MODULES_DIR
)/kernel
/net
/ipv4
/netfilter
/ip
*.o \
77 $(eval
$(call KMOD_template
,IPTABLES_V6
,ip6tables
,\
78 $(MODULES_DIR
)/kernel
/net
/ipv6
/netfilter
/ip
*.o \
79 ,CONFIG_IP6_NF_IPTABLES
,kmod-ipv6
))
80 $(eval
$(call KMOD_template
,IPV6
,ipv6
,\
81 $(MODULES_DIR
)/kernel
/net
/ipv6
/ipv6.o \
83 $(eval
$(call KMOD_template
,CIFS
,cifs
,\
84 $(MODULES_DIR
)/kernel
/fs
/cifs
/cifs.o \
86 $(eval
$(call KMOD_template
,NFS
,nfs
,\
87 $(MODULES_DIR
)/kernel
/fs
/lockd
/*.o \
88 $(MODULES_DIR
)/kernel
/fs
/nfs
/*.o \
89 $(MODULES_DIR
)/kernel
/net
/sunrpc
/*.o \
91 $(eval
$(call KMOD_template
,USB
,usb-core
,\
92 $(MODULES_DIR
)/kernel
/drivers
/usb
/usbcore.o \
94 $(eval
$(call KMOD_template
,USB_UHCI
,usb-uhci
,\
95 $(MODULES_DIR
)/kernel
/drivers
/usb
/host
/uhci.o \
96 ,CONFIG_USB_UHCI_ALT
,kmod-usb-core
))
97 $(eval
$(call KMOD_template
,USB_OHCI
,usb-ohci
,\
98 $(MODULES_DIR
)/kernel
/drivers
/usb
/host
/usb-ohci.o \
99 ,CONFIG_USB_OHCI
,kmod-usb-core
))
100 $(eval
$(call KMOD_template
,USB2
,usb2
,\
101 $(MODULES_DIR
)/kernel
/drivers
/usb
/host
/ehci-hcd.o \
102 ,CONFIG_USB_EHCI_HCD
,kmod-usb-core
))
103 $(eval
$(call KMOD_template
,USB_STORAGE
,usb-storage
,\
104 $(MODULES_DIR
)/kernel
/drivers
/scsi
/*.o \
105 $(MODULES_DIR
)/kernel
/drivers
/usb
/storage
/*.o \
106 ,CONFIG_USB_STORAGE
))
107 $(eval
$(call KMOD_template
,USB_PRINTER
,usb-printer
,\
108 $(MODULES_DIR
)/kernel
/drivers
/usb
/printer.o \
109 ,CONFIG_USB_PRINTER
))
110 $(eval
$(call KMOD_template
,LP
,lp
,\
111 $(MODULES_DIR
)/kernel
/drivers
/parport
/parport.o \
112 $(MODULES_DIR
)/kernel
/drivers
/parport
/parport_splink.o \
113 $(MODULES_DIR
)/kernel
/drivers
/char
/lp.o \
115 $(eval
$(call KMOD_template
,IDE
,ide
,\
116 $(MODULES_DIR
)/kernel
/drivers
/ide
/*.o \
117 $(MODULES_DIR
)/kernel
/drivers
/ide
/*/*.o \
119 $(eval
$(call KMOD_template
,EXT2
,ext2
,\
120 $(MODULES_DIR
)/kernel
/fs
/ext2
/*.o \
122 $(eval
$(call KMOD_template
,EXT3
,ext3
,\
123 $(MODULES_DIR
)/kernel
/fs
/ext3
/*.o \
124 $(MODULES_DIR
)/kernel
/fs
/jbd
/*.o \
126 $(eval
$(call KMOD_template
,XFS
,xfs
,\
127 $(MODULES_DIR
)/kernel
/fs
/xfs
/*.o \
129 $(eval
$(call KMOD_template
,HFSPLUS
,hfsplus
,\
130 $(MODULES_DIR
)/kernel
/fs
/hfsplus
/*.o \
132 $(eval
$(call KMOD_template
,VFAT
,vfat
,\
133 $(MODULES_DIR
)/kernel
/fs
/vfat
/vfat.o \
134 $(MODULES_DIR
)/kernel
/fs
/fat
/fat.o \
136 $(eval
$(call KMOD_template
,CRYPTO
,crypto
,\
137 $(MODULES_DIR
)/kernel
/crypto
/*.o \
139 $(eval
$(call KMOD_template
,PPP
,ppp
,\
140 $(MODULES_DIR
)/kernel
/drivers
/net
/ppp_async.o \
141 $(MODULES_DIR
)/kernel
/drivers
/net
/ppp_generic.o \
142 $(MODULES_DIR
)/kernel
/drivers
/net
/slhc.o \
144 $(eval
$(call KMOD_template
,MPPE
,mppe
,\
145 $(MODULES_DIR
)/kernel
/drivers
/net
/ppp_mppe_mppc.o \
146 ,CONFIG_PPP_MPPE_MPPC
))
147 $(eval
$(call KMOD_template
,PPPOE
,pppoe
,\
148 $(MODULES_DIR
)/kernel
/drivers
/net
/pppoe.o \
149 $(MODULES_DIR
)/kernel
/drivers
/net
/pppox.o \
151 $(eval
$(call KMOD_template
,TUN
,tun
,\
152 $(MODULES_DIR
)/kernel
/drivers
/net
/tun.o \
154 $(eval
$(call KMOD_template
,GRE
,gre
,\
155 $(MODULES_DIR
)/kernel
/net
/ipv4
/ip_gre.o \
157 $(eval
$(call KMOD_template
,SCHED
,sched
,\
158 $(MODULES_DIR
)/kernel
/net
/sched
/*.o \
161 $(TARGETS
): $(PACKAGE_DIR
)
164 mkdir
-p
$(PACKAGE_DIR
)
166 $(LINUX_DIR
)/.unpacked
: $(DL_DIR
)/$(LINUX_SOURCE
) $(DL_DIR
)/$(LINUX_BINARY_WL_DRIVER
) $(DL_DIR
)/$(LINUX_ET_DRIVER
)
167 -mkdir
-p
$(LINUX_BUILD_DIR
)
168 bzcat
$(DL_DIR
)/$(LINUX_SOURCE
) |
tar -C
$(LINUX_BUILD_DIR
) $(TAR_OPTIONS
) -
170 ln
-s
$(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
) $(LINUX_DIR
)
171 touch
$(LINUX_DIR
)/.unpacked
173 $(LINUX_DIR
)/.patched
: $(LINUX_DIR
)/.unpacked
174 [ -d .
/patches
/$(BOARD
) ] && $(PATCH
) $(LINUX_DIR
) .
/patches
/$(BOARD
)
175 $(PATCH
) $(LINUX_DIR
) .
/patches
/generic
176 touch
$(LINUX_DIR
)/.patched
178 $(LINUX_DIR
)/.configured
: $(LINUX_DIR
)/.patched
179 -cp
$(LINUX_KCONFIG
) $(LINUX_DIR
)/.config
180 $(SED
) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" \
181 $(LINUX_DIR
)/Makefile \
182 $(LINUX_DIR
)/arch
/mips
/Makefile
183 $(SED
) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR
)/arch
/mips
/Makefile
184 $(MAKE
) -C
$(LINUX_DIR
) ARCH
=$(LINUX_KARCH
) oldconfig
include/linux
/version.h
185 touch
$(LINUX_DIR
)/.configured
187 $(LINUX_DIR
)/.depend_done
: $(LINUX_DIR
)/.configured
188 $(MAKE
) -C
$(LINUX_DIR
) ARCH
=$(LINUX_KARCH
) dep
189 touch
$(LINUX_DIR
)/.depend_done
191 $(LINUX_DIR
)/$(LINUX_BINLOC
): $(LINUX_DIR
)/.depend_done
192 $(MAKE
) -C
$(LINUX_DIR
) ARCH
=$(LINUX_KARCH
) PATH
=$(TARGET_PATH
) $(LINUX_FORMAT
)
194 $(LINUX_KERNEL
): $(LINUX_DIR
)/$(LINUX_BINLOC
)
196 touch
-c
$(LINUX_KERNEL
)
198 $(LINUX_DIR
)/.modules_done
: $(LINUX_KERNEL
) $(LINUX_IMAGE
)
199 rm -rf
$(LINUX_BUILD_DIR
)/modules
200 $(MAKE
) -C
$(LINUX_DIR
) ARCH
=$(LINUX_KARCH
) PATH
=$(TARGET_PATH
) modules
201 $(MAKE
) -C
$(LINUX_DIR
) DEPMOD
=true INSTALL_MOD_PATH
=$(LINUX_BUILD_DIR
)/modules modules_install
202 touch
$(LINUX_DIR
)/.modules_done
204 $(STAGING_DIR
)/include/linux
/version.h
: $(LINUX_DIR
)/.configured
205 mkdir
-p
$(STAGING_DIR
)/include
206 tar -ch
-C
$(LINUX_DIR
)/include -f
- linux |
tar -xf
- -C
$(STAGING_DIR
)/include/
207 tar -ch
-C
$(LINUX_DIR
)/include -f
- asm |
tar -xf
- -C
$(STAGING_DIR
)/include/
209 $(TARGET_MODULES_DIR
):
210 -mkdir
-p
$(TARGET_MODULES_DIR
)
213 rm -rf
$(KERNEL_IDIR
)
214 mkdir
-p
$(KERNEL_IDIR
)/etc
215 $(SCRIPT_DIR
)/make-ipkg-dir.sh
$(KERNEL_IDIR
) ..
/control
/kernel.control
$(LINUX_VERSION
)-$(BOARD
)-$(PKG_RELEASE
) $(ARCH
)
216 if
[ -f .
/config
/$(BOARD
).modules
]; then \
217 cp .
/config
/$(BOARD
).modules
$(KERNEL_IDIR
)/etc
/modules
; \
219 $(IPKG_BUILD
) $(KERNEL_IDIR
) $(LINUX_BUILD_DIR
)
221 source
: $(DL_DIR
)/$(LINUX_SOURCE
)
222 prepare
: $(LINUX_DIR
)/.configured
223 compile
: $(LINUX_DIR
)/.modules_done
$(TARGETS
)
224 ln
-sf
$(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
) $(LINUX_DIR
)
225 $(MAKE
) -C
$(TOPDIR
)/target
/linux
/package \
227 TARGET_DIR
="$(LINUX_TARGET_DIR)" \
228 BUILD_DIR
="$(LINUX_BUILD_DIR)" \
229 KERNEL_DIR
="$(LINUX_SOURCE_DIR)" \
230 LINUX_VERSION
="$(LINUX_VERSION)" \
231 KERNEL_RELEASE
="$(PKG_RELEASE)"
233 install: compile
$(TARGET_MODULES_DIR
) $(KERNEL_IPKG
)
234 rm -rf
$(LINUX_BUILD_DIR
)/root
*
235 cp
-a
$(BUILD_DIR
)/root
$(LINUX_BUILD_DIR
)/
236 echo
-e
'dest root /\noption offline_root $(LINUX_BUILD_DIR)/root' > $(LINUX_BUILD_DIR
)/ipkg.conf
237 [ "$(INSTALL_TARGETS)" != "" ] && $(IPKG_KERNEL
) install $(INSTALL_TARGETS
) || true
240 rm -f
$(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
)/.
{drivers-unpacked
,modules_done
}
241 $(MAKE
) -C
$(LINUX_BUILD_DIR
)/linux-
$(LINUX_VERSION
) clean
242 rm -f
$(LINUX_KERNEL
) $(LINUX_IMAGE
)
246 if
[ -f
$(LINUX_KERNEL
) ]; then \
252 rm -rf
$(LINUX_BUILD_DIR
)