wok view linux/receipt @ rev 12285

Up: linux (3.2.14) Let play with the kernel :-)
author Christophe Lincoln <pankso@slitaz.org>
date Sun Apr 15 16:27:00 2012 +0200 (2012-04-15)
parents 41cee386ada1
children a8baf2428b53
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 CONFIG_FILES="/lib/modules/$KBASEVER-slitaz/modules.dep"
14 DEPENDS="depmod"
15 BUILD_DEPENDS="slitaz-toolchain perl git lzma patch uclibc-cross-compiler-x86_64"
16 [ "$KBASEVER" != "$VERSION" ] && PATCH="http://www.kernel.org/pub/linux/kernel/v3.0/patch-$VERSION.xz"
18 # Rules to configure and make the package.
19 compile_rules()
20 {
21 cd $src
22 # this is code to help update the kernel version faster
23 #for i in $(grep -l 'WANTED="linux"' $WOK/*/receipt)
24 #do
25 # sed -i 's|VERSION="OLDVERSION"|VERSION="NEWVERSION"|g' $i
26 #done
28 [ ! -x /usr/bin/cook ] && report open-bloc
30 # Check for Aufs and cook it if unbuilt.
31 echo "Checking for Aufs packages..."
32 _AUFSVER=`grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
33 if [ -x /usr/bin/cook ]; then
34 # Give info an redirect to /dev/null since aufs got it own log.
35 AUFSDIR=$WOK/aufs/source/aufs-${_AUFSVER}
36 [ -d "$AUFSDIR" ] && rm -rf $AUFSDIR
37 #echo "Cook: aufs $_AUFSVER"
38 cook aufs --getsrc --extract > /dev/null
39 elif [ -x /usr/bin/tazwok ]; then
40 # we just need aufs source. Also cooking now is a bad idea since it
41 # needs linux-module-headers. The one your cooking not the one from the web.
42 AUFSDIR=$WOK/aufs/aufs-${_AUFSVER}
43 [ -d "$AUFSDIR" ] && rm -rf $AUFSDIR
44 tazwok get-src aufs --target=$AUFSDIR || { report close-bloc; return 1; }
45 fi
46 echo "cook:linux" > $command
48 echo "Copying Aufs files and patches..."
49 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
50 cp -a $AUFSDIR/aufs3-*.patch $stuff
52 # SliTaz db
53 [ -d $WOK/$PACKAGE/source/slitaz ] && rm -rf $WOK/$PACKAGE/source/slitaz 2> /dev/null
54 mkdir -p $WOK/$PACKAGE/source/slitaz
55 echo "$WGET_URL" > $WOK/$PACKAGE/slitaz/url
56 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/source/slitaz
57 cp $stuff/bootloader.sh $WOK/$PACKAGE/source/slitaz
59 # Apply patches
60 echo "Applying patches..."
61 while read patch_file; do
62 echo "$patch_file" >> $WOK/$PACKAGE/source/slitaz/patches
63 cp $stuff/$patch_file $WOK/$PACKAGE/source/slitaz
64 if [ -f done.$patch_file ]; then
65 echo "Skipping $patch_file"
66 continue
67 fi
68 echo "Apply $patch_file"
69 if [ -x /usr/bin/cook ]; then
70 patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || return 1
71 elif [ -x /usr/bin/tazwok ]; then
72 patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || { report close-bloc; return 1; }
73 fi
74 touch done.$patch_file
75 done <<EOT
76 $PACKAGE-diff.u
77 $PACKAGE-header.u
78 $PACKAGE-freeinitrd.u
79 aufs3-base.patch
80 aufs3-standalone.patch
81 aufs3-loopback.patch
82 aufs3-proc_map.patch
83 channel-negative-one-maxim.patch
84 mac80211.compat08082009.wl_frag+ack_v1.patch
85 EOT
87 if [ "$KBASEVER" != "$VERSION" ]; then
88 if [ -f $SOURCES_REPOSITORY/$(basename $PATCH) ]; then
89 xzcat $SOURCES_REPOSITORY/$(basename $PATCH) | patch -Np1
90 touch done.patch-$VERSION
91 else
92 wget $PATCH -O $SRC/$(basename $PATCH)
93 xzcat $SRC/$(basename $PATCH) | patch -Np1
94 touch done.patch-$VERSION
95 fi
96 fi
98 sed -i 's|SUBLEVEL =.*|SUBLEVEL =|g' Makefile
100 [ ! -x /usr/bin/cook ] && report step "Make kernel proper and then build lguest"
102 make mrproper
103 cd Documentation/virtual/lguest
104 if [ -x /usr/bin/cook ]; then
105 make lguest || return 1
106 elif [ -x /usr/bin/tazwok ]; then
107 make lguest || { report close-bloc; return 1; }
108 fi
109 cd $src
111 [ ! -x /usr/bin/cook ] && report step "Make bzImage without modules first"
113 # Build bzImage without modules first
114 cp -f $stuff/$PACKAGE-slitaz.config .config
115 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
117 # We can't keep every driver in staging
118 sed -i -e 's/^CONFIG_RTL8192/#&/' \
119 -e 's/^CONFIG_R8187SE/#&/' \
120 -e 's/^CONFIG_RT2870/#&/' .config
121 yes '' | make oldconfig
122 if [ -x /usr/bin/cook ]; then
123 make -j 4 bzImage || exit 1
124 elif [ -x /usr/bin/tazwok ]; then
125 make -j 4 bzImage || { report close-bloc; return 1; }
126 fi
127 [ -d $DESTDIR ] || mkdir -p $DESTDIR
128 mv arch/x86/boot/bzImage $DESTDIR
129 mv System.map System.map-without-modules
131 [ ! -x /usr/bin/cook ] && report step "Now build bzImage with modules"
133 # Build bzImage with modules
134 cp -f $stuff/$PACKAGE-slitaz.config .config
135 #make oldconfig
136 ln .config $WOK/$PACKAGE/source/slitaz/config
137 make -j 4 bzImage &&
138 make -j 4 modules &&
139 make INSTALL_MOD_PATH=$DESTDIR modules_install &&
140 make INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
141 if [ -x /usr/bin/cook ]; then
142 [ -s arch/x86/boot/bzImage ] || return 1
143 elif [ -x /usr/bin/tazwok ]; then
144 [ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; }
145 fi
146 mkdir -p $DESTDIR/boot 2> /dev/null
147 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
149 [ ! -x /usr/bin/cook ] && report step "Make bzImage64 without modules first"
151 # Build bzImage64 without modules first
152 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config64 .config
153 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
155 # We can't keep every driver in staging
156 sed -i -e 's/^CONFIG_RTL8192/#&/' \
157 -e 's/^CONFIG_R8187SE/#&/' \
158 -e 's/^CONFIG_RT2870/#&/' .config
159 yes '' | make ARCH=x86_64 oldconfig
160 if [ -x /usr/bin/cook ]; then
161 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || exit 1
162 elif [ -x /usr/bin/tazwok ]; then
163 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || { report close-bloc; return 1; }
164 fi
165 [ -d $PWD/_pkg ] || mkdir -p $DESTDIR/linux64
166 mv arch/x86/boot/bzImage $DESTDIR/linux64
167 mv System.map System.map-without-modules64
169 [ ! -x /usr/bin/cook ] && report step "Now build bzImage64 with modules"
171 # Build bzImage64 with modules
172 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config64 .config
173 #make ARCH=x86_64 oldconfig
174 ln .config $WOK/$PACKAGE/slitaz/config64
175 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage &&
176 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- modules &&
177 make ARCH=x86_64 INSTALL_MOD_PATH=$DESTDIR/linux64 modules_install &&
178 make ARCH=x86_64 INSTALL_HDR_PATH=$DESTDIR/linux64/usr headers_install &&
179 if [ -x /usr/bin/cook ]; then
180 [ -s arch/x86/boot/bzImage ] || return 1
181 elif [ -x /usr/bin/tazwok ]; then
182 [ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; }
183 fi
184 mkdir -p $DESTDIR/linux64/boot 2> /dev/null
185 mv arch/x86/boot/bzImage $DESTDIR/linux64/boot/vmlinuz-$VERSION-slitaz
186 ln System.map System.map-modules64
187 ln Module.symvers Module.symvers-modules64
189 [ ! -x /usr/bin/cook ] && report step "Compressing all modules"
191 # Compress all modules.
192 $stuff/gztazmod.sh $DESTDIR/lib/modules/$KBASEVER-slitaz
193 $stuff/gztazmod.sh $DESTDIR/linux64/lib/modules/$KBASEVER-slitaz
194 ln System.map System.map-modules
195 ln Module.symvers Module.symvers-modules
197 if [ ! -x /usr/bin/cook ]; then
198 report close-bloc
199 fi
200 }
202 # Rules to gen a SliTaz package suitable for Tazpkg.
203 genpkg_rules()
204 {
205 local path
206 cp -a $_pkg/boot $fs
207 # Compress all modules.
208 #$stuff/gztazmod.sh $_pkg/lib/modules/$KBASEVER-slitaz
209 path=$fs/lib/modules/$KBASEVER-slitaz/kernel
210 mkdir -p $path
211 cp -a $_pkg/lib/modules/$KBASEVER-slitaz/mo* \
212 $fs/lib/modules/$KBASEVER-slitaz
213 # Get the base modules
214 export src
215 export _pkg
216 mkdir -p $WOK/$PACKAGE/source/tmp
217 $stuff/list_modules.sh \
218 $(cat $stuff/modules.list) > $WOK/$PACKAGE/source/tmp/modules.list
219 while read module; do
220 dir=$(dirname $module)
221 [ -d $path/$dir ] || mkdir -p $path/$dir
222 cp -a $_pkg/lib/modules/$KBASEVER-slitaz/kernel/$module $path/$dir
223 done < $WOK/$PACKAGE/source/tmp/modules.list
224 # Remove unresolved links
225 rm -f $fs/lib/modules/$KBASEVER-slitaz/build
226 rm -f $fs/lib/modules/$KBASEVER-slitaz/source
227 # Cook all packages with a kernel module
228 for i in $(cd $WOK; grep -l 'tazwok cook linux$' */receipt)
229 do
230 echo tazwok cook ${i%/receipt}
231 done
232 # Fixed modules.dep to use right path
233 # saves 100kb of space too
234 sed -i "s|$_pkg||g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep
235 sed -i "s|99.98.$KBASEVER-slitaz|$KBASEVER-slitaz|g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep
236 # Check and echo any module in kernel .config that's not added to
237 # one of linux-* pkgs
238 $stuff/check_modules.sh
239 }
241 # Pre and post install commands for Tazpkg.
242 post_install()
243 {
244 echo "Processing post-install commands..."
245 chroot "$1/" depmod -a $KBASEVER-slitaz
246 # GRUB stuff.
247 if [ -f "$1/boot/grub/menu.lst" ]; then
248 root_dev=`cat $1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1`
249 grub_dev=`cat $1/boot/grub/menu.lst | grep "root (" | head -n 1`
250 # Add new kernel entry in case of upgrade for installed system.
251 if ! grep -q $PACKAGE-$VERSION-slitaz $1/boot/grub/menu.lst; then
252 cat >> $1/boot/grub/menu.lst << EOT
254 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
255 $grub_dev
256 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
257 EOT
258 fi
259 # Display information message.
260 cat <<EOT
261 ----
262 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
264 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
265 $grub_dev
266 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
267 ----
268 EOT
269 fi
270 }