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