1 # Makefile for building the IXP4xx kernel.
3 # Based on the build script for the Loft from Giant Shoulder, Inc.
5 # Based on the great work done in OpenEmbedded for the Linksys NSLU2
6 # written by the nslu2-linux development community.
8 # This builds the kernel in the linux-${REVISION} directory.
9 # It then installs all the kernel modules in lib
10 # and creates a tarball there containing all the modules
11 # under the lib/modules/${REVISION} directory.
13 # N.B. You may need to change your crosstool path
22 REVISION
:= $(shell sed
-e
's/-git.*//' patches
/${PATCHVER}/KERNEL
)
23 SNAPSHOT
:= $(shell cat patches
/${PATCHVER}/KERNEL
)
29 MADWIFIVER
= r1503-20060415
39 KERNEL_SOURCE
= http
://www2.kernel.org
/pub
/linux
/kernel
/v
${MAJORVER}/linux-
${BASEVER}.
tar.bz2
40 KERNEL_PATCH
= http
://www2.kernel.org
/pub
/linux
/kernel
/v
${MAJORVER}/testing
/patch-
${REVISION}.bz2
41 KERNEL_SNAPSHOT
= http
://www2.kernel.org
/pub
/linux
/kernel
/v
${MAJORVER}/snapshots
/patch-
${SNAPSHOT}.bz2
43 APEX_SOURCE
= ftp
://ftp.buici.com
/pub
/apex
/apex-
${APEX_REVISION}.
tar.gz
45 MADWIFI_SOURCE
= http
://snapshots.madwifi.org
/madwifi-ng
/madwifi-ng-
${MADWIFIVER}.
tar.gz
47 #CROSS_COMPILE = ${DEBIAN_ARCH}-linux-gnu-
48 CROSS_COMPILE ?
= ${DEBIAN_ARCH}-linux-
51 CROSS_COMPILE_FLAGS
= CROSS_COMPILE
=${CROSS_COMPILE}
56 all: kernel modules apex
58 kernel
: vmlinuz-nslu2-
${SNAPSHOT} vmlinuz-nas100d-
${SNAPSHOT} vmlinuz-loft-
${SNAPSHOT} vmlinuz-dsmg600-
${SNAPSHOT} vmlinuz-fsg3-
${SNAPSHOT}
59 madwifi
: lib
/modules
/${SNAPSHOT}/net
/ath_hal.ko
60 modules
: modules-
${SNAPSHOT}.
tar.gz
61 patched
: linux-
${SNAPSHOT}/.config
62 apex
: apex-
${APEX_CONFIG}-${APEX_TARGET}-${DEBIAN_ARCH}-${APEX_REVISION}.bin
64 # ifeq (${APEX_TARGET},fsg3)
65 # sed -i -e '/CONFIG_MACH_FSG/d' apex-${APEX_REVISION}/.config
66 # echo 'CONFIG_MACH_FSG=y' >> apex-${APEX_REVISION}/.config
67 # echo 'CONFIG_ARCH_NUMBER=1091' >> apex-${APEX_REVISION}/.config
70 apex-
${APEX_CONFIG}-${APEX_TARGET}-${DEBIAN_ARCH}-${APEX_REVISION}.bin
: apex-
${APEX_REVISION}/.config
71 ( cd apex-
${APEX_REVISION} ; \
72 ${MAKE} ${CROSS_COMPILE_FLAGS} ARCH
=arm
all )
74 devio
'<<'apex-
${APEX_REVISION}/apex.bin
>$@
'cp$$'
76 devio
'<<'apex-
${APEX_REVISION}/apex.bin
>$@
'xp $$,4'
79 apex-
${APEX_REVISION}/.config
: apex-
${APEX_REVISION}/src
/mach-ixp42x
/${APEX_CONFIG}-${APEX_TARGET}-${DEBIAN_ARCH}_config
80 ( cd apex-
${APEX_REVISION} ; \
81 ${MAKE} ${CROSS_COMPILE_FLAGS} ARCH
=arm
clean ; \
82 ${MAKE} ${CROSS_COMPILE_FLAGS} ARCH
=arm
${APEX_CONFIG}-${APEX_TARGET}-${DEBIAN_ARCH}_config
)
84 apex-
${APEX_REVISION}/src
/mach-ixp42x
/${APEX_CONFIG}-${APEX_TARGET}-${DEBIAN_ARCH}_config
: \
85 downloads
/apex-
${APEX_REVISION}.
tar.gz
86 [ -e apex-
${APEX_REVISION} ] || \
87 ( tar zxf downloads
/apex-
${APEX_REVISION}.
tar.gz
; \
88 cd apex-
${APEX_REVISION} ; \
89 ln
-s ..
/patches
/apex patches
; \
91 touch apex-
${APEX_REVISION}/Makefile
93 downloads
/apex-
${APEX_REVISION}.
tar.gz
:
94 [ -e downloads
/apex-
${APEX_REVISION}.
tar.gz
] || \
95 ( mkdir
-p downloads
; cd downloads
; \
98 usr
: usr-
${SNAPSHOT}.
tar.gz
100 usr-
${SNAPSHOT}.
tar.gz
: vmlinuz-
${SNAPSHOT} \
101 usr
/local
/bin
/wlanconfig
102 tar zcf usr-
${SNAPSHOT}.
tar.gz usr
/local
104 # Add the following depedency if you want madwifi built.
105 # lib/modules/${SNAPSHOT}/net/ath_hal.ko
107 modules-
${SNAPSHOT}.
tar.gz
: vmlinuz-
${SNAPSHOT}
108 tar zcf modules-
${SNAPSHOT}.
tar.gz lib
/modules
/${SNAPSHOT}
110 lib
/modules
/${SNAPSHOT}/net
/ath_hal.ko usr
/local
/bin
/wlanconfig
: \
111 madwifi-ng
/Makefile \
113 rm -rf lib
/modules
/${SNAPSHOT}/net
115 ${MAKE} CROSS_COMPILE
=${CROSS_COMPILE} TOOLPATH
=${CROSS_COMPILE} \
116 TARGET
=xscale-
${ENDIAN}e-elf \
117 KERNELPATH
=`cd .. ; pwd`/linux-
${SNAPSHOT} \
118 DESTDIR
=`cd .. ; pwd` \
121 madwifi-ng
/Makefile
: \
122 downloads
/madwifi-ng-
${MADWIFIVER}.
tar.gz
123 [ -e madwifi-ng
] || \
124 ( tar zxf downloads
/madwifi-ng-
${MADWIFIVER}.
tar.gz
; \
125 mv madwifi-ng-
${MADWIFIVER} madwifi-ng
; \
126 ( cd patches
/madwifi
; \
127 grep
-v \
# series | \
128 while read f
; do case
"$$f" in http
:*) wget
-O
- "$$f";; *) cat
"$$f";; esac
; done \
130 patch
-d madwifi-ng
-p1
)
133 downloads
/madwifi-ng-
${MADWIFIVER}.
tar.gz
:
134 [ -e downloads
/madwifi-ng-
${MADWIFIVER}.
tar.gz
] || \
135 ( mkdir
-p downloads
; cd downloads
; \
136 wget
${MADWIFI_SOURCE} )
138 vmlinuz-loft-
${SNAPSHOT}: vmlinuz-
${SNAPSHOT}
141 'wb 0xe3a01c03,4' 'wb 0xe3811051,4' \
145 'wb 0xe3a01c03,4' 'wb 0xe3811051,4' \
152 vmlinuz-nas100d-
${SNAPSHOT}: vmlinuz-
${SNAPSHOT}
163 vmlinuz-nslu2-
${SNAPSHOT}: vmlinuz-
${SNAPSHOT}
166 'wb 0xe3a01c02,4' 'wb 0xe3811055,4' \
170 'wb 0xe3a01c02,4' 'wb 0xe3811055,4' \
177 vmlinuz-dsmg600-
${SNAPSHOT}: vmlinuz-
${SNAPSHOT}
180 'wb 0xe3a01c03,4' 'wb 0xe38110c4,4' \
184 'wb 0xe3a01c03,4' 'wb 0xe38110c4,4' \
192 vmlinuz-fsg3-
${SNAPSHOT}: vmlinuz-
${SNAPSHOT}
195 'wb 0xe3a01c04,4' 'wb 0xe3811043,4' \
199 'wb 0xe3a01c04,4' 'wb 0xe3811043,4' \
207 vmlinuz-
${SNAPSHOT}: linux-
${SNAPSHOT}/.config
208 ( cd linux-
${SNAPSHOT} ; \
209 ${MAKE} ${CROSS_COMPILE_FLAGS} ARCH
=arm bzImage modules
)
210 ( cd linux-
${SNAPSHOT} ; \
211 INSTALL_MOD_PATH
=".." ${MAKE} ${CROSS_COMPILE_FLAGS} ARCH
=arm modules_install
)
212 rm -f lib
/modules
/${SNAPSHOT}/build lib
/modules
/${SNAPSHOT}/source
213 cp linux-
${SNAPSHOT}/arch
/arm
/boot
/zImage vmlinuz-
${SNAPSHOT}
215 menuconfig
: linux-
${SNAPSHOT}/.config
216 ${MAKE} -C linux-
${SNAPSHOT} ARCH
=arm CROSS_COMPILE
=${CROSS_COMPILE} menuconfig
218 ifeq (${SNAPSHOT},${BASEVER})
219 linux-
${SNAPSHOT}/.config
: \
220 downloads
/linux-
${BASEVER}.
tar.bz2 \
221 patches
/${PATCHVER}/series patches
/${PATCHVER}/??
-*.patch patches
/${PATCHVER}/$(DEFCONFIG
)
222 [ -e linux-
${REVISION} ] || \
223 ( tar xjf downloads
/linux-
${BASEVER}.
tar.bz2
; \
224 cd linux-
${SNAPSHOT} ; \
225 ln
-s ..
/patches
/${PATCHVER} patches
; \
228 ifeq (${REVISION},${SNAPSHOT})
229 linux-
${SNAPSHOT}/.config
: \
230 downloads
/linux-
${BASEVER}.
tar.bz2 \
231 downloads
/patch-
${REVISION}.bz2 \
232 patches
/${PATCHVER}/series patches
/${PATCHVER}/??
-*.patch patches
/${PATCHVER}/$(DEFCONFIG
)
233 [ -e linux-
${REVISION} ] || \
234 ( tar xjf downloads
/linux-
${BASEVER}.
tar.bz2
; \
235 mv linux-
${BASEVER} linux-
${SNAPSHOT} ; \
236 bzcat downloads
/patch-
${REVISION}.bz2 | \
237 patch
-d linux-
${SNAPSHOT} -p1
; \
238 cd linux-
${SNAPSHOT} ; \
239 ln
-s ..
/patches
/${PATCHVER} patches
; \
242 linux-
${SNAPSHOT}/.config
: \
243 downloads
/linux-
${BASEVER}.
tar.bz2 \
244 downloads
/patch-
${REVISION}.bz2 \
245 downloads
/patch-
${SNAPSHOT}.bz2 \
246 patches
/${PATCHVER}/series patches
/${PATCHVER}/??
-*.patch patches
/${PATCHVER}/$(DEFCONFIG
)
247 [ -e linux-
${REVISION} ] || \
248 ( tar xjf downloads
/linux-
${BASEVER}.
tar.bz2
; \
249 mv linux-
${BASEVER} linux-
${SNAPSHOT} ; \
250 bzcat downloads
/patch-
${REVISION}.bz2 downloads
/patch-
${SNAPSHOT}.bz2 | \
251 patch
-d linux-
${SNAPSHOT} -p1
; \
252 cd linux-
${SNAPSHOT} ; \
253 ln
-s ..
/patches
/${PATCHVER} patches
; \
258 sed
-e
's/.*CONFIG_CPU_BIG_ENDIAN.*/CONFIG_CPU_BIG_ENDIAN=y/' \
259 < patches
/${PATCHVER}/$(DEFCONFIG
) > linux-
${SNAPSHOT}/.config
261 sed
-e
's/.*CONFIG_CPU_BIG_ENDIAN.*/\# CONFIG_CPU_BIG_ENDIAN is not set/' \
262 < patches
/${PATCHVER}/$(DEFCONFIG
) > linux-
${SNAPSHOT}/.config
265 downloads
/linux-
${BASEVER}.
tar.bz2
:
266 [ -e downloads
/linux-
${BASEVER}.
tar.bz2
] || \
267 ( mkdir
-p downloads
; cd downloads
; \
268 wget
${KERNEL_SOURCE} )
270 downloads
/patch-
${REVISION}.bz2
:
271 [ -e downloads
/patch-
${REVISION}.bz2
] || \
272 ( mkdir
-p downloads
; cd downloads
; \
273 wget
${KERNEL_PATCH} )
275 ifneq (${REVISION},${SNAPSHOT})
276 downloads
/patch-
${SNAPSHOT}.bz2
:
277 [ -e downloads
/patch-
${SNAPSHOT}.bz2
] || \
278 ( mkdir
-p downloads
; cd downloads
; \
279 wget
${KERNEL_SNAPSHOT} )
285 clobber: clobber-apex
286 rm -rf vmlinuz-
* modules-
*.
tar.gz usr-
*.
tar.gz
294 .PHONY
: all kernel menuconfig modules
clobber apex clobber-apex