wok-6.x view linux/receipt @ rev 8561

imported patch get/linux
author Antoine Bodin <gokhlayeh@slitaz.org>
date Sun Feb 13 22:57:56 2011 +0100 (2011-02-13)
parents 489898e9f029
children 0b4cf0d9e1b5
line source
1 # SliTaz package receipt.
3 PACKAGE="linux"
4 VERSION="2.6.37"
5 CATEGORY="base-system"
6 SHORT_DESC="The Linux kernel and modules."
7 DEPENDS="depmod"
8 BUILD_DEPENDS="slitaz-toolchain perl git lzma"
9 MAINTAINER="devel@slitaz.org"
10 TARBALL="$PACKAGE-$VERSION.tar.bz2"
11 WEB_SITE="http://www.kernel.org/"
12 WGET_URL="http://www.eu.kernel.org/pub/linux/kernel/v${VERSION:0:3}/$TARBALL"
13 CONFIG_FILES="/lib/modules/$VERSION-slitaz/modules.dep"
15 # Rules to configure and make the package.
16 compile_rules()
17 {
19 # this is code to help update the kernel version faster
20 #for i in $(grep -l 'WANTED="linux"' $WOK/*/receipt)
21 #do
22 # sed -i 's|VERSION="OLDVERSION"|VERSION="NEWVERSION"|g' $i
23 #done
24 local _AUFSVER=`grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
25 local AUFSDIR="aufs-${_AUFSVER}"
26 tazwok get-src aufs --target=$AUFSDIR
27 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
28 cp -a $AUFSDIR/*.patch $WOK/$PACKAGE/stuff
29 # We need the real GNU patch
30 [ -L /usr/bin/patch ] && tazpkg get-install patch --forced
31 cd $src
32 # SliTaz db
33 [ -d slitaz ] && rm -rf slitaz 2> /dev/null
34 mkdir slitaz
35 echo "$WGET_URL" > slitaz/url
36 cp ../stuff/gztazmod.sh ../stuff/list_modules.sh slitaz
37 cp ../stuff/bootloader.sh slitaz
38 # Apply patches
39 while read patch_file; do
40 echo "$patch_file" >> slitaz/patches
41 cp ../stuff/$patch_file slitaz
42 if [ -f done.$patch_file ]; then
43 echo "Skipping $patch_file"
44 continue
45 fi
46 echo "Apply $patch_file"
47 patch -p1 < slitaz/$patch_file || exit 1
48 touch done.$patch_file
49 done <<EOT
50 $PACKAGE-diff-$VERSION.u
51 $PACKAGE-unlzma-$VERSION.u
52 $PACKAGE-header-$VERSION.u
53 $PACKAGE-freeinitrd-$VERSION.u
54 aufs2-base.patch
55 aufs2-standalone.patch
56 001-squashfs-decompressors-add-xz-decompressor-module.patch
57 002-squashfs-decompressors-add-boot-time-xz-support.patch
58 003-squashfs-x86-support-xz-compressed-kernel.patch
59 004-squashfs-add-xz-compression-support.patch
60 005-squashfs-add-xz-compression-configuration-option.patch
61 EOT
62 make mrproper
63 cd Documentation/lguest
64 make lguest || return 1
65 cd ../..
67 # Build bzImage without modules first
68 cp -f ../stuff/$PACKAGE-$VERSION-slitaz.config .config
69 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
70 # We can't keep every driver in staging
71 sed -i -e 's/^CONFIG_RTL8192/#&/' \
72 -e 's/^CONFIG_R8187SE/#&/' \
73 -e 's/^CONFIG_RT2870/#&/' .config
74 yes '' | make oldconfig
75 make -j 4 bzImage || return 1
76 [ -d $PWD/_pkg ] || mkdir -p $PWD/_pkg
77 mv arch/x86/boot/bzImage $PWD/_pkg
78 mv System.map System.map-without-modules
80 # Build bzImage with modules
81 cp -f ../stuff/$PACKAGE-$VERSION-slitaz.config .config
82 make oldconfig
83 ln .config slitaz/config
84 make -j 4 bzImage &&
85 make -j 4 modules &&
86 make INSTALL_MOD_PATH=$PWD/_pkg modules_install &&
87 make INSTALL_HDR_PATH=$PWD/_pkg/usr headers_install &&
88 [ -s arch/x86/boot/bzImage ] || return 1
89 mkdir -p $PWD/_pkg/boot 2> /dev/null
90 mv arch/x86/boot/bzImage $PWD/_pkg/boot/vmlinuz-$VERSION-slitaz
91 # Compress all modules.
92 $WOK/$PACKAGE/stuff/gztazmod.sh $PWD/_pkg/lib/modules/$VERSION-slitaz
93 ln System.map System.map-modules
94 ln Module.symvers Module.symvers-modules
95 }
97 # Rules to gen a SliTaz package suitable for Tazpkg.
98 genpkg_rules()
99 {
100 local path
101 cp -a $_pkg/boot $fs
102 # Compress all modules.
103 #./stuff/gztazmod.sh $_pkg/lib/modules/$VERSION-slitaz
104 path=$fs/lib/modules/$VERSION-slitaz/kernel
105 mkdir -p $path
106 cp -a $_pkg/lib/modules/$VERSION-slitaz/mo* \
107 $fs/lib/modules/$VERSION-slitaz
108 # Get the base modules
109 export src
110 export _pkg
111 $src/slitaz/list_modules.sh \
112 $(cat stuff/modules-$VERSION.list) > $src/modules.list
113 while read module; do
114 dir=$(dirname $module)
115 [ -d $path/$dir ] || mkdir -p $path/$dir
116 cp -a $_pkg/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
117 done < $src/modules.list
118 # Remove unresolved links
119 rm -f $fs/lib/modules/$VERSION-slitaz/build
120 rm -f $fs/lib/modules/$VERSION-slitaz/source
121 # Cook all packages with a kernel module
122 for i in $(cd $WOK; grep -l 'tazwok cook linux$' */receipt)
123 do
124 echo tazwok cook ${i%/receipt}
125 done
126 # Check and echo any module in kernel .config that's not added to
127 # one of linux-* pkgs
128 ./stuff/check_modules.sh
129 }
131 # Pre and post install commands for Tazpkg.
132 post_install()
133 {
134 echo "Processing post-install commands..."
135 chroot "$1/" depmod -a $VERSION-slitaz
136 # GRUB stuff.
137 if [ -f "$1/boot/grub/menu.lst" ]; then
138 root_dev=`cat $1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1`
139 grub_dev=`cat $1/boot/grub/menu.lst | grep "root (" | head -n 1`
140 # Add new kernel entry in case of upgrade for installed system.
141 if ! grep -q $PACKAGE-$VERSION-slitaz $1/boot/grub/menu.lst; then
142 cat >> $1/boot/grub/menu.lst << EOT
144 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
145 $grub_dev
146 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
147 EOT
148 fi
149 # Display information message.
150 cat <<EOT
151 ----
152 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
154 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
155 $grub_dev
156 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
157 ----
158 EOT
159 fi
160 }
162 clean_wok()
163 {
164 #rm -rf aufs2
165 rm stuff/aufs2-base*
166 rm stuff/aufs2-standalone*
167 rm stuff/aufs2-kbuild*
168 rm -rf stuff/tmp
169 }