wok-tiny view kernel-modular/receipt @ rev 1

Add kernel
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Feb 01 09:37:33 2011 +0100 (2011-02-01)
parents
children fd349cc6f295
line source
1 # SliTaz package receipt.
3 PACKAGE="kernel-modular"
4 SOURCE="linux"
5 VERSION="2.6.37"
6 CATEGORY="base-system"
7 SHORT_DESC="The Linux kernel and modules."
8 DEPENDS="depmod"
9 BUILD_DEPENDS="slitaz-toolchain perl git lzma"
10 [ -n "$TARGET" ] &&
11 BUILD_DEPENDS="$BUILD_DEPENDS uclibc-cross-compiler-$TARGET" ||
12 TARGET="i486"
13 MAINTAINER="devel@slitaz.org"
14 TARBALL="$SOURCE-$VERSION.tar.bz2"
15 WEB_SITE="http://www.kernel.org/"
16 WGET_URL="http://www.eu.kernel.org/pub/linux/kernel/v${VERSION:0:3}/$TARBALL"
17 CONFIG_FILES="/lib/modules/$VERSION-slitaz/modules.dep"
19 # Rules to configure and make the package.
20 compile_rules()
21 {
22 if [ ! -s $WOK/busybox/busybox*/rootfs.cpio ]; then
23 tazwok cook busybox
24 fi
25 cp $WOK/busybox/busybox*/rootfs.cpio $src
27 # this is code to help update the kernel version faster
28 #for i in $(grep -l 'WANTED="linux"' $WOK/*/receipt)
29 #do
30 # sed -i 's|VERSION="OLDVERSION"|VERSION="NEWVERSION"|g' $i
31 #done
32 local _AUFSVER=`grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
33 local AUFSDIR="aufs-${_AUFSVER}"
34 TARBALL=$SOURCES_REPOSITORY/$AUFSDIR.tar.lzma
35 if [ -f $TARBALL ]; then
36 unlzma -c $TARBALL | tar xf -
37 cd $AUFSDIR && git checkout origin/aufs2.1-37
38 cd $WOK/$PACKAGE
39 else
40 # Aufs2 from git repository
41 git clone git://aufs.git.sourceforge.net/gitroot/aufs/aufs2-standalone.git $AUFSDIR
42 tar cf - $AUFSDIR | lzma e $TARBALL -si
43 cd $AUFSDIR && git checkout origin/aufs2.1-37
44 cd $WOK/$PACKAGE
45 fi
46 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
47 cp -a $AUFSDIR/*.patch $WOK/$PACKAGE/stuff
48 # We need the real GNU patch
49 [ -L /usr/bin/patch ] && tazpkg get-install patch --forced
50 cd $src
51 # SliTaz db
52 [ -d slitaz ] && rm -rf slitaz 2> /dev/null
53 mkdir slitaz
54 echo "$WGET_URL" > slitaz/url
55 cp ../stuff/gztazmod.sh ../stuff/list_modules.sh slitaz
56 cp ../stuff/bootloader.sh slitaz
57 # Apply patches
58 while read patch_file; do
59 echo "$patch_file" >> slitaz/patches
60 cp ../stuff/$patch_file 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 < slitaz/$patch_file || exit 1
67 touch done.$patch_file
68 done <<EOT
69 $SOURCE-diff-$VERSION.u
70 $SOURCE-unlzma-$VERSION.u
71 $SOURCE-header-$VERSION.u
72 $SOURCE-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
81 make mrproper
82 cd Documentation/lguest
83 #### make lguest || return 1
84 cd ../..
86 # Build bzImage without modules first
87 for i in isa lguest ; do
88 cp -f ../stuff/$SOURCE-$VERSION-slitaz.config-$TARGET-$i .config
89 # We can't keep every driver in staging
90 sed -i -e 's/^CONFIG_RTL8192/#&/' \
91 -e 's/^CONFIG_R8187SE/#&/' \
92 -e 's/^CONFIG_RT2870/#&/' .config
93 yes '' | make oldconfig
94 make -j 4 bzImage || return 1
95 mv arch/x86/boot/bzImage kernel-$i
96 mv System.map System.map-$i
97 mv .config config-$i
98 done
100 # Build bzImage with modules
101 cp -f ../stuff/$SOURCE-$VERSION-slitaz.config-$TARGET-modular .config
102 make oldconfig
103 ln .config slitaz/config
104 make -j 4 bzImage &&
105 make -j 4 modules &&
106 make INSTALL_MOD_PATH=$PWD/_pkg modules_install &&
107 make INSTALL_HDR_PATH=$PWD/_pkg/usr headers_install &&
108 [ -s arch/x86/boot/bzImage ] || return 1
109 mkdir -p $PWD/_pkg/boot 2> /dev/null
110 cp arch/x86/boot/bzImage kernel-modular
111 cp System.map System.map-modular
112 cp .config config-modular
113 mv arch/x86/boot/bzImage $PWD/_pkg/boot/vmlinuz-$VERSION-slitaz
114 # Compress all modules.
115 $WOK/$PACKAGE/stuff/gztazmod.sh $PWD/_pkg/lib/modules/$VERSION-slitaz
116 ln System.map System.map-modules
117 ln Module.symvers Module.symvers-modules
118 }
120 # Rules to gen a SliTaz package suitable for Tazpkg.
121 genpkg_rules()
122 {
123 mkdir $fs/boot
124 cp -a $_pkg/../$PACKAGE $fs/boot/bzImage
125 cp -a $_pkg/../System.map-${PACKAGE#kernel-} $fs/boot/System.map
126 cp -a $_pkg/../config-${PACKAGE#kernel-} $fs/boot/config
127 # Compress all modules.
128 #./stuff/gztazmod.sh $_pkg/lib/modules/$VERSION-slitaz
129 }
131 # Pre and post install commands for Tazpkg.
132 post_install()
133 {
134 echo "Processing post-install commands..."
135 chroot "$1/" depmod -a $VERSION-slitaz
136 # GRUB stuff.
137 if [ -f "$1/boot/grub/menu.lst" ]; then
138 root_dev=`cat $1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1`
139 grub_dev=`cat $1/boot/grub/menu.lst | grep "root (" | head -n 1`
140 # Add new kernel entry in case of upgrade for installed system.
141 if ! grep -q $SOURCE-$VERSION-slitaz $1/boot/grub/menu.lst; then
142 cat >> $1/boot/grub/menu.lst << EOT
144 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
145 $grub_dev
146 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
147 EOT
148 fi
149 # Display information message.
150 cat <<EOT
151 ----
152 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
154 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
155 $grub_dev
156 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
157 ----
158 EOT
159 fi
160 }
162 clean_wok()
163 {
164 #rm -rf aufs2
165 rm stuff/aufs2-base*
166 rm stuff/aufs2-standalone*
167 rm stuff/aufs2-kbuild*
168 rm -rf stuff/tmp
169 }