wok view linux/receipt @ rev 12812

linux: up to 3.2.14 for ARM arch
author Christophe Lincoln <pankso@slitaz.org>
date Sun May 20 03:10:40 2012 +0200 (2012-05-20)
parents 2b28b3fc0a64
children e0a72cb63515
line source
1 # SliTaz package receipt.
3 PACKAGE="linux"
4 VERSION="3.2.14"
5 KBASEVER="${VERSION:0:3}"
6 CATEGORY="base-system"
7 SHORT_DESC="The Linux kernel and modules."
8 MAINTAINER="devel@slitaz.org"
9 TARBALL="$PACKAGE-$KBASEVER.tar.xz"
10 WEB_SITE="http://www.kernel.org/"
11 WGET_URL="http://www.kernel.org/pub/linux/kernel/v3.0/$TARBALL"
12 HOST_ARCH="i486 arm x86_64"
14 DEPENDS="kmod"
15 BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch uclibc-cross-compiler-x86_64"
16 [ "$KBASEVER" != "$VERSION" ] && PATCH="http://www.kernel.org/pub/linux/kernel/v3.0/patch-$VERSION.xz"
18 # Aufs enable chroot
19 AUFS_NOT_SUPPORTED="uclibc-cross-compiler-x86_64 is not compatible with aufs 8("
21 # This will save/restore the modules.dep but we want to regenerate it
22 # on install/upgrade.
23 #CONFIG_FILES="/lib/modules/$KBASEVER-slitaz/modules.dep"
25 case "$ARCH" in
26 arm)
27 # Old school way :-) Until ARM was tested on real hardware and
28 # we know wich modules/features we realy need for ARM machines.
29 # No deps on kmod since we use Busybox modutils for ARM.
30 #TARBALL="$PACKAGE-$VERSION.tar.bz2"
31 DEPENDS=""
32 BUILD_DEPENDS="xz" ;;
33 esac
35 # Rules to configure and make the package.
36 compile_rules()
37 {
38 cd $src
40 case "$ARCH" in
41 arm)
42 echo "Compiling: ARM Kernel"
43 if [ ! -f $SRC/$(basename $PATCH) ]; then
44 wget $PATCH -O $SRC/$(basename $PATCH)
45 fi
46 make mrproper &&
47 xzcat $SRC/$(basename $PATCH) | patch -Np1
48 cp -f $stuff/$ARCH/linux-slitaz.config .config &&
49 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- bzImage &&
50 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- modules &&
51 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- \
52 INSTALL_MOD_PATH=$DESTDIR modules_install &&
53 mkdir -p $DESTDIR/boot &&
54 mv arch/arm/boot/compressed/vmlinux \
55 $DESTDIR/boot/linux-$VERSION-slitaz-$ARCH
56 return 0 ;;
57 x86_64)
58 echo "TODO: Maybe use default ? But cross compile in x86_64 chroot"
59 echo "so we can remove the 64 build by uclibc-cross-compiler-x86_64"
60 return 0 ;;
61 esac
63 # this is code to help update the kernel version faster
64 #for i in $(grep -l 'WANTED="linux"' $WOK/*/receipt)
65 #do
66 # sed -i 's|VERSION="OLDVERSION"|VERSION="NEWVERSION"|g' $i
67 #done
69 [ ! -x /usr/bin/cook ] && report open-bloc
71 # Check for Aufs and cook it if unbuilt.
72 echo "Checking for Aufs packages..."
73 _AUFSVER=`grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
74 if [ -x /usr/bin/cook ]; then
75 # Give info an redirect to /dev/null since aufs got it own log.
76 AUFSDIR=$WOK/aufs/source/aufs-${_AUFSVER}
77 [ -d "$AUFSDIR" ] && rm -rf $AUFSDIR
78 #echo "Cook: aufs $_AUFSVER"
79 cook aufs --getsrc
80 mkdir -p $WOK/aufs/source/
81 tar xjf $SRC/aufs-${_AUFSVER}.tar.bz2 -C $WOK/aufs/source/
82 elif [ -x /usr/bin/tazwok ]; then
83 # we just need aufs source. Also cooking now is a bad idea since it
84 # needs linux-module-headers. The one your cooking not the one from the web.
85 AUFSDIR=$WOK/aufs/aufs-${_AUFSVER}
86 [ -d "$AUFSDIR" ] && rm -rf $AUFSDIR
87 tazwok get-src aufs --target=$AUFSDIR || { report close-bloc; return 1; }
88 fi
89 echo "cook:linux" > $command
91 echo "Copying Aufs files and patches..."
92 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
93 cp -a $AUFSDIR/aufs3-*.patch $stuff
95 # SliTaz db
96 [ -d $WOK/$PACKAGE/source/slitaz ] && rm -rf $WOK/$PACKAGE/source/slitaz 2> /dev/null
97 mkdir -p $WOK/$PACKAGE/source/slitaz
98 echo "$WGET_URL" > $WOK/$PACKAGE/source/slitaz/url
99 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/source/slitaz
100 cp $stuff/bootloader.sh $WOK/$PACKAGE/source/slitaz
102 # Apply patches
103 echo "Applying patches..."
104 while read patch_file; do
105 echo "$patch_file" >> $WOK/$PACKAGE/source/slitaz/patches
106 cp $stuff/$patch_file $WOK/$PACKAGE/source/slitaz
107 if [ -f done.$patch_file ]; then
108 echo "Skipping $patch_file"
109 continue
110 fi
111 echo "Apply $patch_file"
112 if [ -x /usr/bin/cook ]; then
113 patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || return 1
114 elif [ -x /usr/bin/tazwok ]; then
115 patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || { report close-bloc; return 1; }
116 fi
117 touch done.$patch_file
118 done <<EOT
119 $PACKAGE-diff.u
120 $PACKAGE-header.u
121 $PACKAGE-freeinitrd.u
122 aufs3-base.patch
123 aufs3-standalone.patch
124 aufs3-loopback.patch
125 aufs3-proc_map.patch
126 channel-negative-one-maxim.patch
127 mac80211.compat08082009.wl_frag+ack_v1.patch
128 EOT
130 if [ "$KBASEVER" != "$VERSION" ]; then
131 if [ -f $SOURCES_REPOSITORY/$(basename $PATCH) ]; then
132 xzcat $SOURCES_REPOSITORY/$(basename $PATCH) | patch -Np1
133 touch done.patch-$VERSION
134 else
135 wget $PATCH -O $SRC/$(basename $PATCH)
136 xzcat $SRC/$(basename $PATCH) | patch -Np1
137 touch done.patch-$VERSION
138 fi
139 fi
141 sed -i 's|SUBLEVEL =.*|SUBLEVEL =|g' Makefile
143 [ ! -x /usr/bin/cook ] && report step "Make kernel proper and then build lguest"
144 [ -x /usr/bin/cook ] && echo "Make kernel proper and then build lguest"
145 make mrproper
146 cd Documentation/virtual/lguest
147 if [ -x /usr/bin/cook ]; then
148 make lguest || return 1
149 elif [ -x /usr/bin/tazwok ]; then
150 make lguest || { report close-bloc; return 1; }
151 fi
152 cd $src
154 case "$opt" in
155 *--no64*);;
156 *)
157 #
158 # Arch x86_64
159 #
160 [ ! -x /usr/bin/cook ] && report step "Make bzImage64 without modules first"
161 [ -x /usr/bin/cook ] && echo "Building x86_64 Kernel"
163 # Build bzImage64 without modules first
164 cp -f $stuff/$PACKAGE-slitaz.config64 .config
165 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
167 # We can't keep every driver in staging
168 sed -i -e 's/^CONFIG_RTL8192/#&/' \
169 -e 's/^CONFIG_R8187SE/#&/' \
170 -e 's/^CONFIG_RT2870/#&/' .config
171 yes '' | make ARCH=x86_64 oldconfig
172 if [ -x /usr/bin/cook ]; then
173 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || exit 1
174 elif [ -x /usr/bin/tazwok ]; then
175 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || { report close-bloc; return 1; }
176 fi
177 [ -d $PWD/_pkg ] || mkdir -p $DESTDIR/linux64
178 mv arch/x86/boot/bzImage $DESTDIR/linux64
179 mv System.map System.map-without-modules64
181 [ ! -x /usr/bin/cook ] && report step "Now build bzImage64 with modules"
183 # Build bzImage64 with modules
184 cp -f $stuff/$PACKAGE-slitaz.config64 .config
185 #make ARCH=x86_64 oldconfig
186 ln .config $WOK/$PACKAGE/slitaz/config64
187 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage &&
188 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- modules &&
189 make ARCH=x86_64 INSTALL_MOD_PATH=$DESTDIR/linux64 modules_install &&
190 make ARCH=x86_64 INSTALL_HDR_PATH=$DESTDIR/linux64/usr headers_install &&
191 if [ -x /usr/bin/cook ]; then
192 [ -s arch/x86/boot/bzImage ] || return 1
193 elif [ -x /usr/bin/tazwok ]; then
194 [ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; }
195 fi
196 mkdir -p $DESTDIR/linux64/boot 2> /dev/null
197 mv arch/x86/boot/bzImage $DESTDIR/linux64/boot/vmlinuz-$VERSION-slitaz
198 ln System.map System.map-modules64
199 ln Module.symvers Module.symvers-modules64
200 esac
202 #
203 # Standard kernel
204 #
205 [ ! -x /usr/bin/cook ] && report step "Make bzImage without modules first"
206 [ -x /usr/bin/cook ] && echo "Building standard kernel..."
208 # Build bzImage without modules first
209 cp -f $stuff/$PACKAGE-slitaz.config .config
210 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
212 # We can't keep every driver in staging
213 sed -i -e 's/^CONFIG_RTL8192/#&/' \
214 -e 's/^CONFIG_R8187SE/#&/' \
215 -e 's/^CONFIG_RT2870/#&/' .config
216 yes '' | make oldconfig
217 if [ -x /usr/bin/cook ]; then
218 make -j 4 bzImage || exit 1
219 elif [ -x /usr/bin/tazwok ]; then
220 make -j 4 bzImage || { report close-bloc; return 1; }
221 fi
222 [ -d $DESTDIR ] || mkdir -p $DESTDIR
223 mv arch/x86/boot/bzImage $DESTDIR
224 mv System.map System.map-without-modules
226 [ ! -x /usr/bin/cook ] && report step "Now build bzImage with modules"
228 # Build bzImage with modules
229 cp -f $stuff/$PACKAGE-slitaz.config .config
230 #make oldconfig
231 ln .config $WOK/$PACKAGE/source/slitaz/config
232 make -j 4 bzImage &&
233 make -j 4 modules &&
234 make INSTALL_MOD_PATH=$DESTDIR modules_install &&
235 make INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
236 if [ -x /usr/bin/cook ]; then
237 [ -s arch/x86/boot/bzImage ] || return 1
238 elif [ -x /usr/bin/tazwok ]; then
239 [ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; }
240 fi
241 mkdir -p $DESTDIR/boot 2> /dev/null
242 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
244 [ ! -x /usr/bin/cook ] && report step "Compressing all modules"
246 # Compress all modules.
247 $stuff/gztazmod.sh $DESTDIR/lib/modules/$KBASEVER-slitaz
248 $stuff/gztazmod.sh $DESTDIR/linux64/lib/modules/$KBASEVER-slitaz
249 ln System.map System.map-modules
250 ln Module.symvers Module.symvers-modules
252 if [ ! -x /usr/bin/cook ]; then
253 report close-bloc
254 fi
255 }
257 # Rules to gen a SliTaz package suitable for Tazpkg.
258 genpkg_rules()
259 {
260 case "$ARCH" in
261 arm)
262 echo "Packing: ARM Kernel"
263 cp -a $install/* $fs
264 rm -f $fs/lib/modules/*/build $fs/lib/modules/*/source
265 return 0 ;;
266 x86_64)
267 echo "TODO: use default or custom x86_64 packing"
268 return 0 ;;
269 esac
271 export PACKAGE VERSION
272 local path
273 cp -a $_pkg/boot $fs
274 # Compress all modules.
275 $stuff/gztazmod.sh $_pkg/lib/modules/$KBASEVER-slitaz
276 path=$fs/lib/modules/$KBASEVER-slitaz/kernel
277 mkdir -p $path
278 cp -a $_pkg/lib/modules/$KBASEVER-slitaz/mo* \
279 $fs/lib/modules/$KBASEVER-slitaz
280 # Get the base modules
281 export src
282 export _pkg
283 mkdir -p $WOK/$PACKAGE/source/tmp
284 $stuff/list_modules.sh \
285 $(cat $stuff/modules.list) > $WOK/$PACKAGE/source/tmp/modules.list
286 while read module; do
287 dir=$(dirname $module)
288 [ -d $path/$dir ] || mkdir -p $path/$dir
289 cp -a $_pkg/lib/modules/$KBASEVER-slitaz/kernel/$module $path/$dir
290 done < $WOK/$PACKAGE/source/tmp/modules.list
291 # Remove unresolved links
292 rm -f $fs/lib/modules/$KBASEVER-slitaz/build
293 rm -f $fs/lib/modules/$KBASEVER-slitaz/source
294 # Cook all packages with a kernel module
295 for i in $(cd $WOK; grep -l 'tazwok cook linux$' */receipt)
296 do
297 echo tazwok cook ${i%/receipt}
298 done
299 # Fixed modules.dep to use right path
300 # saves 100kb of space too
301 sed -i "s|$_pkg||g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep
302 sed -i "s|99.98.$KBASEVER-slitaz|$KBASEVER-slitaz|g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep
303 # Check and echo any module in kernel .config that's not added to
304 # one of linux-* pkgs
305 $stuff/check_modules.sh
306 }
308 # Pre and post install commands for Tazpkg.
309 post_install()
310 {
311 echo "Processing post-install commands..."
312 case "$ARCH" in
313 arm)
314 echo "Kernel : /boot/linux-$VERSION-slitaz-$ARCH"
315 echo "Modules: /lib/modules/$VERSION-slitaz"
316 return 0 ;;
317 esac
318 chroot "$1/" depmod -a $KBASEVER-slitaz
319 # GRUB stuff.
320 if [ -f "$1/boot/grub/menu.lst" ]; then
321 root_dev=`cat $1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1`
322 grub_dev=`cat $1/boot/grub/menu.lst | grep "root (" | head -n 1`
323 # Add new kernel entry in case of upgrade for installed system.
324 if ! grep -q vmlinuz-$VERSION-slitaz $1/boot/grub/menu.lst; then
325 cat >> $1/boot/grub/menu.lst << EOT
327 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
328 $grub_dev
329 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
330 EOT
331 fi
332 # Display information message.
333 cat <<EOT
334 ----
335 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
337 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
338 $grub_dev
339 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
340 ----
341 EOT
342 fi
343 }