wok-undigest diff linux/receipt @ rev 1089

linux: config+config64 => CONFIG_EFI=y
author Richard Dunbar <mojo@slitaz.org>
date Mon Dec 30 16:29:37 2013 +0000 (2013-12-30)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/linux/receipt	Mon Dec 30 16:29:37 2013 +0000
     1.3 @@ -0,0 +1,365 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="linux"
     1.7 +VERSION="3.2.53"
     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 +LICENSE="GPL2"
    1.13 +TARBALL="$PACKAGE-$KBASEVER.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="kmod"
    1.19 +BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch \
    1.20 +uclibc-cross-compiler-x86_64 busybox-boot"
    1.21 +
    1.22 +# Use version patch so we dont dl full kernel source on each minor update
    1.23 +[ "$KBASEVER" != "$VERSION" ] && 
    1.24 +PATCH="$(dirname $WGET_URL)/patch-$VERSION.xz" &&
    1.25 +EXTRA_SOURCE_FILES="$(basename $PATCH)"
    1.26 +
    1.27 +# Aufs enable chroot
    1.28 +AUFS_NOT_RAMFS="uclibc-cross-compiler-x86_64 is not compatible with aufs+tmpfs 8("
    1.29 +
    1.30 +# This will save/restore modules.dep but we want to regenerate it on
    1.31 +# install or upgrade.
    1.32 +#CONFIG_FILES="/lib/modules/$KBASEVER-slitaz/modules.dep"
    1.33 +
    1.34 +# Handle multiarch compilation. Less bdeps when cross-compiling for ARM
    1.35 +case "$ARCH" in
    1.36 +	arm) BUILD_DEPENDS="xz" TARBALL="$PACKAGE-$VERSION.tar.bz2" ;;
    1.37 +	x86_64) BUILD_DEPENDS="xz" ;;
    1.38 +esac
    1.39 +
    1.40 +# TODO: slitaz.conf provide SLITAZ_ARCH and must be handled by tazpkg/spk
    1.41 +[ -f "$root/etc/slitaz/slitaz.conf" ] && . $root/etc/slitaz/slitaz.conf
    1.42 +
    1.43 +# Handle multiarch installation. ARM use Busybox modutils, so avoid any
    1.44 +# deps on kmod
    1.45 +case "$SLITAZ_ARCH" in
    1.46 +	arm) DEPENDS="" ;;
    1.47 +esac
    1.48 +
    1.49 +# Rules to configure and make the package.
    1.50 +compile_rules()
    1.51 +{
    1.52 +	cd $src
    1.53 +	cp /usr/share/boot/initrd initrd.cpio
    1.54 +
    1.55 +	if [ "$KBASEVER" != "$VERSION" ]; then
    1.56 +		[ -s $SRC/$(basename $PATCH) ] ||
    1.57 +		wget $PATCH -O $SRC/$(basename $PATCH)
    1.58 +		xzcat $SRC/$(basename $PATCH) | patch -Np1
    1.59 +		touch done.patch-$VERSION
    1.60 +	fi
    1.61 +
    1.62 +	case "$ARCH" in
    1.63 +		arm)
    1.64 +			echo "Compiling: ARM Kernel"
    1.65 +			if [ ! -s $SRC/$(basename $PATCH) ]; then
    1.66 +				wget $PATCH -O $SRC/$(basename $PATCH)
    1.67 +			fi
    1.68 +			make mrproper
    1.69 +			# Buggy: we got kernel panic about module not tinted 3.2.14
    1.70 +			#echo "Applying patch: $(basename $PATCH)"
    1.71 +			#xzcat $SRC/$(basename $PATCH) | patch -Np1 >/dev/null
    1.72 +			patch -Np1 < $stuff/$ARCH/linux-arm.patch || exit 1
    1.73 +			cp -f $stuff/$ARCH/linux-arm.config .config
    1.74 +			make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- bzImage &&
    1.75 +			make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- modules &&
    1.76 +			make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- \
    1.77 +				INSTALL_MOD_PATH=$DESTDIR modules_install &&
    1.78 +			mkdir -p $DESTDIR/boot &&
    1.79 +			cp -a arch/arm/boot/zImage \
    1.80 +				$DESTDIR/boot/linux-$VERSION-slitaz-$ARCH
    1.81 +			return 0 ;;
    1.82 +		x86_64)
    1.83 +			echo "TODO: Maybe use default ? But cross compile in x86_64 chroot"
    1.84 +			echo "so we can remove the 64 build by uclibc-cross-compiler-x86_64"
    1.85 +			return 0 ;;
    1.86 +	esac
    1.87 +
    1.88 +	[ ! -x /usr/bin/cook ] && report open-bloc
    1.89 +
    1.90 +	# Check for Aufs and cook it if unbuilt.
    1.91 +	echo "Checking for Aufs packages..."
    1.92 +	_AUFSVER=`grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
    1.93 +	if [ -x /usr/bin/cook ]; then
    1.94 +		# Give info an redirect to /dev/null since aufs got it own log.
    1.95 +		AUFSDIR=$WOK/aufs/source/aufs-${_AUFSVER}
    1.96 +		[ -d "$AUFSDIR" ] && rm -rf $AUFSDIR
    1.97 +		#echo "Cook: aufs $_AUFSVER"
    1.98 +		cook aufs --getsrc
    1.99 +		mkdir -p $WOK/aufs/source/
   1.100 +		tar xjf $SRC/aufs-${_AUFSVER}.tar.bz2 -C $WOK/aufs/source/
   1.101 +	elif [ -x /usr/bin/tazwok ]; then
   1.102 +		# we just need aufs source. Also cooking now is a bad idea since it
   1.103 +		# needs linux-module-headers. The one your cooking not the one from the web.
   1.104 +		AUFSDIR=$WOK/aufs/aufs-${_AUFSVER}
   1.105 +		[ -d "$AUFSDIR" ] && rm -rf $AUFSDIR
   1.106 +		tazwok get-src aufs --target=$AUFSDIR || { report close-bloc; return 1; }
   1.107 +	fi
   1.108 +	echo "cook:linux" > $command
   1.109 +
   1.110 +	echo "Copying Aufs files and patches..."
   1.111 +	cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
   1.112 +	cp -a $AUFSDIR/aufs3-*.patch $stuff
   1.113 +
   1.114 +	# SliTaz db
   1.115 +	[ -d $WOK/$PACKAGE/source/slitaz ] && rm -rf $WOK/$PACKAGE/source/slitaz 2> /dev/null
   1.116 +	mkdir -p $WOK/$PACKAGE/source/slitaz
   1.117 +	echo "$WGET_URL" > $WOK/$PACKAGE/source/slitaz/url
   1.118 +	cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/source/slitaz
   1.119 +	cp $stuff/bootloader.sh $WOK/$PACKAGE/source/slitaz
   1.120 +
   1.121 +	# Apply patches
   1.122 +	echo "Applying patches..."
   1.123 +	while read patch_file; do
   1.124 +		echo "$patch_file" >> $WOK/$PACKAGE/source/slitaz/patches
   1.125 +		cp $stuff/$patch_file $WOK/$PACKAGE/source/slitaz
   1.126 +		if [ -f done.$patch_file ]; then
   1.127 +			echo "Skipping $patch_file"
   1.128 +			continue
   1.129 +		fi
   1.130 +		echo "Apply $patch_file"
   1.131 +		if [ -x /usr/bin/cook ]; then
   1.132 +			patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || return 1
   1.133 +		elif [ -x /usr/bin/tazwok ]; then
   1.134 +			patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || { report close-bloc; return 1; }
   1.135 +		fi
   1.136 +		touch done.$patch_file
   1.137 +	done <<EOT
   1.138 +$PACKAGE-diff.u
   1.139 +$PACKAGE-header.u
   1.140 +$PACKAGE-freeinitrd.u
   1.141 +$PACKAGE-subroot.u
   1.142 +$PACKAGE-CVE-2013-2929.u
   1.143 +aufs3-base.patch
   1.144 +aufs3-standalone.patch
   1.145 +aufs3-loopback.patch
   1.146 +aufs3-mmap.patch
   1.147 +channel-negative-one-maxim.patch
   1.148 +mac80211.compat08082009.wl_frag+ack_v1.patch
   1.149 +EOT
   1.150 +
   1.151 +	sed -i 's|SUBLEVEL =.*|SUBLEVEL =|g' Makefile
   1.152 +
   1.153 +	[ ! -x /usr/bin/cook ] && report step "Make kernel proper and then build lguest"
   1.154 +	[ -x /usr/bin/cook ] && echo "Make kernel proper and then build lguest"
   1.155 +	make mrproper
   1.156 +	cd Documentation/virtual/lguest
   1.157 +	if [ -x /usr/bin/cook ]; then
   1.158 +		make lguest || return 1
   1.159 +	elif [ -x /usr/bin/tazwok ]; then
   1.160 +		make lguest || { report close-bloc; return 1; }
   1.161 +	fi
   1.162 +	cd $src
   1.163 +
   1.164 +	case "$opt" in
   1.165 +	*--no64*);;
   1.166 +	*)
   1.167 +	#
   1.168 +	# Arch x86_64
   1.169 +	#
   1.170 +	[ ! -x /usr/bin/cook ] && report step "Make bzImage64 without modules first"
   1.171 +	[ -x /usr/bin/cook ] && echo "Building x86_64 Kernel"
   1.172 +
   1.173 +	# Build bzImage64 without modules first
   1.174 +	cp -f $stuff/$PACKAGE-slitaz.config64 .config
   1.175 +	sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
   1.176 +
   1.177 +	# We can't keep every driver in staging
   1.178 +	sed -i -e 's/^CONFIG_RTL8192/#&/' \
   1.179 +	       -e 's/^CONFIG_R8187SE/#&/' \
   1.180 +	       -e 's/^CONFIG_RT2870/#&/' .config
   1.181 +	yes '' | make ARCH=x86_64 oldconfig
   1.182 +	if [ -x /usr/bin/cook ]; then
   1.183 +		make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || exit 1
   1.184 +	elif [ -x /usr/bin/tazwok ]; then
   1.185 +		make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || { report close-bloc; return 1; }
   1.186 +	fi
   1.187 +	[ -d $DESTDIR ] || mkdir -p $DESTDIR/linux64
   1.188 +	mv arch/x86/boot/bzImage $DESTDIR/linux64
   1.189 +	mv System.map System.map-without-modules64
   1.190 +
   1.191 +	[ ! -x /usr/bin/cook ] && report step "Now build bzImage64 with modules"
   1.192 +
   1.193 +	# Build bzImage64 with modules
   1.194 +	cp -f $stuff/$PACKAGE-slitaz.config64 .config
   1.195 +	#make ARCH=x86_64 oldconfig
   1.196 +	make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage &&
   1.197 +	make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- modules &&
   1.198 +	make ARCH=x86_64 INSTALL_MOD_PATH=$DESTDIR/linux64 modules_install &&
   1.199 +	make ARCH=x86_64 INSTALL_HDR_PATH=$DESTDIR/linux64/usr headers_install &&
   1.200 +	ln .config $WOK/$PACKAGE/source/slitaz/config64
   1.201 +	if [ -x /usr/bin/cook ]; then
   1.202 +		[ -s arch/x86/boot/bzImage ] || return 1
   1.203 +	elif [ -x /usr/bin/tazwok ]; then
   1.204 +		[ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; }
   1.205 +	fi
   1.206 +	mkdir -p $DESTDIR/linux64/boot 2> /dev/null
   1.207 +	mv arch/x86/boot/bzImage $DESTDIR/linux64/boot/vmlinuz-$VERSION-slitaz
   1.208 +	ln System.map System.map-modules64
   1.209 +	ln Module.symvers Module.symvers-modules64
   1.210 +	esac
   1.211 +
   1.212 +	#
   1.213 +	# Standard kernel
   1.214 +	#
   1.215 +	[ ! -x /usr/bin/cook ] && report step "Make bzImage without modules first"
   1.216 +	[ -x /usr/bin/cook ] && echo "Building standard kernel..."
   1.217 +
   1.218 +	# Build bzImage without modules first
   1.219 +	cp -f $stuff/$PACKAGE-slitaz.config .config
   1.220 +	sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
   1.221 +
   1.222 +	# We can't keep every driver in staging
   1.223 +	sed -i -e 's/^CONFIG_RTL8192/#&/' \
   1.224 +	       -e 's/^CONFIG_R8187SE/#&/' \
   1.225 +	       -e 's/^CONFIG_RT2870/#&/' .config
   1.226 +	yes '' | make ARCH=i386 oldconfig
   1.227 +	if [ -x /usr/bin/cook ]; then
   1.228 +		make ARCH=i386 -j 4 bzImage || exit 1
   1.229 +	elif [ -x /usr/bin/tazwok ]; then
   1.230 +		make ARCH=i386 -j 4 bzImage || { report close-bloc; return 1; }
   1.231 +	fi
   1.232 +	[ -d $DESTDIR ] || mkdir -p $DESTDIR
   1.233 +	mv arch/x86/boot/bzImage $DESTDIR
   1.234 +	mv System.map System.map-without-modules
   1.235 +
   1.236 +	[ ! -x /usr/bin/cook ] && report step "Now build bzImage with modules"
   1.237 +
   1.238 +	# Build bzImage with modules
   1.239 +	cp -f $stuff/$PACKAGE-slitaz.config .config
   1.240 +	#make ARCH=i386 oldconfig
   1.241 +	ln .config $WOK/$PACKAGE/source/slitaz/config
   1.242 +	make ARCH=i386 -j 4 bzImage &&
   1.243 +	make ARCH=i386 -j 4 modules &&
   1.244 +	make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR modules_install &&
   1.245 +	make ARCH=i386 INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
   1.246 +	if [ -x /usr/bin/cook ]; then
   1.247 +		[ -s arch/x86/boot/bzImage ] || return 1
   1.248 +	elif [ -x /usr/bin/tazwok ]; then
   1.249 +		[ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; }
   1.250 +	fi
   1.251 +	mkdir -p $DESTDIR/boot 2> /dev/null
   1.252 +	mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
   1.253 +
   1.254 +	[ ! -x /usr/bin/cook ] && report step "Compressing all modules"
   1.255 +
   1.256 +	# Compress all modules.
   1.257 +	$stuff/gztazmod.sh $DESTDIR/lib/modules/$KBASEVER-slitaz
   1.258 +	$stuff/gztazmod.sh $DESTDIR/linux64/lib/modules/$KBASEVER-slitaz
   1.259 +	ln System.map System.map-modules
   1.260 +	ln Module.symvers Module.symvers-modules
   1.261 +
   1.262 +	if [ ! -x /usr/bin/cook ]; then
   1.263 +		report close-bloc
   1.264 +	fi
   1.265 +}
   1.266 +
   1.267 +# Rules to gen a SliTaz package suitable for Tazpkg.
   1.268 +genpkg_rules()
   1.269 +{
   1.270 +	case "$ARCH" in
   1.271 +		arm)
   1.272 +			echo "Packing: ARM Kernel"
   1.273 +			cp -a $install/* $fs
   1.274 +			rm -f $fs/lib/modules/*/build $fs/lib/modules/*/source
   1.275 +			return 0 ;;
   1.276 +		x86_64)
   1.277 +			echo "TODO: use default or custom x86_64 packing"
   1.278 +			return 0 ;;
   1.279 +	esac
   1.280 +
   1.281 +    export PACKAGE VERSION
   1.282 +    local path
   1.283 +    cp -a $install/boot $fs
   1.284 +    # Compress all modules.
   1.285 +    path=$fs/lib/modules/$KBASEVER-slitaz/kernel
   1.286 +    mkdir -p $path
   1.287 +    cp -a $install/lib/modules/$KBASEVER-slitaz/mo* \
   1.288 +		$fs/lib/modules/$KBASEVER-slitaz
   1.289 +    [ "$KBASEVER" != "$VERSION" ] &&
   1.290 +	ln -s $KBASEVER-slitaz $fs/lib/modules/$VERSION-slitaz
   1.291 +    # Get the base modules
   1.292 +    export src
   1.293 +    export _pkg
   1.294 +    mkdir -p $WOK/$PACKAGE/source/tmp
   1.295 +    # Warning stuff/list_modules.sh must find the generated modules.list
   1.296 +    $stuff/list_modules.sh \
   1.297 +	$(cat $stuff/modules.list) > $WOK/$PACKAGE/source/tmp/modules.list
   1.298 +    while read module; do
   1.299 +    	dir=$(dirname $module)
   1.300 +    	[ -d $path/$dir ] || mkdir -p $path/$dir
   1.301 +        cp -a $install/lib/modules/$KBASEVER-slitaz/kernel/$module $path/$dir
   1.302 +    done < $WOK/$PACKAGE/source/tmp/modules.list
   1.303 +    # Remove unresolved links
   1.304 +    rm -f $fs/lib/modules/$KBASEVER-slitaz/build
   1.305 +    rm -f $fs/lib/modules/$KBASEVER-slitaz/source
   1.306 +    # Cook all packages with a kernel module
   1.307 +    for i in $(cd $WOK; grep -l 'cook linux$' */receipt)
   1.308 +    do
   1.309 +    	echo cook ${i%/receipt}
   1.310 +    done
   1.311 +    # Fixed modules.dep to use right path
   1.312 +    # saves 100kb of space too
   1.313 +    sed -i "s|$_pkg||g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep
   1.314 +    sed -i "s|99.98.$KBASEVER-slitaz|$KBASEVER-slitaz|g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep
   1.315 +    # Check and echo any module in kernel .config that's not added to
   1.316 +    # one of linux-* pkgs
   1.317 +    $stuff/check_modules.sh
   1.318 +}
   1.319 +
   1.320 +# Pre and post install commands for Tazpkg.
   1.321 +post_install()
   1.322 +{
   1.323 +    echo "Processing post-install commands..."
   1.324 +    case "$ARCH" in
   1.325 +		arm)
   1.326 +			echo "Kernel : /boot/linux-$VERSION-slitaz-$ARCH"
   1.327 +			echo "Modules: /lib/modules/$VERSION-slitaz"
   1.328 +			return 0 ;;
   1.329 +	esac
   1.330 +    chroot "$1/" depmod -a $KBASEVER-slitaz
   1.331 +    # GRUB stuff.
   1.332 +    if [ -f "$1/boot/grub/menu.lst" ]; then
   1.333 +    	root_dev="/dev/`lsblk | grep '/$'| grep -o '[a-z]d[a-z][0-9]*'`" # current root device
   1.334 +    	grub_part="$(( `echo $root_dev | grep -o '[0-9]*$'`-1 ))"
   1.335 +    	grub_dev="`grep $(echo $root_dev | grep -o  '^/dev/.d.' ) $1/boot/grub/device.map |\
   1.336 +    	cut -f1 | sed "s/)$/.$grub_part)/g"`" # use device.map to find grub device number
   1.337 +    	
   1.338 +	# Add and clean kernel entrys in case of upgrade for installed system.
   1.339 +	if ! grep -q vmlinuz-$VERSION-slitaz $1/boot/grub/menu.lst; then
   1.340 +		
   1.341 +		#clean the old entry
   1.342 +		# TODO somewhere, the old vmlinuz file is removed.
   1.343 +		#      but the entry is still there. this cause a grub error:15 when selected
   1.344 +		# see http://bugs.slitaz.org/?id=74
   1.345 +
   1.346 +		#add the new
   1.347 +		cat >> $1/boot/grub/menu.lst << EOT
   1.348 +
   1.349 +title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
   1.350 +$grub_dev 
   1.351 +kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev quiet
   1.352 +EOT
   1.353 +			# Make it the default entry
   1.354 +			last_entry=$(( $(grep -c '^title' $1/boot/grub/menu.lst)-1 ))
   1.355 +			sed -e "s/^default.*/default $last_entry/g" -i $1/boot/grub/menu.lst
   1.356 +		fi
   1.357 +		# Display information message.
   1.358 +			cat <<EOT
   1.359 +----
   1.360 +GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
   1.361 +
   1.362 +title  SliTaz GNU/Linux (Kernel $VERSION-slitaz)
   1.363 +$grub_dev
   1.364 +kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
   1.365 +----
   1.366 +EOT
   1.367 +	fi
   1.368 +}