wok-current annotate linux-source/stuff/buildtaz @ rev 5651
Up: task (1.9.1)
author | Paul Issott <paul@slitaz.org> |
---|---|
date | Sat May 29 19:32:53 2010 +0000 (2010-05-29) |
parents | 30b01dd8b4b3 |
children |
rev | line source |
---|---|
erjo@4645 | 1 #!/bin/sh |
erjo@4645 | 2 # |
erjo@4645 | 3 # buildtaz 1.0 |
erjo@4645 | 4 # This script generate a SliTaz package for linux kernel and modules. |
erjo@4645 | 5 # Inspired from builddeb script. |
erjo@4645 | 6 # |
erjo@4645 | 7 # (C) 2009 SliTaz - GNU General Public License v3. |
erjo@4645 | 8 # |
erjo@4645 | 9 # Author: Eric Joseph-Alexandre <erjo@slitaz.org> |
erjo@4645 | 10 |
erjo@4645 | 11 set -e |
erjo@4645 | 12 |
erjo@4645 | 13 LOCALVERSION=$(grep ^CONFIG_LOCALVERSION $objtree/.config | sed -e "s/CONFIG_LOCALVERSION=\"\(.*\)\"/\1/") |
erjo@4645 | 14 PACKAGE="linux${LOCALVERSION}" |
erjo@4645 | 15 VERSION=${KERNELVERSION} |
erjo@4645 | 16 V=$KERNELRELEASE |
erjo@4645 | 17 DIR="$objtree/taz/$PACKAGE-$VERSION" |
erjo@4645 | 18 fs="$DIR/fs" |
erjo@4645 | 19 |
erjo@4645 | 20 # Setup directories |
erjo@4645 | 21 rm -rf "$objtree/taz" |
erjo@4645 | 22 mkdir -p "$fs/lib" "$fs/boot" |
erjo@4645 | 23 |
erjo@4645 | 24 # Build and install kernel |
erjo@4645 | 25 cp System.map "$fs/boot/System.map-$KERNELRELEASE" |
erjo@4645 | 26 cp $KBUILD_IMAGE "$fs/boot/vmlinuz-$KERNELRELEASE" |
erjo@4645 | 27 |
erjo@4645 | 28 # Build and compress modules if needed |
erjo@4645 | 29 if grep -q '^CONFIG_MODULES=y' .config ; then |
erjo@4645 | 30 INSTALL_MOD_PATH="$fs" make KBUILD_SRC= modules_install |
erjo@4663 | 31 [ -f $objtree/slitaz/gztazmod.sh ] && $objtree/slitaz/gztazmod.sh $fs/lib/modules/${VERSION}${LOCALVERSION} |
erjo@4645 | 32 fi |
erjo@4645 | 33 |
erjo@4645 | 34 # Create Slitaz package |
erjo@4645 | 35 cat > $DIR/receipt <<EOT |
erjo@4645 | 36 # SliTaz package receipt. |
erjo@4645 | 37 |
erjo@4645 | 38 PACKAGE="${PACKAGE}" |
erjo@4645 | 39 VERSION="${VERSION}" |
erjo@4645 | 40 CATEGORY="base-system" |
erjo@4645 | 41 SHORT_DESC="Customized Linux Kernel" |
erjo@4645 | 42 WEB_SITE="http://www.kernel.org" |
erjo@4645 | 43 DEPENDS="depmod" |
erjo@4645 | 44 |
erjo@4645 | 45 post_install() |
erjo@4645 | 46 { |
erjo@4645 | 47 echo "Processing post-install commands..." |
erjo@4645 | 48 chroot "\$1/" depmod -a $V |
erjo@4645 | 49 if [ -f "\$1/boot/grub/menu.lst" ]; then |
erjo@4645 | 50 root_dev="`cat \$1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1`" |
erjo@4645 | 51 grub_dev="`cat \$1/boot/grub/menu.lst | grep "root (" | head -n 1`" |
erjo@4645 | 52 # Add new kernel entry in case of upgrade for installed system. |
erjo@4645 | 53 if ! grep -q \$PACKAGE-\$VERSION \$1/boot/grub/menu.lst; then |
erjo@4645 | 54 echo " |
erjo@4645 | 55 |
erjo@4645 | 56 title SliTaz GNU/Linux (Kernel $V) |
erjo@4645 | 57 "\$grub_dev" |
erjo@4645 | 58 kernel /boot/vmlinuz-$V root=\$root_dev" >> \$1/boot/grub/menu.lst |
erjo@4645 | 59 fi |
erjo@4645 | 60 |
erjo@4645 | 61 # Display information message. |
erjo@4645 | 62 echo " |
erjo@4645 | 63 ---- |
erjo@4645 | 64 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst: |
erjo@4645 | 65 |
erjo@4645 | 66 title SliTaz GNU/Linux (Kernel $V) |
erjo@4645 | 67 \$grub_dev |
erjo@4645 | 68 kernel /boot/vmlinuz-$V root=\$root_dev |
erjo@4645 | 69 ---- |
erjo@4645 | 70 " |
erjo@4645 | 71 fi |
erjo@4645 | 72 } |
erjo@4645 | 73 EOT |
erjo@4645 | 74 |
erjo@4645 | 75 # Pack |
erjo@4645 | 76 cd $objtree/taz |
erjo@4645 | 77 tazpkg pack $PACKAGE-$VERSION |
erjo@4645 | 78 mv *.tazpkg $objtree |
erjo@4645 | 79 cd - |
erjo@4645 | 80 exit 0 |