wok-4.x view linux/receipt @ rev 11797

ppp: build rp-pppoe.so
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Feb 25 10:42:24 2012 +0100 (2012-02-25)
parents 24a7f347ef17
children 41cee386ada1
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 MAINTAINER="devel@slitaz.org"
8 TARBALL="$PACKAGE-$VERSION.tar.bz2"
9 WEB_SITE="http://www.kernel.org/"
10 WGET_URL="http://www.kernel.org/pub/linux/kernel/v${VERSION:0:3}/$TARBALL"
11 CONFIG_FILES="/lib/modules/$VERSION-slitaz/modules.dep"
13 DEPENDS="depmod"
14 BUILD_DEPENDS="slitaz-toolchain perl git lzma patch"
16 # Rules to configure and make the package.
17 compile_rules()
18 {
19 cd $src
20 # this is code to help update the kernel version faster
21 #for i in $(grep -l 'WANTED="linux"' $WOK/*/receipt)
22 #do
23 # sed -i 's|VERSION="OLDVERSION"|VERSION="NEWVERSION"|g' $i
24 #done
26 [ ! -x /usr/bin/cook ] && report open-bloc
28 # Check for Aufs and cook it if unbuilt.
29 echo "Checking for Aufs packages..."
30 _AUFSVER=`grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
31 if [ ! -d "$AUFSDIR" ] && [ -x /usr/bin/cook ]; then
32 # Give info an redirect to /dev/null since aufs got it own log.
33 AUFSDIR=$WOK/aufs/source/aufs-${_AUFSVER}
34 echo "Cook: aufs $_AUFSVER"
35 cook aufs > /dev/null
36 elif [ ! -x /usr/bin/cook ]; then
37 # We only need aufs source. Also cooking now is a bad idea since it
38 # needs linux-module-headers.
39 AUFSDIR=$WOK/aufs/aufs-${_AUFSVER}
40 [ -d "$AUFSDIR" ] && rm -rf $AUFSDIR
41 tazwok get-src aufs --target=$AUFSDIR || { report close-bloc; return 1; }
42 fi
44 echo "Copying Aufs files and patches..."
45 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
46 cp -a $AUFSDIR/*.patch $stuff
48 # SliTaz db
49 rm -rf $WOK/$PACKAGE/slitaz && mkdir $WOK/$PACKAGE/slitaz
50 echo "$WGET_URL" > $WOK/$PACKAGE/slitaz/url
51 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/slitaz
52 cp $stuff/bootloader.sh $WOK/$PACKAGE/slitaz
54 # Apply patches
55 echo "Applying patches..."
56 while read patch_file; do
57 echo "$patch_file" >> $WOK/$PACKAGE/slitaz/patches
58 cp $stuff/$patch_file $WOK/$PACKAGE/slitaz
59 if [ -f done.$patch_file ]; then
60 echo "Skipping $patch_file"
61 continue
62 fi
63 echo "Apply $patch_file"
64 patch -p1 < $WOK/$PACKAGE/slitaz/$patch_file || { report close-bloc; return 1; }
65 touch done.$patch_file
66 done <<EOT
67 $PACKAGE-diff-$VERSION.u
68 $PACKAGE-header-$VERSION.u
69 $PACKAGE-freeinitrd-$VERSION.u
70 aufs2-base.patch
71 aufs2-standalone.patch
72 001-squashfs-decompressors-add-xz-decompressor-module.patch
73 002-squashfs-decompressors-add-boot-time-xz-support.patch
74 003-squashfs-x86-support-xz-compressed-kernel.patch
75 004-squashfs-add-xz-compression-support.patch
76 005-squashfs-add-xz-compression-configuration-option.patch
77 EOT
79 [ ! -x /usr/bin/cook ] && report step "Make kernel proper and then build lguest"
81 make mrproper
82 cd Documentation/lguest
83 make $MAKEFLAGS lguest || { report close-bloc; return 1; }
84 cd $src
86 [ ! -x /usr/bin/cook ] && report step "Make bzImage without modules first"
88 # Build bzImage without modules first
89 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
90 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
92 # We can't keep every driver in staging
93 sed -i -e 's/^CONFIG_RTL8192/#&/' \
94 -e 's/^CONFIG_R8187SE/#&/' \
95 -e 's/^CONFIG_RT2870/#&/' .config
96 yes '' | make oldconfig
97 make $MAKEFLAGS bzImage || { report close-bloc; return 1; }
98 [ -d $PWD/_pkg ] || mkdir -p $PWD/_pkg
99 mv arch/x86/boot/bzImage $PWD/_pkg
100 mv System.map System.map-without-modules
102 [ ! -x /usr/bin/cook ] && report step "Now build bzImage with modules"
104 # Build bzImage with modules
105 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
106 make oldconfig
107 ln .config $WOK/$PACKAGE/slitaz/config
108 make $MAKEFLAGS bzImage &&
109 make $MAKEFLAGS modules &&
110 make INSTALL_MOD_PATH=$PWD/_pkg modules_install &&
111 make INSTALL_HDR_PATH=$PWD/_pkg/usr headers_install &&
112 [ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; }
113 mkdir -p $PWD/_pkg/boot 2> /dev/null
114 mv arch/x86/boot/bzImage $PWD/_pkg/boot/vmlinuz-$VERSION-slitaz
116 [ ! -x /usr/bin/cook ] && report step "Compressing all modules"
118 # Compress all modules.
119 $stuff/gztazmod.sh $PWD/_pkg/lib/modules/$VERSION-slitaz
120 ln System.map System.map-modules
121 ln Module.symvers Module.symvers-modules
123 if [ ! -x /usr/bin/cook ]; then
124 report close-bloc
125 fi
126 }
128 # Rules to gen a SliTaz package suitable for Tazpkg.
129 genpkg_rules()
130 {
131 local path
132 cp -a $_pkg/boot $fs
133 # Compress all modules.
134 #$stuff/gztazmod.sh $_pkg/lib/modules/$VERSION-slitaz
135 path=$fs/lib/modules/$VERSION-slitaz/kernel
136 mkdir -p $path
137 cp -a $_pkg/lib/modules/$VERSION-slitaz/mo* \
138 $fs/lib/modules/$VERSION-slitaz
139 # Get the base modules
140 export src
141 export _pkg
142 mkdir $WOK/$PACKAGE/tmp
143 $stuff/list_modules.sh \
144 $(cat stuff/modules-$VERSION.list) > $WOK/$PACKAGE/tmp/modules.list
145 while read module; do
146 dir=$(dirname $module)
147 [ -d $path/$dir ] || mkdir -p $path/$dir
148 cp -a $_pkg/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
149 done < $WOK/$PACKAGE/tmp/modules.list
150 # Remove unresolved links
151 rm -f $fs/lib/modules/$VERSION-slitaz/build
152 rm -f $fs/lib/modules/$VERSION-slitaz/source
153 # Check and echo any module in kernel .config that's not added to
154 # one of linux-* pkgs
155 $stuff/check_modules.sh
156 }
158 # Pre and post install commands for Tazpkg.
159 post_install()
160 {
161 echo "Processing post-install commands..."
162 chroot "$1/" depmod -a $VERSION-slitaz
163 # GRUB stuff.
164 if [ -f "$1/boot/grub/menu.lst" ]; then
165 root_dev=`cat $1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1`
166 grub_dev=`cat $1/boot/grub/menu.lst | grep "root (" | head -n 1`
167 # Add new kernel entry in case of upgrade for installed system.
168 if ! grep -q $PACKAGE-$VERSION-slitaz $1/boot/grub/menu.lst; then
169 cat >> $1/boot/grub/menu.lst << EOT
171 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
172 $grub_dev
173 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
174 EOT
175 fi
176 # Display information message.
177 cat <<EOT
178 ----
179 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
181 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
182 $grub_dev
183 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
184 ----
185 EOT
186 fi
187 }