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