wok-6.x diff linux/receipt @ rev 15855

New kernel config and huge receipt clean up
author Christophe Lincoln <pankso@slitaz.org>
date Wed Jan 29 09:56:07 2014 +0100 (2014-01-29)
parents de8cd706512c
children 673b107f2fd7
line diff
     1.1 --- a/linux/receipt	Mon Jan 13 00:02:35 2014 +0100
     1.2 +++ b/linux/receipt	Wed Jan 29 09:56:07 2014 +0100
     1.3 @@ -2,40 +2,45 @@
     1.4  
     1.5  PACKAGE="linux"
     1.6  VERSION="3.2.53"
     1.7 -KBASEVER="${VERSION:0:3}"
     1.8  CATEGORY="base-system"
     1.9  SHORT_DESC="The Linux kernel and modules."
    1.10  MAINTAINER="devel@slitaz.org"
    1.11  LICENSE="GPL2"
    1.12 -TARBALL="$PACKAGE-$KBASEVER.tar.xz"
    1.13 +TARBALL="$PACKAGE-$VERSION.tar.xz"
    1.14  WEB_SITE="http://www.kernel.org/"
    1.15  WGET_URL="ftp://ftp.kernel.org/pub/linux/kernel/v3.0/$TARBALL"
    1.16  HOST_ARCH="i486 arm x86_64"
    1.17  
    1.18 -DEPENDS=""
    1.19 -BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch \
    1.20 +DEPENDS="kmod"
    1.21 +BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch kmod \
    1.22  uclibc-cross-compiler-x86_64 busybox-boot"
    1.23  
    1.24 -# Use version patch so we dont dl full kernel source on each minor update
    1.25 -[ "$KBASEVER" != "$VERSION" ] && 
    1.26 -PATCH="$(dirname $WGET_URL)/patch-$VERSION.xz" &&
    1.27 -EXTRA_SOURCE_FILES="$(basename $PATCH)"
    1.28 +#
    1.29 +# The Linux receipt handle cross compilation. For x86_64 we actually use
    1.30 +# the uclibc-cross-compiler-x86_64 and for ARM we use a real cross env.
    1.31 +# Please discuss any change and keep it simple, dont play with VERSION
    1.32 +# string or Kernel SUBLEVEL because depmod and Pankso dont like that!
    1.33 +#
    1.34 +# The receipt also handle some cook options for faster build: 
    1.35 +# --nox64    : Skip the x86_64 cross compilation
    1.36 +# --nonomods : Skip bzImage without modules build
    1.37 +#
    1.38  
    1.39  # Aufs enable chroot
    1.40  AUFS_NOT_RAMFS="uclibc-cross-compiler-x86_64 is not compatible with aufs+tmpfs 8("
    1.41  
    1.42 -# This will save/restore modules.dep but we want to regenerate it on
    1.43 -# install or upgrade.
    1.44 -#CONFIG_FILES="/lib/modules/$KBASEVER-slitaz/modules.dep"
    1.45 -
    1.46  # Handle multiarch compilation. Less bdeps when cross-compiling for ARM
    1.47  case "$ARCH" in
    1.48 -	arm) BUILD_DEPENDS="xz" TARBALL="$PACKAGE-$VERSION.tar.bz2" ;;
    1.49 +	arm) BUILD_DEPENDS="xz" ;;
    1.50  	x86_64) BUILD_DEPENDS="xz" ;;
    1.51  esac
    1.52  
    1.53 -# TODO: slitaz.conf provide SLITAZ_ARCH and must be handled by tazpkg/spk
    1.54 -[ -f "$root/etc/slitaz/slitaz.conf" ] && . $root/etc/slitaz/slitaz.conf
    1.55 +# Handle multiarch installation. ARM use Busybox modutils, so avoid any
    1.56 +# deps on kmod. SLITAZ_ARCH can have also custom post_install commands
    1.57 +. $root/etc/slitaz/slitaz.conf || exit 1
    1.58 +case "$SLITAZ_ARCH" in
    1.59 +	arm) DEPENDS="" ;;
    1.60 +esac
    1.61  
    1.62  # Rules to configure and make the package.
    1.63  compile_rules()
    1.64 @@ -43,28 +48,14 @@
    1.65  	cd $src
    1.66  	cp /usr/share/boot/initrd initrd.cpio
    1.67  
    1.68 -	if [ "$KBASEVER" != "$VERSION" ]; then
    1.69 -		[ -s $SRC/$(basename $PATCH) ] ||
    1.70 -		wget $PATCH -O $SRC/$(basename $PATCH)
    1.71 -		xzcat $SRC/$(basename $PATCH) | patch -Np1
    1.72 -		touch done.patch-$VERSION
    1.73 -	fi
    1.74 -
    1.75 +	# Handle cross compilation
    1.76  	case "$ARCH" in
    1.77  		arm)
    1.78 -			echo "Compiling: ARM Kernel"
    1.79 -			if [ ! -s $SRC/$(basename $PATCH) ]; then
    1.80 -				wget $PATCH -O $SRC/$(basename $PATCH)
    1.81 -			fi
    1.82 +			echo "Compiling: $ARCH Kernel"
    1.83  			make mrproper
    1.84 -			# Buggy: we got kernel panic about module not tinted 3.2.14
    1.85 -			#echo "Applying patch: $(basename $PATCH)"
    1.86 -			#xzcat $SRC/$(basename $PATCH) | patch -Np1 >/dev/null
    1.87  			patch -Np1 < $stuff/$ARCH/linux-arm.patch || exit 1
    1.88  			cp -f $stuff/$ARCH/linux-arm.config .config
    1.89 -			echo "Configure $ARCH kernel..."
    1.90  			yes '' | make ARCH=$ARCH oldconfig
    1.91 -			echo "Build $ARCH kernel..."
    1.92  			make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- bzImage &&
    1.93  			make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- modules &&
    1.94  			make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- \
    1.95 @@ -79,34 +70,25 @@
    1.96  			return 0 ;;
    1.97  	esac
    1.98  
    1.99 -	[ ! -x /usr/bin/cook ] && report open-bloc
   1.100 -
   1.101 -	# Check for Aufs and cook it if unbuilt.
   1.102 +	# Check for Aufs and get source/patches if needed
   1.103  	echo "Checking for Aufs packages..."
   1.104 -	_AUFSVER=`grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
   1.105 -	if [ -x /usr/bin/cook ]; then
   1.106 -		# Give info an redirect to /dev/null since aufs got it own log.
   1.107 -		AUFSDIR=$WOK/aufs/source/aufs-${_AUFSVER}
   1.108 -		[ -d "$AUFSDIR" ] && rm -rf $AUFSDIR
   1.109 -		#echo "Cook: aufs $_AUFSVER"
   1.110 -		cook aufs --getsrc
   1.111 +	AUFSVER=$(grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g')
   1.112 +	AUFSDIR="$WOK/aufs/source/aufs-${AUFSVER}"
   1.113 +	if [ ! -d "$AUFSDIR" ]; then
   1.114 +		[ ! -f "$SRC/aufs-${AUFSVER}.tar.bz2" ] && cook aufs --getsrc
   1.115  		mkdir -p $WOK/aufs/source/
   1.116 -		tar xjf $SRC/aufs-${_AUFSVER}.tar.bz2 -C $WOK/aufs/source/
   1.117 -	elif [ -x /usr/bin/tazwok ]; then
   1.118 -		# we just need aufs source. Also cooking now is a bad idea since it
   1.119 -		# needs linux-module-headers. The one your cooking not the one from the web.
   1.120 -		AUFSDIR=$WOK/aufs/aufs-${_AUFSVER}
   1.121 -		[ -d "$AUFSDIR" ] && rm -rf $AUFSDIR
   1.122 -		tazwok get-src aufs --target=$AUFSDIR || { report close-bloc; return 1; }
   1.123 +		echo "Extracting: aufs-${AUFSVER}.tar.bz2"
   1.124 +		tar xjf $SRC/aufs-${AUFSVER}.tar.bz2 -C $WOK/aufs/source/
   1.125  	fi
   1.126 +	
   1.127  	echo "cook:linux" > $command
   1.128  
   1.129  	echo "Copying Aufs files and patches..."
   1.130  	cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
   1.131  	cp -a $AUFSDIR/aufs3-*.patch $stuff
   1.132  
   1.133 -	# SliTaz db
   1.134 -	[ -d $WOK/$PACKAGE/source/slitaz ] && rm -rf $WOK/$PACKAGE/source/slitaz 2> /dev/null
   1.135 +	# SliTaz db stuff
   1.136 +	[ -d $WOK/$PACKAGE/source/slitaz ] && rm -rf $WOK/$PACKAGE/source/slitaz
   1.137  	mkdir -p $WOK/$PACKAGE/source/slitaz
   1.138  	echo "$WGET_URL" > $WOK/$PACKAGE/source/slitaz/url
   1.139  	cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/source/slitaz
   1.140 @@ -118,15 +100,10 @@
   1.141  		echo "$patch_file" >> $WOK/$PACKAGE/source/slitaz/patches
   1.142  		cp $stuff/$patch_file $WOK/$PACKAGE/source/slitaz
   1.143  		if [ -f done.$patch_file ]; then
   1.144 -			echo "Skipping $patch_file"
   1.145 -			continue
   1.146 +			echo "Skipping $patch_file" && continue
   1.147  		fi
   1.148  		echo "Apply $patch_file"
   1.149 -		if [ -x /usr/bin/cook ]; then
   1.150 -			patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || return 1
   1.151 -		elif [ -x /usr/bin/tazwok ]; then
   1.152 -			patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || { report close-bloc; return 1; }
   1.153 -		fi
   1.154 +		patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || return 1
   1.155  		touch done.$patch_file
   1.156  	done <<EOT
   1.157  $PACKAGE-diff.u
   1.158 @@ -141,129 +118,103 @@
   1.159  channel-negative-one-maxim.patch
   1.160  mac80211.compat08082009.wl_frag+ack_v1.patch
   1.161  EOT
   1.162 -
   1.163 -	sed -i 's|SUBLEVEL =.*|SUBLEVEL =|g' Makefile
   1.164 -
   1.165 -	[ ! -x /usr/bin/cook ] && report step "Make kernel proper and then build lguest"
   1.166 -	[ -x /usr/bin/cook ] && echo "Make kernel proper and then build lguest"
   1.167 +	
   1.168 +	# Mrproper and lguest
   1.169 +	echo "Make kernel proper and then build lguest..."
   1.170  	make mrproper
   1.171  	cd Documentation/virtual/lguest
   1.172 -	if [ -x /usr/bin/cook ]; then
   1.173 -		make lguest || return 1
   1.174 -	elif [ -x /usr/bin/tazwok ]; then
   1.175 -		make lguest || { report close-bloc; return 1; }
   1.176 +	make lguest || return 1
   1.177 +	cd $src
   1.178 +	
   1.179 +	#
   1.180 +	# Arch x86_64: TODO have a real cross environment
   1.181 +	#
   1.182 +	if [ ! "nox64" ]; then
   1.183 +		echo "Compiling: x86_64 Kernel"
   1.184 +		
   1.185 +		# Build bzImage64 without modules first
   1.186 +		if [ ! "nonomods" ]; then
   1.187 +			cp -f $stuff/$PACKAGE-slitaz.config64 .config
   1.188 +			sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
   1.189 +			# We can't keep every driver in staging ???
   1.190 +			sed -i -e 's/^CONFIG_RTL8192/#&/' \
   1.191 +				-e 's/^CONFIG_R8187SE/#&/' \
   1.192 +				-e 's/^CONFIG_RT2870/#&/' .config
   1.193 +			echo -e "\n* Configure bzImage64 without modules...\n"
   1.194 +			yes '' | make ARCH=x86_64 oldconfig
   1.195 +			echo -e "\n* Building bzImage64 without modules...\n"
   1.196 +			make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || exit 1
   1.197 +			[ -d $DESTDIR ] || mkdir -p $DESTDIR/linux64
   1.198 +			mv arch/x86/boot/bzImage $DESTDIR/linux64
   1.199 +			mv System.map System.map-without-modules64
   1.200 +		fi
   1.201 +		
   1.202 +		# Build bzImage64 with modules
   1.203 +		cp -f $stuff/$PACKAGE-slitaz.config64 .config
   1.204 +		echo -e "\n* Configure bzImage64 with modules...\n"
   1.205 +		yes '' | make ARCH=x86_64 oldconfig
   1.206 +		echo -e "\n* Building bzImage64 with modules...\n"
   1.207 +		make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage &&
   1.208 +		make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- modules &&
   1.209 +		make ARCH=x86_64 INSTALL_MOD_PATH=$DESTDIR/linux64 modules_install &&
   1.210 +		make ARCH=x86_64 INSTALL_HDR_PATH=$DESTDIR/linux64/usr headers_install &&
   1.211 +		ln .config $WOK/$PACKAGE/source/slitaz/config64
   1.212 +		[ -s arch/x86/boot/bzImage ] || return 1
   1.213 +		mkdir -p $DESTDIR/linux64/boot 2> /dev/null
   1.214 +		mv arch/x86/boot/bzImage $DESTDIR/linux64/boot/vmlinuz-$VERSION-slitaz
   1.215 +		ln System.map System.map-modules64
   1.216 +		ln Module.symvers Module.symvers-modules64
   1.217 +	else
   1.218 +		echo "* Skipping: x86_64 Kernel..."
   1.219  	fi
   1.220 -	cd $src
   1.221 -
   1.222 -	case "$opt" in
   1.223 -	*--no64*);;
   1.224 -	*)
   1.225 +	
   1.226  	#
   1.227 -	# Arch x86_64
   1.228 +	# Linux Arch i386 - GCC arch i486
   1.229  	#
   1.230 -	[ ! -x /usr/bin/cook ] && report step "Make bzImage64 without modules first"
   1.231 -	[ -x /usr/bin/cook ] && echo "Building x86_64 Kernel"
   1.232 -
   1.233 -	# Build bzImage64 without modules first
   1.234 -	cp -f $stuff/$PACKAGE-slitaz.config64 .config
   1.235 -	sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
   1.236 -
   1.237 -	# We can't keep every driver in staging
   1.238 -	sed -i -e 's/^CONFIG_RTL8192/#&/' \
   1.239 -	       -e 's/^CONFIG_R8187SE/#&/' \
   1.240 -	       -e 's/^CONFIG_RT2870/#&/' .config
   1.241 -	echo "Configure bzImage64 without modules..."
   1.242 -	yes '' | make ARCH=x86_64 oldconfig
   1.243 -	echo "Build bzImage64 without modules..."
   1.244 -	if [ -x /usr/bin/cook ]; then
   1.245 -		make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || exit 1
   1.246 -	elif [ -x /usr/bin/tazwok ]; then
   1.247 -		make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || { report close-bloc; return 1; }
   1.248 -	fi
   1.249 -	[ -d $DESTDIR ] || mkdir -p $DESTDIR/linux64
   1.250 -	mv arch/x86/boot/bzImage $DESTDIR/linux64
   1.251 -	mv System.map System.map-without-modules64
   1.252 -
   1.253 -	[ ! -x /usr/bin/cook ] && report step "Now build bzImage64 with modules"
   1.254 -
   1.255 -	# Build bzImage64 with modules
   1.256 -	cp -f $stuff/$PACKAGE-slitaz.config64 .config
   1.257 -	echo "Configure bzImage64 with modules..."
   1.258 -	yes '' | make ARCH=x86_64 oldconfig
   1.259 -	echo "Build bzImage64 with modules..."
   1.260 -	make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage &&
   1.261 -	make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- modules &&
   1.262 -	make ARCH=x86_64 INSTALL_MOD_PATH=$DESTDIR/linux64 modules_install &&
   1.263 -	make ARCH=x86_64 INSTALL_HDR_PATH=$DESTDIR/linux64/usr headers_install &&
   1.264 -	ln .config $WOK/$PACKAGE/source/slitaz/config64
   1.265 -	if [ -x /usr/bin/cook ]; then
   1.266 -		[ -s arch/x86/boot/bzImage ] || return 1
   1.267 -	elif [ -x /usr/bin/tazwok ]; then
   1.268 -		[ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; }
   1.269 -	fi
   1.270 -	mkdir -p $DESTDIR/linux64/boot 2> /dev/null
   1.271 -	mv arch/x86/boot/bzImage $DESTDIR/linux64/boot/vmlinuz-$VERSION-slitaz
   1.272 -	ln System.map System.map-modules64
   1.273 -	ln Module.symvers Module.symvers-modules64
   1.274 -	esac
   1.275 -
   1.276 -	#
   1.277 -	# Standard kernel
   1.278 -	#
   1.279 -	[ ! -x /usr/bin/cook ] && report step "Make bzImage without modules first"
   1.280 -	[ -x /usr/bin/cook ] && echo "Building standard kernel..."
   1.281 +	echo "Compiling: i386 Kernel..."
   1.282  
   1.283  	# Build bzImage without modules first
   1.284 -	cp -f $stuff/$PACKAGE-slitaz.config .config
   1.285 -	sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
   1.286 -
   1.287 -	# We can't keep every driver in staging
   1.288 -	sed -i -e 's/^CONFIG_RTL8192/#&/' \
   1.289 -	       -e 's/^CONFIG_R8187SE/#&/' \
   1.290 -	       -e 's/^CONFIG_RT2870/#&/' .config
   1.291 -	echo "Configure bzImage without modules..."
   1.292 -	yes '' | make ARCH=i386 oldconfig
   1.293 -	echo "Build bzImage without modules..."
   1.294 -	if [ -x /usr/bin/cook ]; then
   1.295 +	if [ ! "nonomods" ]; then
   1.296 +		cp -f $stuff/$PACKAGE-slitaz.config .config
   1.297 +		sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
   1.298 +		# We can't keep every driver in staging ???
   1.299 +		sed -i -e 's/^CONFIG_RTL8192/#&/' \
   1.300 +			-e 's/^CONFIG_R8187SE/#&/' \
   1.301 +			-e 's/^CONFIG_RT2870/#&/' .config
   1.302 +		echo -e "\n* Configure bzImage without modules...\n"
   1.303 +		yes '' | make ARCH=i386 oldconfig
   1.304 +		echo -e "\n* Building bzImage without modules...\n"
   1.305  		make ARCH=i386 -j 4 bzImage || exit 1
   1.306 -	elif [ -x /usr/bin/tazwok ]; then
   1.307 -		make ARCH=i386 -j 4 bzImage || { report close-bloc; return 1; }
   1.308 +		[ -d $DESTDIR ] || mkdir -p $DESTDIR
   1.309 +		mv arch/x86/boot/bzImage $DESTDIR
   1.310 +		mv System.map System.map-without-modules
   1.311  	fi
   1.312 -	[ -d $DESTDIR ] || mkdir -p $DESTDIR
   1.313 -	mv arch/x86/boot/bzImage $DESTDIR
   1.314 -	mv System.map System.map-without-modules
   1.315 -
   1.316 -	[ ! -x /usr/bin/cook ] && report step "Now build bzImage with modules"
   1.317 -
   1.318 +	
   1.319  	# Build bzImage with modules
   1.320  	cp -f $stuff/$PACKAGE-slitaz.config .config
   1.321 -	echo "Configure bzImage with modules..."
   1.322 +	echo -e "\n* Configure bzImage with modules...\n"
   1.323  	yes '' | make ARCH=i386 oldconfig
   1.324  	ln .config $WOK/$PACKAGE/source/slitaz/config
   1.325 -	echo "Build bzImage with modules..."
   1.326 +	echo -e "\n* Building bzImage with modules...\n"
   1.327  	make ARCH=i386 -j 4 bzImage &&
   1.328  	make ARCH=i386 -j 4 modules &&
   1.329  	make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR modules_install &&
   1.330  	make ARCH=i386 INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
   1.331 -	if [ -x /usr/bin/cook ]; then
   1.332 -		[ -s arch/x86/boot/bzImage ] || return 1
   1.333 -	elif [ -x /usr/bin/tazwok ]; then
   1.334 -		[ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; }
   1.335 -	fi
   1.336 +	[ -s arch/x86/boot/bzImage ] || return 1
   1.337  	mkdir -p $DESTDIR/boot 2> /dev/null
   1.338  	mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
   1.339 -
   1.340 -	[ ! -x /usr/bin/cook ] && report step "Compressing all modules"
   1.341 -
   1.342 +	
   1.343  	# Compress all modules.
   1.344 -	$stuff/gztazmod.sh $DESTDIR/lib/modules/$KBASEVER-slitaz
   1.345 -	$stuff/gztazmod.sh $DESTDIR/linux64/lib/modules/$KBASEVER-slitaz
   1.346 +	if [ -d "$DESTDIR/lib/modules/$VERSION-slitaz" ]; then
   1.347 +		$stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
   1.348 +	else
   1.349 +		return 1
   1.350 +	fi
   1.351 +	if [ -d "$DESTDIR/linux64/lib/modules/$VERSION-slitaz" ]; then
   1.352 +		$stuff/gztazmod.sh $DESTDIR/linux64/lib/modules/$VERSION-slitaz
   1.353 +	fi
   1.354  	ln System.map System.map-modules
   1.355  	ln Module.symvers Module.symvers-modules
   1.356 -
   1.357 -	if [ ! -x /usr/bin/cook ]; then
   1.358 -		report close-bloc
   1.359 -	fi
   1.360  }
   1.361  
   1.362  # Rules to gen a SliTaz package suitable for Tazpkg.
   1.363 @@ -283,70 +234,78 @@
   1.364      export PACKAGE VERSION
   1.365      local path
   1.366      cp -a $install/boot $fs
   1.367 +    
   1.368      # Compress all modules.
   1.369 -    path=$fs/lib/modules/$KBASEVER-slitaz/kernel
   1.370 +    path=$fs/lib/modules/$VERSION-slitaz/kernel
   1.371      mkdir -p $path
   1.372 -    cp -a $install/lib/modules/$KBASEVER-slitaz/mo* \
   1.373 -		$fs/lib/modules/$KBASEVER-slitaz
   1.374 -    [ "$KBASEVER" != "$VERSION" ] &&
   1.375 -	ln -s $KBASEVER-slitaz $fs/lib/modules/$VERSION-slitaz
   1.376 +	
   1.377      # Get the base modules
   1.378 -    export src
   1.379 -    export _pkg
   1.380 +    export src install
   1.381      mkdir -p $WOK/$PACKAGE/source/tmp
   1.382      # Warning stuff/list_modules.sh must find the generated modules.list
   1.383      $stuff/list_modules.sh \
   1.384 -	$(cat $stuff/modules.list) > $WOK/$PACKAGE/source/tmp/modules.list
   1.385 +		$(cat $stuff/modules.list) > $WOK/$PACKAGE/source/tmp/modules.list
   1.386      while read module; do
   1.387      	dir=$(dirname $module)
   1.388      	[ -d $path/$dir ] || mkdir -p $path/$dir
   1.389 -        cp -a $install/lib/modules/$KBASEVER-slitaz/kernel/$module $path/$dir
   1.390 +        cp -a $install/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
   1.391      done < $WOK/$PACKAGE/source/tmp/modules.list
   1.392 +    
   1.393      # Remove unresolved links
   1.394 -    rm -f $fs/lib/modules/$KBASEVER-slitaz/build
   1.395 -    rm -f $fs/lib/modules/$KBASEVER-slitaz/source
   1.396 -    # Cook all packages with a kernel module
   1.397 -    for i in $(cd $WOK; grep -l 'cook linux$' */receipt)
   1.398 +    rm -f $fs/lib/modules/$VERSION-slitaz/build
   1.399 +    rm -f $fs/lib/modules/$VERSION-slitaz/source
   1.400 +    
   1.401 +    # We only need module.{order,builtin} because other map files are 
   1.402 +    # generated by depmod in post_install
   1.403 +    cp -a $install/lib/modules/$VERSION-slitaz/modules.order \
   1.404 +		$install/lib/modules/$VERSION-slitaz/modules.builtin \
   1.405 +		$fs/lib/modules/$VERSION-slitaz
   1.406 +    
   1.407 +    # Pack all packages with a kernel module
   1.408 +    for i in $(cd $WOK; grep -l '^WANTED="linux"' */receipt)
   1.409      do
   1.410 -    	echo cook ${i%/receipt}
   1.411 +		[ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1
   1.412 +		cook ${i%/receipt}
   1.413      done
   1.414 -    # Fixed modules.dep to use right path
   1.415 -    # saves 100kb of space too
   1.416 -    sed -i "s|$_pkg||g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep
   1.417 -    sed -i "s|99.98.$KBASEVER-slitaz|$KBASEVER-slitaz|g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep
   1.418 -    # Check and echo any module in kernel .config that's not added to
   1.419 -    # one of linux-* pkgs
   1.420 -    $stuff/check_modules.sh
   1.421 +	
   1.422 +	# Check any module in kernel .config that's not added to a linux-* pkgs
   1.423 +	# and remove aufs patches: we dont need them in HG wok.
   1.424 +	$stuff/check_modules.sh
   1.425 +	rm -f $stuff/aufs3-*
   1.426  }
   1.427  
   1.428  # Pre and post install commands for Tazpkg.
   1.429  post_install()
   1.430  {
   1.431      echo "Processing post-install commands..."
   1.432 -    case "$ARCH" in
   1.433 +    chroot "$root/" depmod -a $VERSION-slitaz
   1.434 +    
   1.435 +    # Handle multiarch installation
   1.436 +    case "$SLITAZ_ARCH" in
   1.437  		arm)
   1.438  			echo "Kernel : /boot/linux-$VERSION-slitaz-$ARCH"
   1.439  			echo "Modules: /lib/modules/$VERSION-slitaz"
   1.440  			return 0 ;;
   1.441  	esac
   1.442 -    chroot "$1/" depmod -a $KBASEVER-slitaz
   1.443 -    # GRUB stuff.
   1.444 -    if [ -f "$1/boot/grub/menu.lst" ]; then
   1.445 -    	root_dev="/dev/`lsblk | grep '/$'| grep -o '[a-z]d[a-z][0-9]*'`" # current root device
   1.446 -    	grub_part="$(( `echo $root_dev | grep -o '[0-9]*$'`-1 ))"
   1.447 -    	grub_dev="`grep $(echo $root_dev | grep -o  '^/dev/.d.' ) $1/boot/grub/device.map |\
   1.448 -    	cut -f1 | sed "s/)$/.$grub_part)/g"`" # use device.map to find grub device number
   1.449 +	
   1.450 +	# GRUB stuff.
   1.451 +	if [ -f "$1/boot/grub/menu.lst" ]; then
   1.452 +		# Current root device
   1.453 +		root_dev="/dev/$(lsblk | grep '/$'| grep -o '[a-z]d[a-z][0-9]*')"
   1.454 +		grub_part="$(( $(echo $root_dev | grep -o '[0-9]*$')-1 ))"
   1.455 +		# Use device.map to find grub device number
   1.456 +		grub_dev="$(grep $(echo $root_dev | grep -o  '^/dev/.d.' ) \
   1.457 +			$1/boot/grub/device.map | cut -f1 | sed "s/)$/.$grub_part)/g")" 
   1.458      	
   1.459 -	# Add and clean kernel entrys in case of upgrade for installed system.
   1.460 -	if ! grep -q vmlinuz-$VERSION-slitaz $1/boot/grub/menu.lst; then
   1.461 +		# Add and clean kernel entries in case of upgrade for installed system.
   1.462 +		if ! grep -q vmlinuz-$VERSION-slitaz $1/boot/grub/menu.lst; then
   1.463  		
   1.464 -		#clean the old entry
   1.465 -		# TODO somewhere, the old vmlinuz file is removed.
   1.466 -		#      but the entry is still there. this cause a grub error:15 when selected
   1.467 -		# see http://bugs.slitaz.org/?id=74
   1.468 +			# Clean the old entry
   1.469 +			# TODO: old vmlinuz file is removed but the entry is still there.
   1.470 +			# So grub error:15 when selected: http://bugs.slitaz.org/?id=74
   1.471  
   1.472 -		#add the new
   1.473 -		cat >> $1/boot/grub/menu.lst << EOT
   1.474 +			# Add the new entry
   1.475 +			cat >> $1/boot/grub/menu.lst << EOT
   1.476  
   1.477  title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
   1.478  $grub_dev 
   1.479 @@ -356,8 +315,9 @@
   1.480  			last_entry=$(( $(grep -c '^title' $1/boot/grub/menu.lst)-1 ))
   1.481  			sed -e "s/^default.*/default $last_entry/g" -i $1/boot/grub/menu.lst
   1.482  		fi
   1.483 +		
   1.484  		# Display information message.
   1.485 -			cat <<EOT
   1.486 +		cat <<EOT
   1.487  ----
   1.488  GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
   1.489