wok view linux-libre/receipt @ rev 11671
up: slitaz-tools (4.5)
author | Eric Joseph-Alexandre <erjo@slitaz.org> |
---|---|
date | Sat Feb 18 02:10:42 2012 +0100 (2012-02-18) |
parents | 903c03d31ebf |
children | 69aa5794f8f8 |
line source
1 # SliTaz package receipt.
3 PACKAGE="linux-libre"
4 VERSION="2.6.37-libre"
5 CATEGORY="base-system"
6 SHORT_DESC="The Linux Libre kernel and modules."
7 MAINTAINER="gokhlayeh@slitaz.org"
8 PROVIDE="linux"
9 SOURCE="linux"
10 TARBALL="$SOURCE-$VERSION.tar.bz2"
11 WEB_SITE="http://www.fsfla.org/svnwiki/selibre/linux-libre/"
12 WGET_URL="http://www.fsfla.org/svnwiki/selibre/linux-libre/download/releases/$VERSION/$TARBALL"
13 CONFIG_FILES="/lib/modules/$VERSION-slitaz/modules.dep"
15 DEPENDS="depmod"
16 BUILD_DEPENDS="slitaz-toolchain perl git lzma patch"
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 [ ! -d "$AUFSDIR" ] && [ -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 echo "Cook: aufs $_AUFSVER"
37 cook aufs > /dev/null
38 elif [ ! -x /usr/bin/cook ]; then
39 # We only need aufs source. Also cooking now is a bad idea since it
40 # needs linux-module-headers.
41 AUFSDIR=$WOK/aufs/aufs-${_AUFSVER}
42 [ -d "$AUFSDIR" ] && rm -rf $AUFSDIR
43 tazwok get-src aufs --target=$AUFSDIR || { report close-bloc; return 1; }
44 fi
46 echo "Copying Aufs files and patches..."
47 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
48 cp -a $AUFSDIR/*.patch $stuff
50 # SliTaz db
51 rm -rf $WOK/$PACKAGE/slitaz && mkdir $WOK/$PACKAGE/slitaz
52 echo "$WGET_URL" > $WOK/$PACKAGE/slitaz/url
53 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/slitaz
54 cp $stuff/bootloader.sh $WOK/$PACKAGE/slitaz
56 # Apply patches
57 echo "Applying patches..."
58 while read patch_file; do
59 echo "$patch_file" >> $WOK/$PACKAGE/slitaz/patches
60 cp $stuff/$patch_file $WOK/$PACKAGE/slitaz
61 if [ -f done.$patch_file ]; then
62 echo "Skipping $patch_file"
63 continue
64 fi
65 echo "Apply $patch_file"
66 patch -p1 < $WOK/$PACKAGE/slitaz/$patch_file || { report close-bloc; return 1; }
67 touch done.$patch_file
68 done <<EOT
69 $PACKAGE-diff-$VERSION.u
70 $PACKAGE-unlzma-$VERSION.u
71 $PACKAGE-header-$VERSION.u
72 $PACKAGE-freeinitrd-$VERSION.u
73 aufs2-base.patch
74 aufs2-standalone.patch
75 001-squashfs-decompressors-add-xz-decompressor-module.patch
76 002-squashfs-decompressors-add-boot-time-xz-support.patch
77 003-squashfs-x86-support-xz-compressed-kernel.patch
78 004-squashfs-add-xz-compression-support.patch
79 005-squashfs-add-xz-compression-configuration-option.patch
80 EOT
82 [ ! -x /usr/bin/cook ] && report step "Make kernel proper and then build lguest"
84 make mrproper
85 cd Documentation/lguest
86 make $MAKEFLAGS lguest || { report close-bloc; return 1; }
87 cd $src
89 [ ! -x /usr/bin/cook ] && report step "Make bzImage without modules first"
91 # Build bzImage without modules first
92 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
93 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
95 # We can't keep every driver in staging
96 sed -i -e 's/^CONFIG_RTL8192/#&/' \
97 -e 's/^CONFIG_R8187SE/#&/' \
98 -e 's/^CONFIG_RT2870/#&/' .config
99 yes '' | make oldconfig
100 make $MAKEFLAGS bzImage || { report close-bloc; return 1; }
101 [ -d $PWD/_pkg ] || mkdir -p $PWD/_pkg
102 mv arch/x86/boot/bzImage $PWD/_pkg
103 mv System.map System.map-without-modules
105 [ ! -x /usr/bin/cook ] && report step "Now build bzImage with modules"
107 # Build bzImage with modules
108 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
109 make oldconfig
110 ln .config $WOK/$PACKAGE/slitaz/config
111 make $MAKEFLAGS bzImage &&
112 make $MAKEFLAGS modules &&
113 make INSTALL_MOD_PATH=$PWD/_pkg modules_install &&
114 make INSTALL_HDR_PATH=$PWD/_pkg/usr headers_install &&
115 [ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; }
116 mkdir -p $PWD/_pkg/boot 2> /dev/null
117 mv arch/x86/boot/bzImage $PWD/_pkg/boot/vmlinuz-$VERSION-slitaz
119 [ ! -x /usr/bin/cook ] && report step "Compressing all modules"
121 # Compress all modules.
122 $stuff/gztazmod.sh $PWD/_pkg/lib/modules/$VERSION-slitaz
123 ln System.map System.map-modules
124 ln Module.symvers Module.symvers-modules
126 if [ ! -x /usr/bin/cook ]; then
127 report close-bloc
128 fi
129 }
131 # Rules to gen a SliTaz package suitable for Tazpkg.
132 genpkg_rules()
133 {
134 local path
135 cp -a $_pkg/boot $fs
136 # Compress all modules.
137 #$stuff/gztazmod.sh $_pkg/lib/modules/$VERSION-slitaz
138 path=$fs/lib/modules/$VERSION-slitaz/kernel
139 mkdir -p $path
140 cp -a $_pkg/lib/modules/$VERSION-slitaz/mo* \
141 $fs/lib/modules/$VERSION-slitaz
142 # Get the base modules
143 export src
144 export _pkg
145 mkdir $WOK/$PACKAGE/tmp
146 $stuff/list_modules.sh \
147 $(cat stuff/modules-$VERSION.list) > $WOK/$PACKAGE/tmp/modules.list
148 while read module; do
149 dir=$(dirname $module)
150 [ -d $path/$dir ] || mkdir -p $path/$dir
151 cp -a $_pkg/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
152 done < $WOK/$PACKAGE/tmp/modules.list
153 # Remove unresolved links
154 rm -f $fs/lib/modules/$VERSION-slitaz/build
155 rm -f $fs/lib/modules/$VERSION-slitaz/source
156 # Check and echo any module in kernel .config that's not added to
157 # one of linux-* pkgs
158 $stuff/check_modules.sh
159 }
161 # Pre and post install commands for Tazpkg.
162 post_install()
163 {
164 echo "Processing post-install commands..."
165 chroot "$1/" depmod -a $VERSION-slitaz
166 # GRUB stuff.
167 if [ -f "$1/boot/grub/menu.lst" ]; then
168 root_dev=`cat $1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1`
169 grub_dev=`cat $1/boot/grub/menu.lst | grep "root (" | head -n 1`
170 # Add new kernel entry in case of upgrade for installed system.
171 if ! grep -q $PACKAGE-$VERSION-slitaz $1/boot/grub/menu.lst; then
172 cat >> $1/boot/grub/menu.lst << EOT
174 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
175 $grub_dev
176 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
177 EOT
178 fi
179 # Display information message.
180 cat <<EOT
181 ----
182 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
184 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
185 $grub_dev
186 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
187 ----
188 EOT
189 fi
190 }