wok view linux/receipt @ rev 12570

linux: add opt --no64
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Apr 28 20:00:42 2012 +0200 (2012-04-28)
parents 873a0ed5aab7
children 8106b97b965e
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 xz 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
39 mkdir -p $WOK/aufs/source/
40 tar xjf $SRC/aufs-${_AUFSVER}.tar.bz2 -C $WOK/aufs/source/
41 elif [ -x /usr/bin/tazwok ]; then
42 # we just need aufs source. Also cooking now is a bad idea since it
43 # needs linux-module-headers. The one your cooking not the one from the web.
44 AUFSDIR=$WOK/aufs/aufs-${_AUFSVER}
45 [ -d "$AUFSDIR" ] && rm -rf $AUFSDIR
46 tazwok get-src aufs --target=$AUFSDIR || { report close-bloc; return 1; }
47 fi
48 echo "cook:linux" > $command
50 echo "Copying Aufs files and patches..."
51 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
52 cp -a $AUFSDIR/aufs3-*.patch $stuff
54 # SliTaz db
55 [ -d $WOK/$PACKAGE/source/slitaz ] && rm -rf $WOK/$PACKAGE/source/slitaz 2> /dev/null
56 mkdir -p $WOK/$PACKAGE/source/slitaz
57 echo "$WGET_URL" > $WOK/$PACKAGE/source/slitaz/url
58 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/source/slitaz
59 cp $stuff/bootloader.sh $WOK/$PACKAGE/source/slitaz
61 # Apply patches
62 echo "Applying patches..."
63 while read patch_file; do
64 echo "$patch_file" >> $WOK/$PACKAGE/source/slitaz/patches
65 cp $stuff/$patch_file $WOK/$PACKAGE/source/slitaz
66 if [ -f done.$patch_file ]; then
67 echo "Skipping $patch_file"
68 continue
69 fi
70 echo "Apply $patch_file"
71 if [ -x /usr/bin/cook ]; then
72 patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || return 1
73 elif [ -x /usr/bin/tazwok ]; then
74 patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || { report close-bloc; return 1; }
75 fi
76 touch done.$patch_file
77 done <<EOT
78 $PACKAGE-diff.u
79 $PACKAGE-header.u
80 $PACKAGE-freeinitrd.u
81 aufs3-base.patch
82 aufs3-standalone.patch
83 aufs3-loopback.patch
84 aufs3-proc_map.patch
85 channel-negative-one-maxim.patch
86 mac80211.compat08082009.wl_frag+ack_v1.patch
87 EOT
89 if [ "$KBASEVER" != "$VERSION" ]; then
90 if [ -f $SOURCES_REPOSITORY/$(basename $PATCH) ]; then
91 xzcat $SOURCES_REPOSITORY/$(basename $PATCH) | patch -Np1
92 touch done.patch-$VERSION
93 else
94 wget $PATCH -O $SRC/$(basename $PATCH)
95 xzcat $SRC/$(basename $PATCH) | patch -Np1
96 touch done.patch-$VERSION
97 fi
98 fi
100 sed -i 's|SUBLEVEL =.*|SUBLEVEL =|g' Makefile
102 [ ! -x /usr/bin/cook ] && report step "Make kernel proper and then build lguest"
103 [ -x /usr/bin/cook ] && echo "Make kernel proper and then build lguest"
104 make mrproper
105 cd Documentation/virtual/lguest
106 if [ -x /usr/bin/cook ]; then
107 make lguest || return 1
108 elif [ -x /usr/bin/tazwok ]; then
109 make lguest || { report close-bloc; return 1; }
110 fi
111 cd $src
113 case "$opt" in
114 *--no64*);;
115 *)
116 #
117 # Arch x86_64
118 #
119 [ ! -x /usr/bin/cook ] && report step "Make bzImage64 without modules first"
120 [ -x /usr/bin/cook ] && echo "Building x86_64 Kernel"
122 # Build bzImage64 without modules first
123 cp -f $stuff/$PACKAGE-slitaz.config64 .config
124 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
126 # We can't keep every driver in staging
127 sed -i -e 's/^CONFIG_RTL8192/#&/' \
128 -e 's/^CONFIG_R8187SE/#&/' \
129 -e 's/^CONFIG_RT2870/#&/' .config
130 yes '' | make ARCH=x86_64 oldconfig
131 if [ -x /usr/bin/cook ]; then
132 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || exit 1
133 elif [ -x /usr/bin/tazwok ]; then
134 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || { report close-bloc; return 1; }
135 fi
136 [ -d $PWD/_pkg ] || mkdir -p $DESTDIR/linux64
137 mv arch/x86/boot/bzImage $DESTDIR/linux64
138 mv System.map System.map-without-modules64
140 [ ! -x /usr/bin/cook ] && report step "Now build bzImage64 with modules"
142 # Build bzImage64 with modules
143 cp -f $stuff/$PACKAGE-slitaz.config64 .config
144 #make ARCH=x86_64 oldconfig
145 ln .config $WOK/$PACKAGE/slitaz/config64
146 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage &&
147 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- modules &&
148 make ARCH=x86_64 INSTALL_MOD_PATH=$DESTDIR/linux64 modules_install &&
149 make ARCH=x86_64 INSTALL_HDR_PATH=$DESTDIR/linux64/usr headers_install &&
150 if [ -x /usr/bin/cook ]; then
151 [ -s arch/x86/boot/bzImage ] || return 1
152 elif [ -x /usr/bin/tazwok ]; then
153 [ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; }
154 fi
155 mkdir -p $DESTDIR/linux64/boot 2> /dev/null
156 mv arch/x86/boot/bzImage $DESTDIR/linux64/boot/vmlinuz-$VERSION-slitaz
157 ln System.map System.map-modules64
158 ln Module.symvers Module.symvers-modules64
159 esac
161 #
162 # Standard kernel
163 #
164 [ ! -x /usr/bin/cook ] && report step "Make bzImage without modules first"
165 [ -x /usr/bin/cook ] && echo "Building standard kernel..."
167 # Build bzImage without modules first
168 cp -f $stuff/$PACKAGE-slitaz.config .config
169 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
171 # We can't keep every driver in staging
172 sed -i -e 's/^CONFIG_RTL8192/#&/' \
173 -e 's/^CONFIG_R8187SE/#&/' \
174 -e 's/^CONFIG_RT2870/#&/' .config
175 yes '' | make oldconfig
176 if [ -x /usr/bin/cook ]; then
177 make -j 4 bzImage || exit 1
178 elif [ -x /usr/bin/tazwok ]; then
179 make -j 4 bzImage || { report close-bloc; return 1; }
180 fi
181 [ -d $DESTDIR ] || mkdir -p $DESTDIR
182 mv arch/x86/boot/bzImage $DESTDIR
183 mv System.map System.map-without-modules
185 [ ! -x /usr/bin/cook ] && report step "Now build bzImage with modules"
187 # Build bzImage with modules
188 cp -f $stuff/$PACKAGE-slitaz.config .config
189 #make oldconfig
190 ln .config $WOK/$PACKAGE/source/slitaz/config
191 make -j 4 bzImage &&
192 make -j 4 modules &&
193 make INSTALL_MOD_PATH=$DESTDIR modules_install &&
194 make INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
195 if [ -x /usr/bin/cook ]; then
196 [ -s arch/x86/boot/bzImage ] || return 1
197 elif [ -x /usr/bin/tazwok ]; then
198 [ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; }
199 fi
200 mkdir -p $DESTDIR/boot 2> /dev/null
201 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
203 [ ! -x /usr/bin/cook ] && report step "Compressing all modules"
205 # Compress all modules.
206 $stuff/gztazmod.sh $DESTDIR/lib/modules/$KBASEVER-slitaz
207 $stuff/gztazmod.sh $DESTDIR/linux64/lib/modules/$KBASEVER-slitaz
208 ln System.map System.map-modules
209 ln Module.symvers Module.symvers-modules
211 if [ ! -x /usr/bin/cook ]; then
212 report close-bloc
213 fi
214 }
216 # Rules to gen a SliTaz package suitable for Tazpkg.
217 genpkg_rules()
218 {
219 export PACKAGE VERSION
220 local path
221 cp -a $_pkg/boot $fs
222 # Compress all modules.
223 $stuff/gztazmod.sh $_pkg/lib/modules/$KBASEVER-slitaz
224 path=$fs/lib/modules/$KBASEVER-slitaz/kernel
225 mkdir -p $path
226 cp -a $_pkg/lib/modules/$KBASEVER-slitaz/mo* \
227 $fs/lib/modules/$KBASEVER-slitaz
228 # Get the base modules
229 export src
230 export _pkg
231 mkdir -p $WOK/$PACKAGE/source/tmp
232 $stuff/list_modules.sh \
233 $(cat $stuff/modules.list) > $WOK/$PACKAGE/source/tmp/modules.list
234 while read module; do
235 dir=$(dirname $module)
236 [ -d $path/$dir ] || mkdir -p $path/$dir
237 cp -a $_pkg/lib/modules/$KBASEVER-slitaz/kernel/$module $path/$dir
238 done < $WOK/$PACKAGE/source/tmp/modules.list
239 # Remove unresolved links
240 rm -f $fs/lib/modules/$KBASEVER-slitaz/build
241 rm -f $fs/lib/modules/$KBASEVER-slitaz/source
242 # Cook all packages with a kernel module
243 for i in $(cd $WOK; grep -l 'tazwok cook linux$' */receipt)
244 do
245 echo tazwok cook ${i%/receipt}
246 done
247 # Fixed modules.dep to use right path
248 # saves 100kb of space too
249 sed -i "s|$_pkg||g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep
250 sed -i "s|99.98.$KBASEVER-slitaz|$KBASEVER-slitaz|g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep
251 # Check and echo any module in kernel .config that's not added to
252 # one of linux-* pkgs
253 $stuff/check_modules.sh
254 }
256 # Pre and post install commands for Tazpkg.
257 post_install()
258 {
259 echo "Processing post-install commands..."
260 chroot "$1/" depmod -a $KBASEVER-slitaz
261 # GRUB stuff.
262 if [ -f "$1/boot/grub/menu.lst" ]; then
263 root_dev=`cat $1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1`
264 grub_dev=`cat $1/boot/grub/menu.lst | grep "root (" | head -n 1`
265 # Add new kernel entry in case of upgrade for installed system.
266 if ! grep -q vmlinuz-$VERSION-slitaz $1/boot/grub/menu.lst; then
267 cat >> $1/boot/grub/menu.lst << EOT
269 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
270 $grub_dev
271 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
272 EOT
273 fi
274 # Display information message.
275 cat <<EOT
276 ----
277 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
279 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
280 $grub_dev
281 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
282 ----
283 EOT
284 fi
285 }