wok-6.x view linux-libre-source/stuff/buildtaz @ rev 10083

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