wok view linux/receipt @ rev 15707

linux: update aufs3 patch name
author Richard Dunbar <mojo@slitaz.org>
date Sun Dec 22 14:29:04 2013 +0000 (2013-12-22)
parents e012a20e6db4
children f4df390821bc
line source
1 # SliTaz package receipt.
3 PACKAGE="linux"
4 VERSION="3.2.53"
5 KBASEVER="${VERSION:0:3}"
6 CATEGORY="base-system"
7 SHORT_DESC="The Linux kernel and modules."
8 MAINTAINER="devel@slitaz.org"
9 LICENSE="GPL2"
10 TARBALL="$PACKAGE-$KBASEVER.tar.xz"
11 WEB_SITE="http://www.kernel.org/"
12 WGET_URL="ftp://ftp.kernel.org/pub/linux/kernel/v3.0/$TARBALL"
13 HOST_ARCH="i486 arm x86_64"
15 DEPENDS="kmod"
16 BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch \
17 uclibc-cross-compiler-x86_64 busybox-boot"
19 # Use version patch so we dont dl full kernel source on each minor update
20 [ "$KBASEVER" != "$VERSION" ] &&
21 PATCH="$(dirname $WGET_URL)/patch-$VERSION.xz" &&
22 EXTRA_SOURCE_FILES="$(basename $PATCH)"
24 # Aufs enable chroot
25 AUFS_NOT_RAMFS="uclibc-cross-compiler-x86_64 is not compatible with aufs+tmpfs 8("
27 # This will save/restore modules.dep but we want to regenerate it on
28 # install or upgrade.
29 #CONFIG_FILES="/lib/modules/$KBASEVER-slitaz/modules.dep"
31 # Handle multiarch compilation. Less bdeps when cross-compiling for ARM
32 case "$ARCH" in
33 arm) BUILD_DEPENDS="xz" TARBALL="$PACKAGE-$VERSION.tar.bz2" ;;
34 x86_64) BUILD_DEPENDS="xz" ;;
35 esac
37 # TODO: slitaz.conf provide SLITAZ_ARCH and must be handled by tazpkg/spk
38 [ -f "$root/etc/slitaz/slitaz.conf" ] && . $root/etc/slitaz/slitaz.conf
40 # Handle multiarch installation. ARM use Busybox modutils, so avoid any
41 # deps on kmod
42 case "$SLITAZ_ARCH" in
43 arm) DEPENDS="" ;;
44 esac
46 # Rules to configure and make the package.
47 compile_rules()
48 {
49 cd $src
50 cp /usr/share/boot/initrd initrd.cpio
52 if [ "$KBASEVER" != "$VERSION" ]; then
53 [ -s $SRC/$(basename $PATCH) ] ||
54 wget $PATCH -O $SRC/$(basename $PATCH)
55 xzcat $SRC/$(basename $PATCH) | patch -Np1
56 touch done.patch-$VERSION
57 fi
59 case "$ARCH" in
60 arm)
61 echo "Compiling: ARM Kernel"
62 if [ ! -s $SRC/$(basename $PATCH) ]; then
63 wget $PATCH -O $SRC/$(basename $PATCH)
64 fi
65 make mrproper
66 # Buggy: we got kernel panic about module not tinted 3.2.14
67 #echo "Applying patch: $(basename $PATCH)"
68 #xzcat $SRC/$(basename $PATCH) | patch -Np1 >/dev/null
69 patch -Np1 < $stuff/$ARCH/linux-arm.patch || exit 1
70 cp -f $stuff/$ARCH/linux-arm.config .config
71 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- bzImage &&
72 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- modules &&
73 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- \
74 INSTALL_MOD_PATH=$DESTDIR modules_install &&
75 mkdir -p $DESTDIR/boot &&
76 cp -a arch/arm/boot/zImage \
77 $DESTDIR/boot/linux-$VERSION-slitaz-$ARCH
78 return 0 ;;
79 x86_64)
80 echo "TODO: Maybe use default ? But cross compile in x86_64 chroot"
81 echo "so we can remove the 64 build by uclibc-cross-compiler-x86_64"
82 return 0 ;;
83 esac
85 [ ! -x /usr/bin/cook ] && report open-bloc
87 # Check for Aufs and cook it if unbuilt.
88 echo "Checking for Aufs packages..."
89 _AUFSVER=`grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
90 if [ -x /usr/bin/cook ]; then
91 # Give info an redirect to /dev/null since aufs got it own log.
92 AUFSDIR=$WOK/aufs/source/aufs-${_AUFSVER}
93 [ -d "$AUFSDIR" ] && rm -rf $AUFSDIR
94 #echo "Cook: aufs $_AUFSVER"
95 cook aufs --getsrc
96 mkdir -p $WOK/aufs/source/
97 tar xjf $SRC/aufs-${_AUFSVER}.tar.bz2 -C $WOK/aufs/source/
98 elif [ -x /usr/bin/tazwok ]; then
99 # we just need aufs source. Also cooking now is a bad idea since it
100 # needs linux-module-headers. The one your cooking not the one from the web.
101 AUFSDIR=$WOK/aufs/aufs-${_AUFSVER}
102 [ -d "$AUFSDIR" ] && rm -rf $AUFSDIR
103 tazwok get-src aufs --target=$AUFSDIR || { report close-bloc; return 1; }
104 fi
105 echo "cook:linux" > $command
107 echo "Copying Aufs files and patches..."
108 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
109 cp -a $AUFSDIR/aufs3-*.patch $stuff
111 # SliTaz db
112 [ -d $WOK/$PACKAGE/source/slitaz ] && rm -rf $WOK/$PACKAGE/source/slitaz 2> /dev/null
113 mkdir -p $WOK/$PACKAGE/source/slitaz
114 echo "$WGET_URL" > $WOK/$PACKAGE/source/slitaz/url
115 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/source/slitaz
116 cp $stuff/bootloader.sh $WOK/$PACKAGE/source/slitaz
118 # Apply patches
119 echo "Applying patches..."
120 while read patch_file; do
121 echo "$patch_file" >> $WOK/$PACKAGE/source/slitaz/patches
122 cp $stuff/$patch_file $WOK/$PACKAGE/source/slitaz
123 if [ -f done.$patch_file ]; then
124 echo "Skipping $patch_file"
125 continue
126 fi
127 echo "Apply $patch_file"
128 if [ -x /usr/bin/cook ]; then
129 patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || return 1
130 elif [ -x /usr/bin/tazwok ]; then
131 patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || { report close-bloc; return 1; }
132 fi
133 touch done.$patch_file
134 done <<EOT
135 $PACKAGE-diff.u
136 $PACKAGE-header.u
137 $PACKAGE-freeinitrd.u
138 $PACKAGE-subroot.u
139 $PACKAGE-CVE-2013-2929.u
140 aufs3-base.patch
141 aufs3-standalone.patch
142 aufs3-loopback.patch
143 aufs3-mmap.patch
144 channel-negative-one-maxim.patch
145 mac80211.compat08082009.wl_frag+ack_v1.patch
146 EOT
148 sed -i 's|SUBLEVEL =.*|SUBLEVEL =|g' Makefile
150 [ ! -x /usr/bin/cook ] && report step "Make kernel proper and then build lguest"
151 [ -x /usr/bin/cook ] && echo "Make kernel proper and then build lguest"
152 make mrproper
153 cd Documentation/virtual/lguest
154 if [ -x /usr/bin/cook ]; then
155 make lguest || return 1
156 elif [ -x /usr/bin/tazwok ]; then
157 make lguest || { report close-bloc; return 1; }
158 fi
159 cd $src
161 case "$opt" in
162 *--no64*);;
163 *)
164 #
165 # Arch x86_64
166 #
167 [ ! -x /usr/bin/cook ] && report step "Make bzImage64 without modules first"
168 [ -x /usr/bin/cook ] && echo "Building x86_64 Kernel"
170 # Build bzImage64 without modules first
171 cp -f $stuff/$PACKAGE-slitaz.config64 .config
172 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
174 # We can't keep every driver in staging
175 sed -i -e 's/^CONFIG_RTL8192/#&/' \
176 -e 's/^CONFIG_R8187SE/#&/' \
177 -e 's/^CONFIG_RT2870/#&/' .config
178 yes '' | make ARCH=x86_64 oldconfig
179 if [ -x /usr/bin/cook ]; then
180 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || exit 1
181 elif [ -x /usr/bin/tazwok ]; then
182 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || { report close-bloc; return 1; }
183 fi
184 [ -d $DESTDIR ] || mkdir -p $DESTDIR/linux64
185 mv arch/x86/boot/bzImage $DESTDIR/linux64
186 mv System.map System.map-without-modules64
188 [ ! -x /usr/bin/cook ] && report step "Now build bzImage64 with modules"
190 # Build bzImage64 with modules
191 cp -f $stuff/$PACKAGE-slitaz.config64 .config
192 #make ARCH=x86_64 oldconfig
193 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage &&
194 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- modules &&
195 make ARCH=x86_64 INSTALL_MOD_PATH=$DESTDIR/linux64 modules_install &&
196 make ARCH=x86_64 INSTALL_HDR_PATH=$DESTDIR/linux64/usr headers_install &&
197 ln .config $WOK/$PACKAGE/source/slitaz/config64
198 if [ -x /usr/bin/cook ]; then
199 [ -s arch/x86/boot/bzImage ] || return 1
200 elif [ -x /usr/bin/tazwok ]; then
201 [ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; }
202 fi
203 mkdir -p $DESTDIR/linux64/boot 2> /dev/null
204 mv arch/x86/boot/bzImage $DESTDIR/linux64/boot/vmlinuz-$VERSION-slitaz
205 ln System.map System.map-modules64
206 ln Module.symvers Module.symvers-modules64
207 esac
209 #
210 # Standard kernel
211 #
212 [ ! -x /usr/bin/cook ] && report step "Make bzImage without modules first"
213 [ -x /usr/bin/cook ] && echo "Building standard kernel..."
215 # Build bzImage without modules first
216 cp -f $stuff/$PACKAGE-slitaz.config .config
217 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
219 # We can't keep every driver in staging
220 sed -i -e 's/^CONFIG_RTL8192/#&/' \
221 -e 's/^CONFIG_R8187SE/#&/' \
222 -e 's/^CONFIG_RT2870/#&/' .config
223 yes '' | make ARCH=i386 oldconfig
224 if [ -x /usr/bin/cook ]; then
225 make ARCH=i386 -j 4 bzImage || exit 1
226 elif [ -x /usr/bin/tazwok ]; then
227 make ARCH=i386 -j 4 bzImage || { report close-bloc; return 1; }
228 fi
229 [ -d $DESTDIR ] || mkdir -p $DESTDIR
230 mv arch/x86/boot/bzImage $DESTDIR
231 mv System.map System.map-without-modules
233 [ ! -x /usr/bin/cook ] && report step "Now build bzImage with modules"
235 # Build bzImage with modules
236 cp -f $stuff/$PACKAGE-slitaz.config .config
237 #make ARCH=i386 oldconfig
238 ln .config $WOK/$PACKAGE/source/slitaz/config
239 make ARCH=i386 -j 4 bzImage &&
240 make ARCH=i386 -j 4 modules &&
241 make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR modules_install &&
242 make ARCH=i386 INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
243 if [ -x /usr/bin/cook ]; then
244 [ -s arch/x86/boot/bzImage ] || return 1
245 elif [ -x /usr/bin/tazwok ]; then
246 [ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; }
247 fi
248 mkdir -p $DESTDIR/boot 2> /dev/null
249 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
251 [ ! -x /usr/bin/cook ] && report step "Compressing all modules"
253 # Compress all modules.
254 $stuff/gztazmod.sh $DESTDIR/lib/modules/$KBASEVER-slitaz
255 $stuff/gztazmod.sh $DESTDIR/linux64/lib/modules/$KBASEVER-slitaz
256 ln System.map System.map-modules
257 ln Module.symvers Module.symvers-modules
259 if [ ! -x /usr/bin/cook ]; then
260 report close-bloc
261 fi
262 }
264 # Rules to gen a SliTaz package suitable for Tazpkg.
265 genpkg_rules()
266 {
267 case "$ARCH" in
268 arm)
269 echo "Packing: ARM Kernel"
270 cp -a $install/* $fs
271 rm -f $fs/lib/modules/*/build $fs/lib/modules/*/source
272 return 0 ;;
273 x86_64)
274 echo "TODO: use default or custom x86_64 packing"
275 return 0 ;;
276 esac
278 export PACKAGE VERSION
279 local path
280 cp -a $install/boot $fs
281 # Compress all modules.
282 path=$fs/lib/modules/$KBASEVER-slitaz/kernel
283 mkdir -p $path
284 cp -a $install/lib/modules/$KBASEVER-slitaz/mo* \
285 $fs/lib/modules/$KBASEVER-slitaz
286 [ "$KBASEVER" != "$VERSION" ] &&
287 ln -s $KBASEVER-slitaz $fs/lib/modules/$VERSION-slitaz
288 # Get the base modules
289 export src
290 export _pkg
291 mkdir -p $WOK/$PACKAGE/source/tmp
292 # Warning stuff/list_modules.sh must find the generated modules.list
293 $stuff/list_modules.sh \
294 $(cat $stuff/modules.list) > $WOK/$PACKAGE/source/tmp/modules.list
295 while read module; do
296 dir=$(dirname $module)
297 [ -d $path/$dir ] || mkdir -p $path/$dir
298 cp -a $install/lib/modules/$KBASEVER-slitaz/kernel/$module $path/$dir
299 done < $WOK/$PACKAGE/source/tmp/modules.list
300 # Remove unresolved links
301 rm -f $fs/lib/modules/$KBASEVER-slitaz/build
302 rm -f $fs/lib/modules/$KBASEVER-slitaz/source
303 # Cook all packages with a kernel module
304 for i in $(cd $WOK; grep -l 'cook linux$' */receipt)
305 do
306 echo cook ${i%/receipt}
307 done
308 # Fixed modules.dep to use right path
309 # saves 100kb of space too
310 sed -i "s|$_pkg||g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep
311 sed -i "s|99.98.$KBASEVER-slitaz|$KBASEVER-slitaz|g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep
312 # Check and echo any module in kernel .config that's not added to
313 # one of linux-* pkgs
314 $stuff/check_modules.sh
315 }
317 # Pre and post install commands for Tazpkg.
318 post_install()
319 {
320 echo "Processing post-install commands..."
321 case "$ARCH" in
322 arm)
323 echo "Kernel : /boot/linux-$VERSION-slitaz-$ARCH"
324 echo "Modules: /lib/modules/$VERSION-slitaz"
325 return 0 ;;
326 esac
327 chroot "$1/" depmod -a $KBASEVER-slitaz
328 # GRUB stuff.
329 if [ -f "$1/boot/grub/menu.lst" ]; then
330 root_dev="/dev/`lsblk | grep '/$'| grep -o '[a-z]d[a-z][0-9]*'`" # current root device
331 grub_part="$(( `echo $root_dev | grep -o '[0-9]*$'`-1 ))"
332 grub_dev="`grep $(echo $root_dev | grep -o '^/dev/.d.' ) $1/boot/grub/device.map |\
333 cut -f1 | sed "s/)$/.$grub_part)/g"`" # use device.map to find grub device number
335 # Add and clean kernel entrys in case of upgrade for installed system.
336 if ! grep -q vmlinuz-$VERSION-slitaz $1/boot/grub/menu.lst; then
338 #clean the old entry
339 # TODO somewhere, the old vmlinuz file is removed.
340 # but the entry is still there. this cause a grub error:15 when selected
341 # see http://bugs.slitaz.org/?id=74
343 #add the new
344 cat >> $1/boot/grub/menu.lst << EOT
346 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
347 $grub_dev
348 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev quiet
349 EOT
350 # Make it the default entry
351 last_entry=$(( $(grep -c '^title' $1/boot/grub/menu.lst)-1 ))
352 sed -e "s/^default.*/default $last_entry/g" -i $1/boot/grub/menu.lst
353 fi
354 # Display information message.
355 cat <<EOT
356 ----
357 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
359 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
360 $grub_dev
361 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
362 ----
363 EOT
364 fi
365 }