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
33 # CROSS_COMPILE = /home/slug/angstrom/tmp/cross/bin/${ARCH}-angstrom-linux-gnueabi-
35 REVISION
:= $(shell sed
-e
's/-git.*//' patches
/${PATCHVER}/KERNEL
)
36 SNAPSHOT
:= $(shell cat patches
/${PATCHVER}/KERNEL
)
38 APEX_REVISION
= 1.5.13
41 ARM_KERNEL_SHIM_REVISION
= 1.5
51 KERNEL_SOURCE
= http
://www2.kernel.org
/pub
/linux
/kernel
/v
${MAJORVER}/linux-
${BASEVER}.
tar.bz2
52 KERNEL_PATCH
= http
://www2.kernel.org
/pub
/linux
/kernel
/v
${MAJORVER}/testing
/patch-
${REVISION}.bz2
53 KERNEL_SNAPSHOT
= http
://www2.kernel.org
/pub
/linux
/kernel
/v
${MAJORVER}/snapshots
/patch-
${SNAPSHOT}.bz2
55 APEX_SOURCE
= ftp
://ftp.buici.com
/pub
/apex
/apex-
${APEX_REVISION}.
tar.gz
57 ARM_KERNEL_SHIM_SOURCE
= ftp
://ftp.buici.com
/pub
/arm
/arm-kernel-shim
/arm-kernel-shim-
${ARM_KERNEL_SHIM_REVISION}.
tar.gz
59 #CROSS_COMPILE = ${ARCH}-linux-gnu-
60 CROSS_COMPILE ?
= ${ARCH}-linux-
63 CROSS_COMPILE_FLAGS
= CROSS_COMPILE
=${CROSS_COMPILE}
68 all: kernel modules arm-kernel-shim apex
70 kernel
: vmlinuz-nslu2-
${SNAPSHOT}-${ARCH} vmlinuz-nas100d-
${SNAPSHOT}-${ARCH} vmlinuz-ixp4xx-
${SNAPSHOT}-${ARCH} vmlinuz-dsmg600-
${SNAPSHOT}-${ARCH} vmlinuz-fsg3-
${SNAPSHOT}-${ARCH}
71 modules
: modules-
${SNAPSHOT}-${ARCH}.
tar.gz
72 patched
: linux-
${SNAPSHOT}-${ARCH}/.config
73 apex
: apex-
${APEX_CONFIG}-nslu2-
${ARCH}-${APEX_REVISION}.bin \
74 apex-
${APEX_CONFIG}-nslu2-16mb-
${ARCH}-${APEX_REVISION}.bin \
75 apex-
${APEX_CONFIG}-nas100d-
${ARCH}-${APEX_REVISION}.bin \
76 apex-
${APEX_CONFIG}-dsmg600-
${ARCH}-${APEX_REVISION}.bin \
77 apex-
${APEX_CONFIG}-fsg3-
${ARCH}-${APEX_REVISION}.bin
79 arm-kernel-shim-nslu2
${ENDIAN}e.bin \
80 arm-kernel-shim-nas100d
${ENDIAN}e.bin \
81 arm-kernel-shim-dsmg600
${ENDIAN}e.bin \
82 arm-kernel-shim-fsg3
${ENDIAN}e.bin
84 apex-
${APEX_CONFIG}-%-${ARCH}-${APEX_REVISION}.bin
: apex-
${APEX_REVISION}/src
/mach-ixp42x
/${APEX_CONFIG}-%-${ARCH}_config
85 ( cd apex-
${APEX_REVISION} ; \
86 ${MAKE} ${CROSS_COMPILE_FLAGS} ARCH
=arm
clean ; \
87 ${MAKE} ${CROSS_COMPILE_FLAGS} ARCH
=arm
${APEX_CONFIG}-$*-${ARCH}_config
)
88 ( cd apex-
${APEX_REVISION} ; \
89 ${MAKE} ${CROSS_COMPILE_FLAGS} ARCH
=arm
all )
91 devio
'<<'apex-
${APEX_REVISION}/apex.bin
>$@
'cp$$'
93 devio
'<<'apex-
${APEX_REVISION}/apex.bin
>$@
'xp $$,4'
96 .PRECIOUS
: apex-
${APEX_REVISION}/src
/mach-ixp42x
/${APEX_CONFIG}-%-${ARCH}_config
98 apex-
${APEX_REVISION}/src
/mach-ixp42x
/${APEX_CONFIG}-%-${ARCH}_config
: \
99 downloads
/apex-
${APEX_REVISION}.
tar.gz
100 [ -e apex-
${APEX_REVISION} ] || \
101 ( tar zxf downloads
/apex-
${APEX_REVISION}.
tar.gz
; \
102 cd apex-
${APEX_REVISION} ; \
103 ln
-s ..
/patches
/apex patches
; \
104 [ ! -e patches
/series
] || quilt push
-a
)
105 touch apex-
${APEX_REVISION}/Makefile
107 downloads
/apex-
${APEX_REVISION}.
tar.gz
:
108 [ -e downloads
/apex-
${APEX_REVISION}.
tar.gz
] || \
109 ( mkdir
-p downloads
; cd downloads
; \
110 wget
${APEX_SOURCE} )
112 arm-kernel-shim-
%${ENDIAN}e.bin
: arm-kernel-shim-
${ARM_KERNEL_SHIM_REVISION}/config-
%${ENDIAN}e.h
113 ( cd arm-kernel-shim-
${ARM_KERNEL_SHIM_REVISION} ; \
114 mv config.h config.h.orig
; cp config-
$*${ENDIAN}e.h config.h
; \
115 ${MAKE} ${CROSS_COMPILE_FLAGS} clean arm-kernel-shim.bin
)
116 cp arm-kernel-shim-
${ARM_KERNEL_SHIM_REVISION}/arm-kernel-shim.bin \
117 arm-kernel-shim-
$*${ENDIAN}e.bin
119 arm-kernel-shim-
${ARM_KERNEL_SHIM_REVISION}/config-
%${ENDIAN}e.h
: \
120 downloads
/arm-kernel-shim-
${ARM_KERNEL_SHIM_REVISION}.
tar.gz
121 [ -e arm-kernel-shim-
${ARM_KERNEL_SHIM_REVISION} ] || \
122 ( tar zxf downloads
/arm-kernel-shim-
${ARM_KERNEL_SHIM_REVISION}.
tar.gz
; \
123 cd arm-kernel-shim-
${ARM_KERNEL_SHIM_REVISION} ; \
124 ln
-s ..
/patches
/arm-kernel-shim patches
; \
125 [ ! -e patches
/series
] || quilt push
-a
)
127 sed
-e
's|//#define FORCE_BIGENDIAN|#define FORCE_BIGENDIAN|' patches
/arm-kernel-shim
/config-
$*.h \
128 > arm-kernel-shim-
${ARM_KERNEL_SHIM_REVISION}/config-
$*${ENDIAN}e.h
130 sed
-e
's|//#define FORCE_LITTLEENDIAN|#define FORCE_LITTLEENDIAN|' patches
/arm-kernel-shim
/config-
$*.h \
131 > arm-kernel-shim-
${ARM_KERNEL_SHIM_REVISION}/config-
$*${ENDIAN}e.h
134 downloads
/arm-kernel-shim-
${ARM_KERNEL_SHIM_REVISION}.
tar.gz
:
135 [ -e downloads
/arm-kernel-shim-
${ARM_KERNEL_SHIM_REVISION}.
tar.gz
] || \
136 ( mkdir
-p downloads
; cd downloads
; \
137 wget
${ARM_KERNEL_SHIM_SOURCE} )
139 modules-
${SNAPSHOT}-${ARCH}.
tar.gz
: vmlinuz-
${SNAPSHOT}-${ARCH}
140 ( cd linux-
${SNAPSHOT}-${ARCH} ; \
141 INSTALL_MOD_PATH
="../modules-${SNAPSHOT}-${ARCH}" ${MAKE} ${CROSS_COMPILE_FLAGS} ARCH
=arm modules modules_install
) || true
142 rm -f modules-
${SNAPSHOT}-${ARCH}/lib
/modules
/${SNAPSHOT}/build modules-
${SNAPSHOT}-${ARCH}/lib
/modules
/${SNAPSHOT}/source
143 ifeq (${SNAPSHOT},${BASEVER})
144 tar -C modules-
${SNAPSHOT}-${ARCH} -zcf modules-
${SNAPSHOT}-${ARCH}.
tar.gz .
146 tar -C modules-
${SNAPSHOT}-${ARCH} -zcf modules-
${SNAPSHOT}-${ARCH}.
tar.gz .
149 vmlinuz-ixp4xx-
${SNAPSHOT}-${ARCH}: vmlinuz-
${SNAPSHOT}-${ARCH}
161 vmlinuz-
%-${SNAPSHOT}-${ARCH}: vmlinuz-
${SNAPSHOT}-${ARCH} arm-kernel-shim-
%${ENDIAN}e.bin
163 cat arm-kernel-shim-
$*${ENDIAN}e.bin vmlinuz-
${SNAPSHOT}-${ARCH} > $@
165 ( cat arm-kernel-shim-
$*${ENDIAN}e.bin vmlinuz-
${SNAPSHOT}-${ARCH} > $$$$ ; \
166 devio
'<<'$$$$ >$@
'xp $$,4' ; \
170 vmlinuz-
${SNAPSHOT}-${ARCH}: linux-
${SNAPSHOT}-${ARCH}/.config
171 ( cd linux-
${SNAPSHOT}-${ARCH} ; \
172 ${MAKE} ${CROSS_COMPILE_FLAGS} ARCH
=arm bzImage
)
173 cp linux-
${SNAPSHOT}-${ARCH}/arch
/arm
/boot
/zImage vmlinuz-
${SNAPSHOT}-${ARCH}
175 menuconfig
: linux-
${SNAPSHOT}-${ARCH}/.config
176 ${MAKE} -C linux-
${SNAPSHOT}-${ARCH} ARCH
=arm CROSS_COMPILE
=${CROSS_COMPILE} menuconfig
178 ifeq (${SNAPSHOT},${BASEVER})
179 linux-
${SNAPSHOT}-${ARCH}/.config
: \
180 downloads
/linux-
${BASEVER}.
tar.bz2 \
181 patches
/${PATCHVER}/series patches
/${PATCHVER}/??
-*.patch \
182 patches
/${PATCHVER}/$(DEFCONFIG
)
183 [ -e linux-
${SNAPSHOT}-${ARCH} ] || \
184 ( tar xjf downloads
/linux-
${BASEVER}.
tar.bz2
; \
185 mv linux-
${BASEVER} linux-
${SNAPSHOT}-${ARCH} ; \
186 cd linux-
${SNAPSHOT}-${ARCH} ; \
187 ln
-s ..
/patches
/${PATCHVER} patches
; \
190 ifeq (${REVISION},${SNAPSHOT})
191 linux-
${SNAPSHOT}-${ARCH}/.config
: \
192 downloads
/linux-
${BASEVER}.
tar.bz2 \
193 downloads
/patch-
${REVISION}.bz2 \
194 patches
/${PATCHVER}/series patches
/${PATCHVER}/??
-*.patch \
195 patches
/${PATCHVER}/$(DEFCONFIG
)
196 [ -e linux-
${SNAPSHOT}-${ARCH} ] || \
197 ( tar xjf downloads
/linux-
${BASEVER}.
tar.bz2
; \
198 mv linux-
${BASEVER} linux-
${SNAPSHOT}-${ARCH} ; \
199 bzcat downloads
/patch-
${REVISION}.bz2 | \
200 patch
-d linux-
${SNAPSHOT}-${ARCH} -p1
; \
201 cd linux-
${SNAPSHOT}-${ARCH} ; \
202 ln
-s ..
/patches
/${PATCHVER} patches
; \
205 linux-
${SNAPSHOT}-${ARCH}/.config
: \
206 downloads
/linux-
${BASEVER}.
tar.bz2 \
207 downloads
/patch-
${REVISION}.bz2 \
208 downloads
/patch-
${SNAPSHOT}.bz2 \
209 patches
/${PATCHVER}/series patches
/${PATCHVER}/??
-*.patch \
210 patches
/${PATCHVER}/$(DEFCONFIG
)
211 [ -e linux-
${SNAPSHOT}-${ARCH} ] || \
212 ( tar xjf downloads
/linux-
${BASEVER}.
tar.bz2
; \
213 mv linux-
${BASEVER} linux-
${SNAPSHOT}-${ARCH} ; \
214 bzcat downloads
/patch-
${REVISION}.bz2 downloads
/patch-
${SNAPSHOT}.bz2 | \
215 patch
-d linux-
${SNAPSHOT}-${ARCH} -p1
; \
216 cd linux-
${SNAPSHOT}-${ARCH} ; \
217 ln
-s ..
/patches
/${PATCHVER} patches
; \
222 sed
-e
's/.*CONFIG_CPU_BIG_ENDIAN.*/CONFIG_CPU_BIG_ENDIAN=y/' \
223 < patches
/${PATCHVER}/$(DEFCONFIG
) > linux-
${SNAPSHOT}-${ARCH}/.config
225 sed
-e
's/.*CONFIG_CPU_BIG_ENDIAN.*/\# CONFIG_CPU_BIG_ENDIAN is not set/' \
226 < patches
/${PATCHVER}/$(DEFCONFIG
) > linux-
${SNAPSHOT}-${ARCH}/.config
229 downloads
/linux-
${BASEVER}.
tar.bz2
:
230 [ -e downloads
/linux-
${BASEVER}.
tar.bz2
] || \
231 ( mkdir
-p downloads
; cd downloads
; \
232 wget
${KERNEL_SOURCE} )
234 downloads
/patch-
${REVISION}.bz2
:
235 [ -e downloads
/patch-
${REVISION}.bz2
] || \
236 ( mkdir
-p downloads
; cd downloads
; \
237 wget
${KERNEL_PATCH} )
239 ifneq (${REVISION},${SNAPSHOT})
240 downloads
/patch-
${SNAPSHOT}.bz2
:
241 [ -e downloads
/patch-
${SNAPSHOT}.bz2
] || \
242 ( mkdir
-p downloads
; cd downloads
; \
243 wget
${KERNEL_SNAPSHOT} )
249 clobber: clobber-apex clobber-arm-kernel-shim
250 rm -rf vmlinuz-
* modules-
*.
tar.gz
251 rm -rf linux-
* modules-
*
257 clobber-arm-kernel-shim
:
258 rm -rf arm-kernel-shim-
*
260 .PHONY
: all kernel menuconfig modules
clobber apex clobber-apex clobber-arm-kernel-shim