wok-stable view linux-libre/receipt @ rev 10630
linux-libre: should build now
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu May 26 22:55:44 2011 +0200 (2011-05-26) |
parents | d1768332cee0 |
children | 7d021a3625d2 |
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 DEPENDS="depmod"
8 BUILD_DEPENDS="slitaz-toolchain perl git lzma patch"
9 MAINTAINER="gokhlayeh@slitaz.org"
10 PROVIDE="linux"
11 SOURCE="linux"
12 TARBALL="$SOURCE-$VERSION.tar.bz2"
13 WEB_SITE="http://www.fsfla.org/svnwiki/selibre/linux-libre/"
14 WGET_URL="http://www.fsfla.org/svnwiki/selibre/linux-libre/download/releases/$VERSION/$TARBALL"
15 CONFIG_FILES="/lib/modules/$VERSION-slitaz/modules.dep"
17 # Rules to configure and make the package.
18 compile_rules()
19 {
21 # this is code to help update the kernel version faster
22 #for i in $(grep -l 'WANTED="linux"' $WOK/*/receipt)
23 #do
24 # sed -i 's|VERSION="OLDVERSION"|VERSION="NEWVERSION"|g' $i
25 #done
26 [ -x /usr/bin/tazwok ] && report open-bloc
28 _AUFSVER=`grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
29 AUFSDIR=$WOK/$PACKAGE/aufs-${_AUFSVER}
30 if [ -x /usr/bin/tazwok ]; then
31 tazwok get-src aufs --target=$AUFSDIR || { report close-bloc; return 1; }
32 fi
33 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
34 cp -a $AUFSDIR/*.patch $WOK/$PACKA$stuff
35 cd $src
36 # SliTaz db
37 [ -d $WOK/$PACKAGE/slitaz ] && rm -rf $WOK/$PACKAGE/slitaz 2> /dev/null
38 mkdir $WOK/$PACKAGE/slitaz
39 echo "$WGET_URL" > $WOK/$PACKAGE/slitaz/url
40 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/slitaz
41 cp $stuff/bootloader.sh $WOK/$PACKAGE/slitaz
42 # Apply patches
43 echo "Applying patches"
44 while read patch_file; do
45 echo "$patch_file" >> $WOK/$PACKAGE/slitaz/patches
46 cp $stuff/$patch_file $WOK/$PACKAGE/slitaz
47 if [ -f done.$patch_file ]; then
48 echo "Skipping $patch_file"
49 continue
50 fi
51 echo "Apply $patch_file"
52 patch -p1 < $WOK/$PACKAGE/slitaz/$patch_file || { report close-bloc; return 1; }
53 touch done.$patch_file
54 done <<EOT
55 $PACKAGE-diff-$VERSION.u
56 $PACKAGE-unlzma-$VERSION.u
57 $PACKAGE-header-$VERSION.u
58 $PACKAGE-freeinitrd-$VERSION.u
59 aufs2-base.patch
60 aufs2-standalone.patch
61 001-squashfs-decompressors-add-xz-decompressor-module.patch
62 002-squashfs-decompressors-add-boot-time-xz-support.patch
63 003-squashfs-x86-support-xz-compressed-kernel.patch
64 004-squashfs-add-xz-compression-support.patch
65 005-squashfs-add-xz-compression-configuration-option.patch
66 EOT
67 echo "Make kernel proper and then build lguest"
68 make mrproper
69 cd Documentation/lguest
70 make lguest || { report close-bloc; return 1; }
71 cd $src
73 echo "Make bzImage without modules first"
74 # Build bzImage without modules first
75 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
76 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
77 # We can't keep every driver in staging
78 sed -i -e 's/^CONFIG_RTL8192/#&/' \
79 -e 's/^CONFIG_R8187SE/#&/' \
80 -e 's/^CONFIG_RT2870/#&/' .config
81 yes '' | make oldconfig
82 make -j 4 bzImage || { report close-bloc; return 1; }
83 [ -d $PWD/_pkg ] || mkdir -p $PWD/_pkg
84 mv arch/x86/boot/bzImage $PWD/_pkg
85 mv System.map System.map-without-modules
87 echo "Now build bzImage with modules"
88 # Build bzImage with modules
89 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
90 make oldconfig
91 ln .config $WOK/$PACKAGE/slitaz/config
92 make -j 4 bzImage &&
93 make -j 4 modules &&
94 make INSTALL_MOD_PATH=$PWD/_pkg modules_install &&
95 make INSTALL_HDR_PATH=$PWD/_pkg/usr headers_install &&
96 #[ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; }
97 mkdir -p $PWD/_pkg/boot 2> /dev/null
98 mv arch/x86/boot/bzImage $PWD/_pkg/boot/vmlinuz-$VERSION-slitaz
99 # Compress all modules.
100 echo "Compressing all modules"
101 $stuff/gztazmod.sh $PWD/_pkg/lib/modules/$VERSION-slitaz
102 ln System.map System.map-modules
103 ln Module.symvers Module.symvers-modules
104 [ -x /usr/bin/tazwok ] && report close-bloc
105 }
107 # Rules to gen a SliTaz package suitable for Tazpkg.
108 genpkg_rules()
109 {
110 local path
111 cp -a $_pkg/boot $fs
112 # Compress all modules.
113 $stuff/gztazmod.sh $_pkg/lib/modules/$VERSION-slitaz
114 path=$fs/lib/modules/$VERSION-slitaz/kernel
115 mkdir -p $path
116 cp -a $_pkg/lib/modules/$VERSION-slitaz/mo* \
117 $fs/lib/modules/$VERSION-slitaz
118 # Get the base modules
119 export src
120 export _pkg
121 mkdir $WOK/$PACKAGE/tmp
122 $WOK/$PACKA$stuff/list_modules.sh \
123 $(cat stuff/modules-$VERSION.list) > $WOK/$PACKAGE/tmp/modules.list
124 while read module; do
125 dir=$(dirname $module)
126 [ -d $path/$dir ] || mkdir -p $path/$dir
127 cp -a $_pkg/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
128 done < $WOK/$PACKAGE/tmp/modules.list
129 # Remove unresolved links
130 rm -f $fs/lib/modules/$VERSION-slitaz/build
131 rm -f $fs/lib/modules/$VERSION-slitaz/source
133 # Check and echo any module in kernel .config that's not added to
134 # one of linux-* pkgs
135 $stuff/check_modules.sh
136 }
138 # Pre and post install commands for Tazpkg.
139 post_install()
140 {
141 echo "Processing post-install commands..."
142 chroot "$1/" depmod -a $VERSION-slitaz
143 # GRUB stuff.
144 if [ -f "$1/boot/grub/menu.lst" ]; then
145 root_dev=`cat $1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1`
146 grub_dev=`cat $1/boot/grub/menu.lst | grep "root (" | head -n 1`
147 # Add new kernel entry in case of upgrade for installed system.
148 if ! grep -q $PACKAGE-$VERSION-slitaz $1/boot/grub/menu.lst; then
149 cat >> $1/boot/grub/menu.lst << EOT
151 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
152 $grub_dev
153 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
154 EOT
155 fi
156 # Display information message.
157 cat <<EOT
158 ----
159 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
161 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
162 $grub_dev
163 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
164 ----
165 EOT
166 fi
167 }