wok diff linux-libre-source/stuff/buildtaz @ rev 19982

mosh: update deps
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Jun 22 11:40:28 2017 +0200 (2017-06-22)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/linux-libre-source/stuff/buildtaz	Thu Jun 22 11:40:28 2017 +0200
     1.3 @@ -0,0 +1,80 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# buildtaz 1.0
     1.7 +# This script generate a SliTaz package for linux kernel and modules.
     1.8 +# Inspired from builddeb script.
     1.9 +#
    1.10 +# (C) 2009 SliTaz - GNU General Public License v3.
    1.11 +#
    1.12 +# Author: Eric Joseph-Alexandre <erjo@slitaz.org>
    1.13 +
    1.14 +set -e
    1.15 +
    1.16 +LOCALVERSION=$(grep ^CONFIG_LOCALVERSION $objtree/.config | sed -e "s/CONFIG_LOCALVERSION=\"\(.*\)\"/\1/")
    1.17 +PACKAGE="linux${LOCALVERSION}"
    1.18 +VERSION=${KERNELVERSION}
    1.19 +V=$KERNELRELEASE
    1.20 +DIR="$objtree/taz/$PACKAGE-$VERSION"
    1.21 +fs="$DIR/fs"
    1.22 +
    1.23 +# Setup directories
    1.24 +rm -rf "$objtree/taz"
    1.25 +mkdir -p "$fs/lib" "$fs/boot"
    1.26 +
    1.27 +# Build and install kernel
    1.28 +cp System.map "$fs/boot/System.map-$KERNELRELEASE"
    1.29 +cp $KBUILD_IMAGE "$fs/boot/vmlinuz-$KERNELRELEASE"
    1.30 +
    1.31 +# Build and compress modules if needed
    1.32 +if grep -q '^CONFIG_MODULES=y' .config ; then
    1.33 +	INSTALL_MOD_PATH="$fs" make KBUILD_SRC= modules_install
    1.34 +	[ -f $objtree/slitaz/gztazmod.sh ] && $objtree/slitaz/gztazmod.sh $fs/lib/modules/${VERSION}${LOCALVERSION}
    1.35 +fi
    1.36 +
    1.37 +# Create Slitaz package
    1.38 +cat > $DIR/receipt <<EOT
    1.39 +# SliTaz package receipt.
    1.40 +
    1.41 +PACKAGE="${PACKAGE}"
    1.42 +VERSION="${VERSION}"
    1.43 +CATEGORY="base-system"
    1.44 +SHORT_DESC="Customized Linux Kernel"
    1.45 +WEB_SITE="http://www.kernel.org"
    1.46 +DEPENDS="depmod"
    1.47 +
    1.48 +post_install()
    1.49 +{
    1.50 +	    echo "Processing post-install commands..."
    1.51 +    chroot "\$1/" depmod -a $V
    1.52 +    if [ -f "\$1/boot/grub/menu.lst" ]; then
    1.53 +    	root_dev="`cat \$1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1`"
    1.54 +		grub_dev="`cat \$1/boot/grub/menu.lst | grep "root (" | head -n 1`"
    1.55 +		# Add new kernel entry in case of upgrade for installed system.
    1.56 +		if ! grep -q \$PACKAGE-\$VERSION \$1/boot/grub/menu.lst; then
    1.57 +    		echo "
    1.58 +    		
    1.59 +title SliTaz GNU/Linux (Kernel $V)
    1.60 +"\$grub_dev"
    1.61 +kernel /boot/vmlinuz-$V root=\$root_dev" >> \$1/boot/grub/menu.lst
    1.62 +		fi
    1.63 +	
    1.64 +		# Display information message.
    1.65 + echo "
    1.66 +----
    1.67 +GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
    1.68 +
    1.69 +title  SliTaz GNU/Linux (Kernel $V)
    1.70 +\$grub_dev
    1.71 +kernel /boot/vmlinuz-$V root=\$root_dev
    1.72 +----
    1.73 +"
    1.74 +	fi
    1.75 +}
    1.76 +EOT
    1.77 +
    1.78 +# Pack
    1.79 +cd $objtree/taz 
    1.80 +tazpkg pack $PACKAGE-$VERSION
    1.81 +mv *.tazpkg $objtree
    1.82 +cd -
    1.83 +exit 0