wok annotate linux/receipt @ rev 11395
Compat: re-implement tazwok specific code into linux receipt.
author | Antoine Bodin <gokhlayeh@slitaz.org> |
---|---|
date | Sat Dec 10 06:08:28 2011 +0100 (2011-12-10) |
parents | 810ab87ba4bc |
children | 6f385eb6c82d |
rev | line source |
---|---|
pankso@3 | 1 # SliTaz package receipt. |
pankso@3 | 2 |
pankso@3 | 3 PACKAGE="linux" |
slaxemulator@9546 | 4 VERSION="2.6.37" |
pankso@3 | 5 CATEGORY="base-system" |
pankso@3 | 6 SHORT_DESC="The Linux kernel and modules." |
pankso@3864 | 7 MAINTAINER="devel@slitaz.org" |
slaxemulator@9546 | 8 TARBALL="$PACKAGE-$VERSION.tar.bz2" |
pankso@3 | 9 WEB_SITE="http://www.kernel.org/" |
pascal@2990 | 10 WGET_URL="http://www.eu.kernel.org/pub/linux/kernel/v${VERSION:0:3}/$TARBALL" |
pascal@1909 | 11 CONFIG_FILES="/lib/modules/$VERSION-slitaz/modules.dep" |
pankso@3 | 12 |
pankso@9731 | 13 DEPENDS="depmod" |
pankso@9731 | 14 BUILD_DEPENDS="slitaz-toolchain perl git lzma patch" |
pankso@9731 | 15 |
pankso@3 | 16 # Rules to configure and make the package. |
pankso@3 | 17 compile_rules() |
pankso@3 | 18 { |
pankso@9731 | 19 cd $src |
slaxemulator@7131 | 20 # this is code to help update the kernel version faster |
slaxemulator@7131 | 21 #for i in $(grep -l 'WANTED="linux"' $WOK/*/receipt) |
slaxemulator@7131 | 22 #do |
slaxemulator@7131 | 23 # sed -i 's|VERSION="OLDVERSION"|VERSION="NEWVERSION"|g' $i |
slaxemulator@7131 | 24 #done |
slaxemulator@8616 | 25 |
gokhlayeh@11395 | 26 [ ! -x /usr/bin/cook ] && report open-bloc |
pankso@9731 | 27 |
pankso@9731 | 28 # Check for Aufs and cook it if unbuilt. |
pankso@9731 | 29 echo "Checking for Aufs packages..." |
slaxemulator@8681 | 30 _AUFSVER=`grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g'` |
gokhlayeh@11395 | 31 if [ ! -d "$AUFSDIR" ] && [ -x /usr/bin/cook ]; then |
gokhlayeh@11395 | 32 # Give info an redirect to /dev/null since aufs got it own log. |
gokhlayeh@11395 | 33 AUFSDIR=$WOK/aufs/source/aufs-${_AUFSVER} |
gokhlayeh@11395 | 34 echo "Cook: aufs $_AUFSVER" |
gokhlayeh@11395 | 35 cook aufs > /dev/null |
gokhlayeh@11395 | 36 elif [ ! -x /usr/bin/cook ]; then |
gokhlayeh@11395 | 37 # We only need aufs source. Also cooking now is a bad idea since it |
gokhlayeh@11395 | 38 # needs linux-module-headers. |
gokhlayeh@11395 | 39 AUFSDIR=$WOK/aufs/aufs-${_AUFSVER} |
gokhlayeh@11395 | 40 [ -d "$AUFSDIR" ] && rm -rf $AUFSDIR |
gokhlayeh@11395 | 41 tazwok get-src aufs --target=$AUFSDIR || { report close-bloc; return 1; } |
pankso@9731 | 42 fi |
pankso@9731 | 43 |
pankso@9731 | 44 echo "Copying Aufs files and patches..." |
slaxemulator@7297 | 45 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src |
pankso@9732 | 46 cp -a $AUFSDIR/*.patch $stuff |
pankso@9731 | 47 |
pankso@4251 | 48 # SliTaz db |
pankso@9731 | 49 rm -rf $WOK/$PACKAGE/slitaz && mkdir $WOK/$PACKAGE/slitaz |
slaxemulator@9337 | 50 echo "$WGET_URL" > $WOK/$PACKAGE/slitaz/url |
slaxemulator@8681 | 51 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/slitaz |
slaxemulator@8681 | 52 cp $stuff/bootloader.sh $WOK/$PACKAGE/slitaz |
pankso@9731 | 53 |
pankso@5640 | 54 # Apply patches |
pankso@9731 | 55 echo "Applying patches..." |
pascal@521 | 56 while read patch_file; do |
slaxemulator@8681 | 57 echo "$patch_file" >> $WOK/$PACKAGE/slitaz/patches |
slaxemulator@8681 | 58 cp $stuff/$patch_file $WOK/$PACKAGE/slitaz |
pascal@1442 | 59 if [ -f done.$patch_file ]; then |
pascal@1442 | 60 echo "Skipping $patch_file" |
pascal@1442 | 61 continue |
pascal@1442 | 62 fi |
pascal@521 | 63 echo "Apply $patch_file" |
slaxemulator@8681 | 64 patch -p1 < $WOK/$PACKAGE/slitaz/$patch_file || { report close-bloc; return 1; } |
pascal@1442 | 65 touch done.$patch_file |
pascal@521 | 66 done <<EOT |
slaxemulator@9546 | 67 $PACKAGE-diff-$VERSION.u |
slaxemulator@9546 | 68 $PACKAGE-unlzma-$VERSION.u |
slaxemulator@9546 | 69 $PACKAGE-header-$VERSION.u |
slaxemulator@9546 | 70 $PACKAGE-freeinitrd-$VERSION.u |
jozee@4472 | 71 aufs2-base.patch |
slaxemulator@7131 | 72 aufs2-standalone.patch |
slaxemulator@7650 | 73 001-squashfs-decompressors-add-xz-decompressor-module.patch |
slaxemulator@7650 | 74 002-squashfs-decompressors-add-boot-time-xz-support.patch |
slaxemulator@7650 | 75 003-squashfs-x86-support-xz-compressed-kernel.patch |
slaxemulator@7650 | 76 004-squashfs-add-xz-compression-support.patch |
slaxemulator@7650 | 77 005-squashfs-add-xz-compression-configuration-option.patch |
pascal@521 | 78 EOT |
pankso@9731 | 79 |
gokhlayeh@11395 | 80 [ ! -x /usr/bin/cook ] && report step "Make kernel proper and then build lguest" |
pankso@9731 | 81 |
pankso@3864 | 82 make mrproper |
pascal@4507 | 83 cd Documentation/lguest |
gokhlayeh@11395 | 84 make $MAKEFLAGS lguest || { report close-bloc; return 1; } |
slaxemulator@8681 | 85 cd $src |
pascal@7667 | 86 |
gokhlayeh@11395 | 87 [ ! -x /usr/bin/cook ] && report step "Make bzImage without modules first" |
pankso@9731 | 88 |
pascal@7667 | 89 # Build bzImage without modules first |
slaxemulator@9546 | 90 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config |
pascal@7667 | 91 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config |
pankso@9731 | 92 |
pascal@7667 | 93 # We can't keep every driver in staging |
pascal@7667 | 94 sed -i -e 's/^CONFIG_RTL8192/#&/' \ |
pascal@7667 | 95 -e 's/^CONFIG_R8187SE/#&/' \ |
pascal@7667 | 96 -e 's/^CONFIG_RT2870/#&/' .config |
pascal@7667 | 97 yes '' | make oldconfig |
gokhlayeh@11395 | 98 make $MAKEFLAGS bzImage || { report close-bloc; return 1; } |
slaxemulator@7690 | 99 [ -d $PWD/_pkg ] || mkdir -p $PWD/_pkg |
pascal@7667 | 100 mv arch/x86/boot/bzImage $PWD/_pkg |
pascal@7667 | 101 mv System.map System.map-without-modules |
pascal@7667 | 102 |
gokhlayeh@11395 | 103 [ -x /usr/bin/cook ] && report step "Now build bzImage with modules" |
pankso@9731 | 104 |
pascal@7667 | 105 # Build bzImage with modules |
slaxemulator@9546 | 106 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config |
erjo@253 | 107 make oldconfig |
slaxemulator@8681 | 108 ln .config $WOK/$PACKAGE/slitaz/config |
gokhlayeh@11395 | 109 make $MAKEFLAGS bzImage && |
gokhlayeh@11395 | 110 make $MAKEFLAGS modules && |
pascal@3919 | 111 make INSTALL_MOD_PATH=$PWD/_pkg modules_install && |
pascal@3919 | 112 make INSTALL_HDR_PATH=$PWD/_pkg/usr headers_install && |
slaxemulator@8681 | 113 [ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; } |
pascal@7656 | 114 mkdir -p $PWD/_pkg/boot 2> /dev/null |
pascal@7656 | 115 mv arch/x86/boot/bzImage $PWD/_pkg/boot/vmlinuz-$VERSION-slitaz |
pankso@9731 | 116 |
gokhlayeh@11395 | 117 [ ! -x /usr/bin/cook ] && report step "Compressing all modules" |
pankso@9731 | 118 |
slaxemulator@6719 | 119 # Compress all modules. |
slaxemulator@8681 | 120 $stuff/gztazmod.sh $PWD/_pkg/lib/modules/$VERSION-slitaz |
pascal@7667 | 121 ln System.map System.map-modules |
pascal@7667 | 122 ln Module.symvers Module.symvers-modules |
pankso@9731 | 123 |
gokhlayeh@11395 | 124 if [ ! -x /usr/bin/cook ]; then |
gokhlayeh@11395 | 125 report close-bloc |
gokhlayeh@11395 | 126 fi |
pankso@3864 | 127 } |
erjo@253 | 128 |
pankso@3 | 129 # Rules to gen a SliTaz package suitable for Tazpkg. |
pankso@3 | 130 genpkg_rules() |
pankso@3 | 131 { |
pascal@521 | 132 local path |
pascal@7656 | 133 cp -a $_pkg/boot $fs |
pankso@3 | 134 # Compress all modules. |
slaxemulator@9701 | 135 #$stuff/gztazmod.sh $_pkg/lib/modules/$VERSION-slitaz |
pascal@521 | 136 path=$fs/lib/modules/$VERSION-slitaz/kernel |
pascal@521 | 137 mkdir -p $path |
pankso@5640 | 138 cp -a $_pkg/lib/modules/$VERSION-slitaz/mo* \ |
pankso@5640 | 139 $fs/lib/modules/$VERSION-slitaz |
pankso@5640 | 140 # Get the base modules |
pascal@886 | 141 export src |
pascal@886 | 142 export _pkg |
slaxemulator@8728 | 143 mkdir $WOK/$PACKAGE/tmp |
slaxemulator@9701 | 144 $stuff/list_modules.sh \ |
slaxemulator@9546 | 145 $(cat stuff/modules-$VERSION.list) > $WOK/$PACKAGE/tmp/modules.list |
pankso@3864 | 146 while read module; do |
pascal@521 | 147 dir=$(dirname $module) |
pankso@535 | 148 [ -d $path/$dir ] || mkdir -p $path/$dir |
pankso@535 | 149 cp -a $_pkg/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir |
slaxemulator@8728 | 150 done < $WOK/$PACKAGE/tmp/modules.list |
pascal@397 | 151 # Remove unresolved links |
pascal@397 | 152 rm -f $fs/lib/modules/$VERSION-slitaz/build |
pascal@397 | 153 rm -f $fs/lib/modules/$VERSION-slitaz/source |
pankso@5640 | 154 # Check and echo any module in kernel .config that's not added to |
pankso@5640 | 155 # one of linux-* pkgs |
pankso@9731 | 156 $stuff/check_modules.sh |
pankso@3 | 157 } |
pankso@3 | 158 |
pankso@3 | 159 # Pre and post install commands for Tazpkg. |
pankso@3 | 160 post_install() |
pankso@3 | 161 { |
pascal@521 | 162 echo "Processing post-install commands..." |
pascal@2926 | 163 chroot "$1/" depmod -a $VERSION-slitaz |
pankso@5640 | 164 # GRUB stuff. |
pankso@1154 | 165 if [ -f "$1/boot/grub/menu.lst" ]; then |
pankso@4056 | 166 root_dev=`cat $1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1` |
pankso@4056 | 167 grub_dev=`cat $1/boot/grub/menu.lst | grep "root (" | head -n 1` |
pankso@3864 | 168 # Add new kernel entry in case of upgrade for installed system. |
pankso@4056 | 169 if ! grep -q $PACKAGE-$VERSION-slitaz $1/boot/grub/menu.lst; then |
pankso@4056 | 170 cat >> $1/boot/grub/menu.lst << EOT |
pankso@4056 | 171 |
pankso@4056 | 172 title SliTaz GNU/Linux (Kernel $VERSION-slitaz) |
pankso@4056 | 173 $grub_dev |
pankso@4056 | 174 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev |
pankso@4056 | 175 EOT |
pankso@4056 | 176 fi |
pankso@4056 | 177 # Display information message. |
pankso@4056 | 178 cat <<EOT |
pankso@4056 | 179 ---- |
pankso@4056 | 180 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst: |
pankso@1154 | 181 |
pankso@1154 | 182 title SliTaz GNU/Linux (Kernel $VERSION-slitaz) |
pankso@1154 | 183 $grub_dev |
pankso@4056 | 184 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev |
pascal@886 | 185 ---- |
pascal@886 | 186 EOT |
pankso@1154 | 187 fi |
pankso@3 | 188 } |