wok-undigest diff ovzkernel/receipt @ rev 482
xget: fix compile_rules
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Sep 24 22:43:37 2011 +0200 (2011-09-24) |
parents | |
children | 7771356bd054 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/ovzkernel/receipt Sat Sep 24 22:43:37 2011 +0200 1.3 @@ -0,0 +1,159 @@ 1.4 +# SliTaz package receipt. 1.5 + 1.6 +PACKAGE="ovzkernel" 1.7 +VERSION="2.6.32" 1.8 +CATEGORY="system" 1.9 +SHORT_DESC="Vanilla Linux Kernel for OpenVZ" 1.10 +MAINTAINER="erjo@slitaz.org" 1.11 +DEPENDS="depmod" 1.12 +BUILD_DEPENDS="slitaz-toolchain perl" 1.13 +SOURCE="linux" 1.14 +TARBALL="$SOURCE-$VERSION.tar.bz2" 1.15 +WEB_SITE="http://www.kernel.org/" 1.16 +WGET_URL="http://www.eu.kernel.org/pub/linux/kernel/v${VERSION:0:3}/$TARBALL" 1.17 +PROVIDE="linux" 1.18 +EXTRAVERSION="-i686" 1.19 + 1.20 +# Rules to configure and make the package. 1.21 +compile_rules() 1.22 +{ 1.23 + LOCALVERSION="-ovz" ; export LOCALVERSION 1.24 + 1.25 + cd $src 1.26 + 1.27 + [ -d OpenVZ ] && rm -rf openvz || mkdir OpenVZ 1.28 + 1.29 + zcat ../stuff/patch-dzhanibekov.1-combined.gz > OpenVZ/patch-dzhanibekov.1-combined.u 1.30 + cp ../stuff/*.ovz OpenVZ 1.31 + cp ../stuff/*.sh OpenVZ 1.32 + 1.33 + # Apply patches 1.34 + while read patch_file; do 1.35 + echo "$patch_file" >> OpenVZ/patches 1.36 + #~ cp ../stuff/$patch_file OpenVZ 1.37 + if [ -f done.$patch_file ]; then 1.38 + echo "Skipping $patch_file" 1.39 + continue 1.40 + fi 1.41 + echo "Apply $patch_file" 1.42 + patch -p1 < OpenVZ/$patch_file || exit 1 1.43 + touch done.$patch_file 1.44 + done <<EOT 1.45 +patch-dzhanibekov.1-combined.u 1.46 +EOT 1.47 + # Prepare to build 1.48 + make mrproper 1.49 + 1.50 + # Copy old kernel config 1.51 + cp OpenVZ/linux-2.6.32-i686.config.ovz .config 1.52 + 1.53 + # Add LOCALVERSION support 1.54 + sed -i s/CONFIG_LOCALVERSION_AUTO.*/CONFIG_LOCALVERSION_AUTO=y/ .config 1.55 + 1.56 + # Disable Source Versio Control detection 1.57 + [ -f scripts/setlocalversion ] && mv scripts/setlocalversion scripts/setlocalversion.disabled 1.58 + 1.59 + # Apply kernel config and build 1.60 + make oldconfig && \ 1.61 + make LOCALVERSION=${LOCALVERSION} prepare 1.62 + make bzImage && \ 1.63 + make modules 1.64 + 1.65 + # Install modules and headers 1.66 + make INSTALL_MOD_PATH=$PWD/_pkg modules_install 1.67 + make INSTALL_HDR_PATH=$PWD/_pkg/usr headers_install 1.68 + 1.69 + # Get kernel release 1.70 + KERNELRELEASE=$( cat include/config/kernel.release 2> /dev/null) ; export KERNELRELEASE 1.71 + 1.72 + [ -s arch/x86/boot/bzImage ] || return 1 1.73 + mkdir -p $PWD/_pkg/boot 2> /dev/null 1.74 + cp -a arch/x86/boot/bzImage $PWD/_pkg/boot/vmlinuz-${KERNELRELEASE} 1.75 + 1.76 + # Compress all modules. 1.77 + $WOK/$PACKAGE/stuff/gztazmod.sh $PWD/_pkg/lib/modules/${KERNELRELEASE} 1.78 + ln System.map System.map-modules 1.79 + ln Module.symvers Module.symvers-modules 1.80 +} 1.81 + 1.82 +# Rules to gen a SliTaz package suitable for Tazpkg. 1.83 +genpkg_rules() 1.84 +{ 1.85 + local path 1.86 + KERNELRELEASE=$( cat $src/include/config/kernel.release 2> /dev/null) 1.87 + path=$fs/lib/modules/${KERNELRELEASE}/kernel 1.88 + 1.89 + mkdir -p $fs/lib \ 1.90 + $fs/boot \ 1.91 + $fs/lib/modules/${KERNELRELEASE} \ 1.92 + $path \ 1.93 + $fs/etc/ovzkernel 1.94 + 1.95 + #cp -a $_pkg/lib/modules $fs/lib 1.96 + cp -a $_pkg/lib/firmware $fs/lib 1.97 + cp -a $_pkg/boot $fs/ 1.98 + 1.99 + #~ # Get the base modules 1.100 + export src 1.101 + export _pkg 1.102 + 1.103 + cp -a $src/include/config/kernel.release $fs/etc/ovzkernel 1.104 + cp -a $_pkg/lib/modules/${KERNELRELEASE}/mo* \ 1.105 + $fs/lib/modules/${KERNELRELEASE} 1.106 + 1.107 + $src/OpenVZ/list_modules.sh ${KERNELRELEASE} \ 1.108 + $(cat stuff/modules-$VERSION.list) > $src/modules.list 1.109 + while read module; do 1.110 + dir=$(dirname $module) 1.111 + [ -d $path/$dir ] || mkdir -p $path/$dir 1.112 + cp -a $_pkg/lib/modules/${KERNELRELEASE}/kernel/$module $path/$dir 1.113 + done < $src/modules.list 1.114 + 1.115 + # Remove unresolved links 1.116 + rm -f $fs/lib/modules/${KERNELRELEASE}/build 1.117 + rm -f $fs/lib/modules/${KERNELRELEASE}/source 1.118 + # Cook all packages with a kernel module 1.119 + #~ for i in $(cd $WOK ; ls -d ovzkernel-*; cd -) 1.120 + #~ do 1.121 + #~ tazwok cook ${i%/receipt} 1.122 + #~ done 1.123 +} 1.124 + 1.125 +# Pre and post install commands for Tazpkg. 1.126 +post_install() 1.127 +{ 1.128 + echo "Processing post-install commands..." 1.129 + KERNELRELEASE=$(cat $1/etc/ovzkernel/kernel.release) 1.130 + 1.131 + chroot "$1/" depmod -a ${KERNELRELEASE} 1.132 + 1.133 + # GRUB stuff. 1.134 + if [ -f "$1/boot/grub/menu.lst" ]; then 1.135 + root_dev=`cat $1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1` 1.136 + grub_dev=`cat $1/boot/grub/menu.lst | grep "root (" | head -n 1` 1.137 + # Add new kernel entry in case of upgrade for installed system. 1.138 + if ! grep -q ${KERNELRELEASE} $1/boot/grub/menu.lst; then 1.139 + cat >> $1/boot/grub/menu.lst << EOT 1.140 + 1.141 +title SliTaz GNU/Linux (Kernel ${KERNELRELEASE}) 1.142 +$grub_dev 1.143 +kernel /boot/vmlinuz-${KERNELRELEASE} root=$root_dev 1.144 +EOT 1.145 + fi 1.146 + # Display information message. 1.147 + cat <<EOT 1.148 +---- 1.149 +GRUB is installed, these tree lines must be in your /boot/grub/menu.lst: 1.150 + 1.151 +title SliTaz GNU/Linux (Kernel ${KERNELRELEASE}) 1.152 +$grub_dev 1.153 +kernel /boot/vmlinuz-${KERNELRELEASE} root=$root_dev 1.154 +---- 1.155 +EOT 1.156 + fi 1.157 +} 1.158 + 1.159 +clean_wok() 1.160 +{ 1.161 + [ -d ${SOURCE}-${VERSION} ] && rm -rf $SOURCE-$VERSION 1.162 +}