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

kernel: no more /proc/config.gz
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Feb 04 18:08:55 2011 +0100 (2011-02-04)
parents fd349cc6f295
children 250f6c3896df
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
26 cp $WOK/busybox/busybox*/.config $src/config-busybox
28 # this is code to help update the kernel version faster
29 #for i in $(grep -l 'WANTED="linux"' $WOK/*/receipt)
30 #do
31 # sed -i 's|VERSION="OLDVERSION"|VERSION="NEWVERSION"|g' $i
32 #done
33 local _AUFSVER=`grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
34 local AUFSDIR="aufs-${_AUFSVER}"
35 TARBALL=$SOURCES_REPOSITORY/$AUFSDIR.tar.lzma
36 if [ -f $TARBALL ]; then
37 unlzma -c $TARBALL | tar xf -
38 cd $AUFSDIR && git checkout origin/aufs2.1-37
39 cd $WOK/$PACKAGE
40 else
41 # Aufs2 from git repository
42 git clone git://aufs.git.sourceforge.net/gitroot/aufs/aufs2-standalone.git $AUFSDIR
43 tar cf - $AUFSDIR | lzma e $TARBALL -si
44 cd $AUFSDIR && git checkout origin/aufs2.1-37
45 cd $WOK/$PACKAGE
46 fi
47 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
48 cp -a $AUFSDIR/*.patch $WOK/$PACKAGE/stuff
49 # We need the real GNU patch
50 [ -L /usr/bin/patch ] && tazpkg get-install patch --forced
51 cd $src
52 # SliTaz db
53 [ -d slitaz ] && rm -rf slitaz 2> /dev/null
54 mkdir slitaz
55 echo "$WGET_URL" > slitaz/url
56 cp ../stuff/gztazmod.sh ../stuff/list_modules.sh slitaz
57 cp ../stuff/bootloader.sh slitaz
58 # Apply patches
59 while read patch_file; do
60 echo "$patch_file" >> slitaz/patches
61 cp ../stuff/$patch_file slitaz
62 if [ -f done.$patch_file ]; then
63 echo "Skipping $patch_file"
64 continue
65 fi
66 echo "Apply $patch_file"
67 patch -p1 < slitaz/$patch_file || exit 1
68 touch done.$patch_file
69 done <<EOT
70 $SOURCE-diff-$VERSION.u
71 $SOURCE-unlzma-$VERSION.u
72 $SOURCE-header-$VERSION.u
73 $SOURCE-freeinitrd-$VERSION.u
74 aufs2-base.patch
75 aufs2-standalone.patch
76 001-squashfs-decompressors-add-xz-decompressor-module.patch
77 002-squashfs-decompressors-add-boot-time-xz-support.patch
78 003-squashfs-x86-support-xz-compressed-kernel.patch
79 004-squashfs-add-xz-compression-support.patch
80 005-squashfs-add-xz-compression-configuration-option.patch
81 EOT
82 make mrproper
83 cd Documentation/lguest
84 make CC=uclibc-$TARGET-cc lguest || return 1
85 cd ../..
87 # Build bzImage without modules first
88 for i in isa lguest ; do
89 cp -f ../stuff/$SOURCE-$VERSION-slitaz.config-$TARGET-$i .config
90 # We can't keep every driver in staging
91 sed -i -e 's/^CONFIG_RTL8192/#&/' \
92 -e 's/^CONFIG_R8187SE/#&/' \
93 -e 's/^CONFIG_RT2870/#&/' .config
94 yes '' | make oldconfig
95 make -j 4 bzImage || return 1
96 mv arch/x86/boot/bzImage kernel-$i
97 mv System.map System.map-$i
98 mv .config config-$i
99 done
101 # Build bzImage with modules
102 cp -f ../stuff/$SOURCE-$VERSION-slitaz.config-$TARGET-modular .config
103 make oldconfig
104 ln .config slitaz/config
105 make -j 4 bzImage &&
106 make -j 4 modules &&
107 make INSTALL_MOD_PATH=$PWD/_pkg modules_install &&
108 make INSTALL_HDR_PATH=$PWD/_pkg/usr headers_install &&
109 [ -s arch/x86/boot/bzImage ] || return 1
110 mkdir -p $PWD/_pkg/boot 2> /dev/null
111 cp arch/x86/boot/bzImage kernel-modular
112 cp System.map System.map-modular
113 cp .config config-modular
114 mv arch/x86/boot/bzImage $PWD/_pkg/boot/vmlinuz-$VERSION-slitaz
115 # Compress all modules.
116 $WOK/$PACKAGE/stuff/gztazmod.sh $PWD/_pkg/lib/modules/$VERSION-slitaz
117 ln System.map System.map-modules
118 ln Module.symvers Module.symvers-modules
119 }
121 # Rules to gen a SliTaz package suitable for Tazpkg.
122 genpkg_rules()
123 {
124 mkdir $fs/boot
125 cp -a $_pkg/../$PACKAGE $fs/boot/bzImage
126 cp -a $_pkg/../System.map-${PACKAGE#kernel-} $fs/boot/System.map
127 cp -a $_pkg/../config-${PACKAGE#kernel-} $fs/boot/config
128 cp -a $_pkg/../config-busybox $fs/boot/config
129 # Compress all modules.
130 #./stuff/gztazmod.sh $_pkg/lib/modules/$VERSION-slitaz
131 }
133 # Pre and post install commands for Tazpkg.
134 post_install()
135 {
136 echo "Processing post-install commands..."
137 chroot "$1/" depmod -a $VERSION-slitaz
138 # GRUB stuff.
139 if [ -f "$1/boot/grub/menu.lst" ]; then
140 root_dev=`cat $1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1`
141 grub_dev=`cat $1/boot/grub/menu.lst | grep "root (" | head -n 1`
142 # Add new kernel entry in case of upgrade for installed system.
143 if ! grep -q $SOURCE-$VERSION-slitaz $1/boot/grub/menu.lst; then
144 cat >> $1/boot/grub/menu.lst << EOT
146 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
147 $grub_dev
148 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
149 EOT
150 fi
151 # Display information message.
152 cat <<EOT
153 ----
154 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
156 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
157 $grub_dev
158 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
159 ----
160 EOT
161 fi
162 }
164 clean_wok()
165 {
166 #rm -rf aufs2
167 rm stuff/aufs2-base*
168 rm stuff/aufs2-standalone*
169 rm stuff/aufs2-kbuild*
170 rm -rf stuff/tmp
171 }