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