wok diff linux/receipt @ rev 12803

linux: dep on kmod for i486 and handle arm ARCH
author Christophe Lincoln <pankso@slitaz.org>
date Sat May 19 00:04:09 2012 +0200 (2012-05-19)
parents 8106b97b965e
children 4c9801543b7c
line diff
     1.1 --- a/linux/receipt	Sun Apr 29 12:35:19 2012 +0200
     1.2 +++ b/linux/receipt	Sat May 19 00:04:09 2012 +0200
     1.3 @@ -1,25 +1,60 @@
     1.4  # SliTaz package receipt.
     1.5  
     1.6  PACKAGE="linux"
     1.7 -VERSION="3.2.14"
     1.8 -KBASEVER="${VERSION:0:3}"
     1.9  CATEGORY="base-system"
    1.10  SHORT_DESC="The Linux kernel and modules."
    1.11  MAINTAINER="devel@slitaz.org"
    1.12 -TARBALL="$PACKAGE-$KBASEVER.tar.xz"
    1.13  WEB_SITE="http://www.kernel.org/"
    1.14  WGET_URL="http://www.kernel.org/pub/linux/kernel/v3.0/$TARBALL"
    1.15 +HOST_ARCH="i486 arm x86_64"
    1.16 +
    1.17 +# Aufs enable chroot
    1.18  AUFS_NOT_SUPPORTED="uclibc-cross-compiler-x86_64 is not compatible with aufs 8("
    1.19 -CONFIG_FILES="/lib/modules/$KBASEVER-slitaz/modules.dep"
    1.20  
    1.21 -DEPENDS="depmod"
    1.22 -BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch uclibc-cross-compiler-x86_64"
    1.23 -[ "$KBASEVER" != "$VERSION" ] && PATCH="http://www.kernel.org/pub/linux/kernel/v3.0/patch-$VERSION.xz"
    1.24 +# This will save/restore the modules.dep but we want to regenerate it
    1.25 +# on install/upgrade.
    1.26 +#CONFIG_FILES="/lib/modules/$KBASEVER-slitaz/modules.dep"
    1.27 +
    1.28 +case "$ARCH" in
    1.29 +	i?86)
    1.30 +		VERSION="3.2.14"
    1.31 +		KBASEVER="${VERSION:0:3}"
    1.32 +		TARBALL="$PACKAGE-$KBASEVER.tar.xz"
    1.33 +		DEPENDS="kmod"
    1.34 +		BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch uclibc-cross-compiler-x86_64"
    1.35 +		[ "$KBASEVER" != "$VERSION" ] && PATCH="http://www.kernel.org/pub/linux/kernel/v3.0/patch-$VERSION.xz" ;;
    1.36 +	arm)
    1.37 +		# Old school way :-) Until ARM was tested on real hardware and
    1.38 +		# we know wich modules/features we realy need for ARM machines.
    1.39 +		# No deps on kmod since we use Busybox modutils for ARM.
    1.40 +		VERSION="2.6.35.13"
    1.41 +		TARBALL="$PACKAGE-$VERSION.tar.bz2" ;;
    1.42 +esac
    1.43  
    1.44  # Rules to configure and make the package.
    1.45  compile_rules()
    1.46  {
    1.47  	cd $src
    1.48 +
    1.49 +	case "$ARCH" in
    1.50 +		arm)
    1.51 +			echo "Compiling: ARM Kernel"
    1.52 +			make mrproper &&
    1.53 +			cp -f $stuff/$ARCH/linux-slitaz.config .config &&
    1.54 +			make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- bzImage &&
    1.55 +			make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- modules &&
    1.56 +			make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- \
    1.57 +				INSTALL_MOD_PATH=$DESTDIR modules_install &&
    1.58 +			mkdir -p $DESTDIR/boot &&
    1.59 +			mv arch/arm/boot/compressed/vmlinux \
    1.60 +				$DESTDIR/boot/linux-$VERSION-slitaz-$ARCH
    1.61 +			return 0 ;;
    1.62 +		x86_64)
    1.63 +			echo "TODO: Maybe use default ? But cross compile in x86_64 chroot"
    1.64 +			echo "so we can remove the 64 build by uclibc-cross-compiler-x86_64"
    1.65 +			return 0 ;;
    1.66 +	esac
    1.67 +
    1.68  	# this is code to help update the kernel version faster
    1.69  	#for i in $(grep -l 'WANTED="linux"' $WOK/*/receipt)
    1.70  	#do
    1.71 @@ -58,7 +93,7 @@
    1.72  	echo "$WGET_URL" > $WOK/$PACKAGE/source/slitaz/url
    1.73  	cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/source/slitaz
    1.74  	cp $stuff/bootloader.sh $WOK/$PACKAGE/source/slitaz
    1.75 -	
    1.76 +
    1.77  	# Apply patches
    1.78  	echo "Applying patches..."
    1.79  	while read patch_file; do
    1.80 @@ -110,7 +145,7 @@
    1.81  		make lguest || { report close-bloc; return 1; }
    1.82  	fi
    1.83  	cd $src
    1.84 -	
    1.85 +
    1.86  	case "$opt" in
    1.87  	*--no64*);;
    1.88  	*)
    1.89 @@ -119,12 +154,12 @@
    1.90  	#
    1.91  	[ ! -x /usr/bin/cook ] && report step "Make bzImage64 without modules first"
    1.92  	[ -x /usr/bin/cook ] && echo "Building x86_64 Kernel"
    1.93 -	
    1.94 +
    1.95  	# Build bzImage64 without modules first
    1.96  	cp -f $stuff/$PACKAGE-slitaz.config64 .config
    1.97  	sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
    1.98 -	
    1.99 -	# We can't keep every driver in staging 
   1.100 +
   1.101 +	# We can't keep every driver in staging
   1.102  	sed -i -e 's/^CONFIG_RTL8192/#&/' \
   1.103  	       -e 's/^CONFIG_R8187SE/#&/' \
   1.104  	       -e 's/^CONFIG_RT2870/#&/' .config
   1.105 @@ -139,7 +174,7 @@
   1.106  	mv System.map System.map-without-modules64
   1.107  
   1.108  	[ ! -x /usr/bin/cook ] && report step "Now build bzImage64 with modules"
   1.109 -	
   1.110 +
   1.111  	# Build bzImage64 with modules
   1.112  	cp -f $stuff/$PACKAGE-slitaz.config64 .config
   1.113  	#make ARCH=x86_64 oldconfig
   1.114 @@ -158,18 +193,18 @@
   1.115  	ln System.map System.map-modules64
   1.116  	ln Module.symvers Module.symvers-modules64
   1.117  	esac
   1.118 -	
   1.119 +
   1.120  	#
   1.121  	# Standard kernel
   1.122  	#
   1.123  	[ ! -x /usr/bin/cook ] && report step "Make bzImage without modules first"
   1.124  	[ -x /usr/bin/cook ] && echo "Building standard kernel..."
   1.125 -	
   1.126 +
   1.127  	# Build bzImage without modules first
   1.128  	cp -f $stuff/$PACKAGE-slitaz.config .config
   1.129  	sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
   1.130 -	
   1.131 -	# We can't keep every driver in staging 
   1.132 +
   1.133 +	# We can't keep every driver in staging
   1.134  	sed -i -e 's/^CONFIG_RTL8192/#&/' \
   1.135  	       -e 's/^CONFIG_R8187SE/#&/' \
   1.136  	       -e 's/^CONFIG_RT2870/#&/' .config
   1.137 @@ -184,7 +219,7 @@
   1.138  	mv System.map System.map-without-modules
   1.139  
   1.140  	[ ! -x /usr/bin/cook ] && report step "Now build bzImage with modules"
   1.141 -	
   1.142 +
   1.143  	# Build bzImage with modules
   1.144  	cp -f $stuff/$PACKAGE-slitaz.config .config
   1.145  	#make oldconfig
   1.146 @@ -200,15 +235,15 @@
   1.147  	fi
   1.148  	mkdir -p $DESTDIR/boot 2> /dev/null
   1.149  	mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
   1.150 -	
   1.151 +
   1.152  	[ ! -x /usr/bin/cook ] && report step "Compressing all modules"
   1.153 -	
   1.154 +
   1.155  	# Compress all modules.
   1.156  	$stuff/gztazmod.sh $DESTDIR/lib/modules/$KBASEVER-slitaz
   1.157  	$stuff/gztazmod.sh $DESTDIR/linux64/lib/modules/$KBASEVER-slitaz
   1.158  	ln System.map System.map-modules
   1.159  	ln Module.symvers Module.symvers-modules
   1.160 -	
   1.161 +
   1.162  	if [ ! -x /usr/bin/cook ]; then
   1.163  		report close-bloc
   1.164  	fi
   1.165 @@ -217,6 +252,17 @@
   1.166  # Rules to gen a SliTaz package suitable for Tazpkg.
   1.167  genpkg_rules()
   1.168  {
   1.169 +	case "$ARCH" in
   1.170 +		arm)
   1.171 +			echo "Packing: ARM Kernel"
   1.172 +			cp -a $install/* $fs
   1.173 +			rm -f $fs/lib/modules/*/build $fs/lib/modules/*/source
   1.174 +			return 0 ;;
   1.175 +		x86_64)
   1.176 +			echo "TODO: use default or custom x86_64 packing"
   1.177 +			return 0 ;;
   1.178 +	esac
   1.179 +
   1.180      export PACKAGE VERSION
   1.181      local path
   1.182      cp -a $_pkg/boot $fs
   1.183 @@ -249,15 +295,21 @@
   1.184      # saves 100kb of space too
   1.185      sed -i "s|$_pkg||g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep
   1.186      sed -i "s|99.98.$KBASEVER-slitaz|$KBASEVER-slitaz|g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep
   1.187 -    # Check and echo any module in kernel .config that's not added to 
   1.188 +    # Check and echo any module in kernel .config that's not added to
   1.189      # one of linux-* pkgs
   1.190 -    $stuff/check_modules.sh 
   1.191 +    $stuff/check_modules.sh
   1.192  }
   1.193  
   1.194  # Pre and post install commands for Tazpkg.
   1.195  post_install()
   1.196  {
   1.197      echo "Processing post-install commands..."
   1.198 +    case "$ARCH" in
   1.199 +		arm)
   1.200 +			echo "Kernel : /boot/linux-$VERSION-slitaz-$ARCH"
   1.201 +			echo "Modules: /lib/modules/$VERSION-slitaz"
   1.202 +			return 0 ;;
   1.203 +	esac
   1.204      chroot "$1/" depmod -a $KBASEVER-slitaz
   1.205      # GRUB stuff.
   1.206      if [ -f "$1/boot/grub/menu.lst" ]; then