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