wok annotate linux-libre-source/stuff/buildtaz @ rev 11736

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