wok view linux/receipt @ rev 6402
Add slsnif
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Sep 25 12:00:06 2010 +0200 (2010-09-25) |
parents | 0c80e5eb512d |
children | fbe11f5b74e3 |
line source
1 # SliTaz package receipt.
3 PACKAGE="linux"
4 VERSION="2.6.34"
5 CATEGORY="base-system"
6 SHORT_DESC="The Linux kernel and modules."
7 DEPENDS="depmod"
8 BUILD_DEPENDS="slitaz-toolchain perl git"
9 MAINTAINER="devel@slitaz.org"
10 TARBALL="$PACKAGE-$VERSION.tar.bz2"
11 WEB_SITE="http://www.kernel.org/"
12 WGET_URL="http://www.eu.kernel.org/pub/linux/kernel/v${VERSION:0:3}/$TARBALL"
13 CONFIG_FILES="/lib/modules/$VERSION-slitaz/modules.dep"
15 # Rules to configure and make the package.
16 compile_rules()
17 {
18 # Aufs2 from git repository
19 if [ ! -d aufs2 ]; then
20 git clone http://git.c3sl.ufpr.br/pub/scm/aufs/aufs2-standalone.git aufs2
21 cd aufs2 && git checkout origin/aufs2-34
22 fi
23 cd aufs2
24 cp -a Documentation fs include $src
25 cp -a *.patch ../stuff
26 # We need the real GNU patch
27 [ -L /usr/bin/patch ] && tazpkg get-install patch --forced
28 cd $src
29 # SliTaz db
30 rm -rf slitaz 2> /dev/null
31 mkdir slitaz
32 echo "$WGET_URL" > slitaz/url
33 cp ../stuff/gztazmod.sh ../stuff/list_modules.sh slitaz
34 cp ../stuff/bootloader.sh slitaz
35 # Apply patches
36 while read patch_file; do
37 echo "$patch_file" >> slitaz/patches
38 cp ../stuff/$patch_file slitaz
39 if [ -f done.$patch_file ]; then
40 echo "Skipping $patch_file"
41 continue
42 fi
43 echo "Apply $patch_file"
44 patch -p1 < slitaz/$patch_file || exit 1
45 touch done.$patch_file
46 done <<EOT
47 $PACKAGE-diff-$VERSION.u
48 $PACKAGE-unlzma-$VERSION.u
49 $PACKAGE-header-$VERSION.u
50 aufs2-base.patch
51 aufs2-kbuild.patch
52 aufs2-standalone.patch
53 $PACKAGE-freeinitrd-$VERSION.u
54 $PACKAGE-squashfs-lzma-$VERSION.u
55 scsi.patch
56 EOT
57 make mrproper
58 cd Documentation/lguest
59 make lguest || return 1
60 cd ../..
61 cp ../stuff/$PACKAGE-$VERSION-slitaz.config .config
62 make oldconfig
63 ln .config slitaz/config
64 make -j 4 bzImage &&
65 make -j 4 modules &&
66 make INSTALL_MOD_PATH=$PWD/_pkg modules_install &&
67 make INSTALL_HDR_PATH=$PWD/_pkg/usr headers_install &&
68 [ -s arch/x86/boot/bzImage ]
69 }
71 # Rules to gen a SliTaz package suitable for Tazpkg.
72 genpkg_rules()
73 {
74 local path
75 mkdir $fs/boot
76 cp -a $src/arch/x86/boot/bzImage \
77 $fs/boot/vmlinuz-$VERSION-slitaz
78 # Compress all modules.
79 ./stuff/gztazmod.sh $_pkg/lib/modules/$VERSION-slitaz
80 path=$fs/lib/modules/$VERSION-slitaz/kernel
81 mkdir -p $path
82 cp -a $_pkg/lib/modules/$VERSION-slitaz/mo* \
83 $fs/lib/modules/$VERSION-slitaz
84 # Get the base modules
85 export src
86 export _pkg
87 $src/slitaz/list_modules.sh \
88 $(cat stuff/modules-$VERSION.list) > $src/modules.list
89 while read module; do
90 dir=$(dirname $module)
91 [ -d $path/$dir ] || mkdir -p $path/$dir
92 cp -a $_pkg/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
93 done < $src/modules.list
94 # Remove unresolved links
95 rm -f $fs/lib/modules/$VERSION-slitaz/build
96 rm -f $fs/lib/modules/$VERSION-slitaz/source
97 # Package all linux pkgs
98 for i in $(cd $WOK; ls -d linux-*)
99 do
100 tazwok genpkg $i
101 done
102 # Cook all packages with a kernel module
103 for i in $(cd $WOK; grep -l 'tazwok cook linux$' */receipt)
104 do
105 echo tazwok cook ${i%/receipt}
106 done
107 # Check and echo any module in kernel .config that's not added to
108 # one of linux-* pkgs
109 ./stuff/check_modules.sh
110 }
112 # Pre and post install commands for Tazpkg.
113 post_install()
114 {
115 echo "Processing post-install commands..."
116 chroot "$1/" depmod -a $VERSION-slitaz
117 # GRUB stuff.
118 if [ -f "$1/boot/grub/menu.lst" ]; then
119 root_dev=`cat $1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1`
120 grub_dev=`cat $1/boot/grub/menu.lst | grep "root (" | head -n 1`
121 # Add new kernel entry in case of upgrade for installed system.
122 if ! grep -q $PACKAGE-$VERSION-slitaz $1/boot/grub/menu.lst; then
123 cat >> $1/boot/grub/menu.lst << EOT
125 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
126 $grub_dev
127 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
128 EOT
129 fi
130 # Display information message.
131 cat <<EOT
132 ----
133 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
135 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
136 $grub_dev
137 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
138 ----
139 EOT
140 fi
141 }
143 clean_wok()
144 {
145 rm -rf aufs2
146 rm stuff/aufs2-*
147 rm -rf stuff/tmp
148 }