wok-current annotate linux/receipt @ rev 14179

Up aufs (20130311)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Mar 10 22:10:51 2013 +0100 (2013-03-10)
parents 74214d640d0f
children 2d5f8d944cff
rev   line source
pankso@3 1 # SliTaz package receipt.
pankso@3 2
pankso@3 3 PACKAGE="linux"
pascal@14175 4 VERSION="3.2.40"
pankso@12812 5 KBASEVER="${VERSION:0:3}"
pankso@3 6 CATEGORY="base-system"
pankso@3 7 SHORT_DESC="The Linux kernel and modules."
pankso@3864 8 MAINTAINER="devel@slitaz.org"
pankso@12812 9 TARBALL="$PACKAGE-$KBASEVER.tar.xz"
pankso@3 10 WEB_SITE="http://www.kernel.org/"
pankso@12285 11 WGET_URL="http://www.kernel.org/pub/linux/kernel/v3.0/$TARBALL"
pankso@12803 12 HOST_ARCH="i486 arm x86_64"
pankso@12803 13
pankso@12812 14 DEPENDS="kmod"
pascal@14176 15 BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch uclibc-cross-compiler-x86_64 wget"
pankso@12824 16
pankso@12824 17 # Use version patch so we dont dl full kernel source on each minor update
pankso@12824 18 [ "$KBASEVER" != "$VERSION" ] && \
pankso@12824 19 PATCH="http://www.kernel.org/pub/linux/kernel/v3.0/patch-$VERSION.xz"
pankso@12812 20
pankso@12803 21 # Aufs enable chroot
pascal@12625 22 AUFS_NOT_SUPPORTED="uclibc-cross-compiler-x86_64 is not compatible with aufs 8("
pankso@3 23
pankso@12824 24 # This will save/restore modules.dep but we want to regenerate it on
pankso@12824 25 # install or upgrade.
pankso@12803 26 #CONFIG_FILES="/lib/modules/$KBASEVER-slitaz/modules.dep"
pankso@12803 27
pankso@12824 28 # Handle multiarch compilation. Less bdeps when cross-compiling for ARM
pankso@12803 29 case "$ARCH" in
pankso@12824 30 arm) BUILD_DEPENDS="xz" TARBALL="$PACKAGE-$VERSION.tar.bz2" ;;
pankso@12824 31 x86_64) BUILD_DEPENDS="xz" ;;
pankso@12824 32 esac
pankso@12824 33
pankso@12824 34 # TODO: slitaz.conf provide SLITAZ_ARCH and must be handled by tazpkg/spk
pankso@12824 35 [ -f "$root/etc/slitaz/slitaz.conf" ] && . $root/etc/slitaz/slitaz.conf
pankso@12824 36
pankso@12824 37 # Handle multiarch installation. ARM use Busybox modutils, so avoid any
pankso@12824 38 # deps on kmod
pankso@12824 39 case "$SLITAZ_ARCH" in
pankso@12824 40 arm) DEPENDS="" ;;
pankso@12803 41 esac
pankso@9731 42
pankso@3 43 # Rules to configure and make the package.
pankso@3 44 compile_rules()
pankso@3 45 {
pankso@9731 46 cd $src
pankso@12803 47
pascal@14179 48 if [ "$KBASEVER" != "$VERSION" ]; then
pascal@14179 49 [ -s $SRC/$(basename $PATCH) ] ||
pascal@14179 50 wget --no-check-certificate $PATCH -O $SRC/$(basename $PATCH)
pascal@14179 51 xzcat $SRC/$(basename $PATCH) | patch -Np1
pascal@14179 52 touch done.patch-$VERSION
pascal@14179 53 fi
pascal@14179 54
pankso@12803 55 case "$ARCH" in
pankso@12803 56 arm)
pankso@12803 57 echo "Compiling: ARM Kernel"
pascal@14178 58 if [ ! -s $SRC/$(basename $PATCH) ]; then
pascal@14177 59 wget --no-check-certificate $PATCH -O $SRC/$(basename $PATCH)
pankso@12812 60 fi
pankso@12824 61 make mrproper
pankso@12824 62 # Buggy: we got kernel panic about module not tinted 3.2.14
pankso@12824 63 #echo "Applying patch: $(basename $PATCH)"
pankso@12824 64 #xzcat $SRC/$(basename $PATCH) | patch -Np1 >/dev/null
pankso@12824 65 patch -Np1 < $stuff/$ARCH/linux-arm.patch || exit 1
pankso@12824 66 cp -f $stuff/$ARCH/linux-arm.config .config
pankso@12803 67 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- bzImage &&
pankso@12803 68 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- modules &&
pankso@12803 69 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- \
pankso@12803 70 INSTALL_MOD_PATH=$DESTDIR modules_install &&
pankso@12803 71 mkdir -p $DESTDIR/boot &&
pankso@12824 72 cp -a arch/arm/boot/zImage \
pankso@12803 73 $DESTDIR/boot/linux-$VERSION-slitaz-$ARCH
pankso@12803 74 return 0 ;;
pankso@12803 75 x86_64)
pankso@12803 76 echo "TODO: Maybe use default ? But cross compile in x86_64 chroot"
pankso@12803 77 echo "so we can remove the 64 build by uclibc-cross-compiler-x86_64"
pankso@12803 78 return 0 ;;
pankso@12803 79 esac
pankso@12803 80
gokhlayeh@11395 81 [ ! -x /usr/bin/cook ] && report open-bloc
pankso@9731 82
pankso@9731 83 # Check for Aufs and cook it if unbuilt.
pankso@9731 84 echo "Checking for Aufs packages..."
pankso@12285 85 _AUFSVER=`grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
pankso@12285 86 if [ -x /usr/bin/cook ]; then
gokhlayeh@11395 87 # Give info an redirect to /dev/null since aufs got it own log.
gokhlayeh@11395 88 AUFSDIR=$WOK/aufs/source/aufs-${_AUFSVER}
pankso@12285 89 [ -d "$AUFSDIR" ] && rm -rf $AUFSDIR
pankso@12285 90 #echo "Cook: aufs $_AUFSVER"
pankso@12288 91 cook aufs --getsrc
pankso@12288 92 mkdir -p $WOK/aufs/source/
pankso@12289 93 tar xjf $SRC/aufs-${_AUFSVER}.tar.bz2 -C $WOK/aufs/source/
pankso@12285 94 elif [ -x /usr/bin/tazwok ]; then
pankso@12285 95 # we just need aufs source. Also cooking now is a bad idea since it
pankso@12285 96 # needs linux-module-headers. The one your cooking not the one from the web.
gokhlayeh@11395 97 AUFSDIR=$WOK/aufs/aufs-${_AUFSVER}
gokhlayeh@11395 98 [ -d "$AUFSDIR" ] && rm -rf $AUFSDIR
gokhlayeh@11395 99 tazwok get-src aufs --target=$AUFSDIR || { report close-bloc; return 1; }
pankso@9731 100 fi
pankso@12285 101 echo "cook:linux" > $command
pankso@12285 102
pankso@9731 103 echo "Copying Aufs files and patches..."
slaxemulator@7297 104 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
pankso@12285 105 cp -a $AUFSDIR/aufs3-*.patch $stuff
pankso@12285 106
pankso@4251 107 # SliTaz db
pankso@12285 108 [ -d $WOK/$PACKAGE/source/slitaz ] && rm -rf $WOK/$PACKAGE/source/slitaz 2> /dev/null
pankso@12285 109 mkdir -p $WOK/$PACKAGE/source/slitaz
pankso@12290 110 echo "$WGET_URL" > $WOK/$PACKAGE/source/slitaz/url
pankso@12285 111 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/source/slitaz
pankso@12285 112 cp $stuff/bootloader.sh $WOK/$PACKAGE/source/slitaz
pankso@12803 113
pankso@5640 114 # Apply patches
pankso@9731 115 echo "Applying patches..."
pascal@521 116 while read patch_file; do
pankso@12285 117 echo "$patch_file" >> $WOK/$PACKAGE/source/slitaz/patches
pankso@12285 118 cp $stuff/$patch_file $WOK/$PACKAGE/source/slitaz
pascal@1442 119 if [ -f done.$patch_file ]; then
pascal@1442 120 echo "Skipping $patch_file"
pascal@1442 121 continue
pascal@1442 122 fi
pascal@521 123 echo "Apply $patch_file"
pankso@12285 124 if [ -x /usr/bin/cook ]; then
pankso@12285 125 patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || return 1
pankso@12285 126 elif [ -x /usr/bin/tazwok ]; then
pankso@12285 127 patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || { report close-bloc; return 1; }
pankso@12285 128 fi
pascal@1442 129 touch done.$patch_file
pascal@521 130 done <<EOT
pankso@12285 131 $PACKAGE-diff.u
pankso@12285 132 $PACKAGE-header.u
pankso@12285 133 $PACKAGE-freeinitrd.u
pankso@12285 134 aufs3-base.patch
pankso@12285 135 aufs3-standalone.patch
pankso@12285 136 aufs3-loopback.patch
pankso@12285 137 aufs3-proc_map.patch
pankso@12285 138 channel-negative-one-maxim.patch
pankso@12285 139 mac80211.compat08082009.wl_frag+ack_v1.patch
pascal@521 140 EOT
pankso@9731 141
pankso@12285 142 sed -i 's|SUBLEVEL =.*|SUBLEVEL =|g' Makefile
pankso@12285 143
gokhlayeh@11395 144 [ ! -x /usr/bin/cook ] && report step "Make kernel proper and then build lguest"
pankso@12294 145 [ -x /usr/bin/cook ] && echo "Make kernel proper and then build lguest"
pankso@3864 146 make mrproper
pankso@12285 147 cd Documentation/virtual/lguest
pankso@12285 148 if [ -x /usr/bin/cook ]; then
pankso@12285 149 make lguest || return 1
pankso@12285 150 elif [ -x /usr/bin/tazwok ]; then
pankso@12285 151 make lguest || { report close-bloc; return 1; }
pankso@12285 152 fi
slaxemulator@8681 153 cd $src
pankso@12803 154
pascal@12570 155 case "$opt" in
pascal@12570 156 *--no64*);;
pascal@12570 157 *)
pankso@12294 158 #
pankso@12294 159 # Arch x86_64
pankso@12294 160 #
pankso@12294 161 [ ! -x /usr/bin/cook ] && report step "Make bzImage64 without modules first"
pankso@12294 162 [ -x /usr/bin/cook ] && echo "Building x86_64 Kernel"
pankso@12803 163
pankso@12285 164 # Build bzImage64 without modules first
pascal@12293 165 cp -f $stuff/$PACKAGE-slitaz.config64 .config
pankso@12285 166 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
pankso@12803 167
pankso@12803 168 # We can't keep every driver in staging
pankso@12285 169 sed -i -e 's/^CONFIG_RTL8192/#&/' \
pankso@12285 170 -e 's/^CONFIG_R8187SE/#&/' \
pankso@12285 171 -e 's/^CONFIG_RT2870/#&/' .config
pankso@12285 172 yes '' | make ARCH=x86_64 oldconfig
pankso@12285 173 if [ -x /usr/bin/cook ]; then
pankso@12285 174 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || exit 1
pankso@12285 175 elif [ -x /usr/bin/tazwok ]; then
pankso@12285 176 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || { report close-bloc; return 1; }
pankso@12285 177 fi
pankso@12285 178 [ -d $PWD/_pkg ] || mkdir -p $DESTDIR/linux64
pankso@12285 179 mv arch/x86/boot/bzImage $DESTDIR/linux64
pankso@12285 180 mv System.map System.map-without-modules64
pankso@12285 181
pankso@12285 182 [ ! -x /usr/bin/cook ] && report step "Now build bzImage64 with modules"
pankso@12803 183
pankso@12285 184 # Build bzImage64 with modules
pascal@12293 185 cp -f $stuff/$PACKAGE-slitaz.config64 .config
pankso@12285 186 #make ARCH=x86_64 oldconfig
pascal@13930 187 ln .config $WOK/$PACKAGE/source/slitaz/config64
pankso@12285 188 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage &&
pankso@12285 189 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- modules &&
pankso@12285 190 make ARCH=x86_64 INSTALL_MOD_PATH=$DESTDIR/linux64 modules_install &&
pankso@12285 191 make ARCH=x86_64 INSTALL_HDR_PATH=$DESTDIR/linux64/usr headers_install &&
pankso@12285 192 if [ -x /usr/bin/cook ]; then
pankso@12285 193 [ -s arch/x86/boot/bzImage ] || return 1
pankso@12285 194 elif [ -x /usr/bin/tazwok ]; then
pankso@12285 195 [ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; }
pankso@12285 196 fi
pankso@12285 197 mkdir -p $DESTDIR/linux64/boot 2> /dev/null
pankso@12285 198 mv arch/x86/boot/bzImage $DESTDIR/linux64/boot/vmlinuz-$VERSION-slitaz
pankso@12285 199 ln System.map System.map-modules64
pankso@12285 200 ln Module.symvers Module.symvers-modules64
pascal@12570 201 esac
pankso@12803 202
pankso@12294 203 #
pankso@12294 204 # Standard kernel
pankso@12294 205 #
pankso@12294 206 [ ! -x /usr/bin/cook ] && report step "Make bzImage without modules first"
pankso@12294 207 [ -x /usr/bin/cook ] && echo "Building standard kernel..."
pankso@12803 208
pankso@12294 209 # Build bzImage without modules first
pankso@12294 210 cp -f $stuff/$PACKAGE-slitaz.config .config
pankso@12294 211 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
pankso@12803 212
pankso@12803 213 # We can't keep every driver in staging
pankso@12294 214 sed -i -e 's/^CONFIG_RTL8192/#&/' \
pankso@12294 215 -e 's/^CONFIG_R8187SE/#&/' \
pankso@12294 216 -e 's/^CONFIG_RT2870/#&/' .config
pankso@12294 217 yes '' | make oldconfig
pankso@12294 218 if [ -x /usr/bin/cook ]; then
pankso@12294 219 make -j 4 bzImage || exit 1
pankso@12294 220 elif [ -x /usr/bin/tazwok ]; then
pankso@12294 221 make -j 4 bzImage || { report close-bloc; return 1; }
pankso@12294 222 fi
pankso@12294 223 [ -d $DESTDIR ] || mkdir -p $DESTDIR
pankso@12294 224 mv arch/x86/boot/bzImage $DESTDIR
pankso@12294 225 mv System.map System.map-without-modules
pankso@12294 226
pankso@12294 227 [ ! -x /usr/bin/cook ] && report step "Now build bzImage with modules"
pankso@12803 228
pankso@12294 229 # Build bzImage with modules
pankso@12294 230 cp -f $stuff/$PACKAGE-slitaz.config .config
pankso@12294 231 #make oldconfig
pankso@12294 232 ln .config $WOK/$PACKAGE/source/slitaz/config
pankso@12294 233 make -j 4 bzImage &&
pankso@12294 234 make -j 4 modules &&
pankso@12294 235 make INSTALL_MOD_PATH=$DESTDIR modules_install &&
pankso@12294 236 make INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
pankso@12294 237 if [ -x /usr/bin/cook ]; then
pankso@12294 238 [ -s arch/x86/boot/bzImage ] || return 1
pankso@12294 239 elif [ -x /usr/bin/tazwok ]; then
pankso@12294 240 [ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; }
pankso@12294 241 fi
pankso@12294 242 mkdir -p $DESTDIR/boot 2> /dev/null
pankso@12294 243 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
pankso@12803 244
gokhlayeh@11395 245 [ ! -x /usr/bin/cook ] && report step "Compressing all modules"
pankso@12803 246
slaxemulator@6719 247 # Compress all modules.
pankso@12285 248 $stuff/gztazmod.sh $DESTDIR/lib/modules/$KBASEVER-slitaz
pankso@12285 249 $stuff/gztazmod.sh $DESTDIR/linux64/lib/modules/$KBASEVER-slitaz
pascal@7667 250 ln System.map System.map-modules
pascal@7667 251 ln Module.symvers Module.symvers-modules
pankso@12803 252
gokhlayeh@11395 253 if [ ! -x /usr/bin/cook ]; then
gokhlayeh@11395 254 report close-bloc
gokhlayeh@11395 255 fi
pankso@3864 256 }
erjo@253 257
pankso@3 258 # Rules to gen a SliTaz package suitable for Tazpkg.
pankso@3 259 genpkg_rules()
pankso@3 260 {
pankso@12803 261 case "$ARCH" in
pankso@12803 262 arm)
pankso@12803 263 echo "Packing: ARM Kernel"
pankso@12803 264 cp -a $install/* $fs
pankso@12803 265 rm -f $fs/lib/modules/*/build $fs/lib/modules/*/source
pankso@12803 266 return 0 ;;
pankso@12803 267 x86_64)
pankso@12803 268 echo "TODO: use default or custom x86_64 packing"
pankso@12803 269 return 0 ;;
pankso@12803 270 esac
pankso@12803 271
pascal@12300 272 export PACKAGE VERSION
pascal@521 273 local path
pascal@7656 274 cp -a $_pkg/boot $fs
pankso@3 275 # Compress all modules.
pankso@12285 276 path=$fs/lib/modules/$KBASEVER-slitaz/kernel
pascal@521 277 mkdir -p $path
pankso@12285 278 cp -a $_pkg/lib/modules/$KBASEVER-slitaz/mo* \
pankso@12285 279 $fs/lib/modules/$KBASEVER-slitaz
pascal@14003 280 [ "$KBASEVER" != "$VERSION" ] &&
pascal@14003 281 ln -s $KBASEVER-slitaz $fs/lib/modules/$VERSION-slitaz
pankso@5640 282 # Get the base modules
pascal@886 283 export src
pascal@886 284 export _pkg
pankso@12285 285 mkdir -p $WOK/$PACKAGE/source/tmp
pascal@13577 286 # Warning stuff/list_modules.sh must find the generated modules.list
slaxemulator@9701 287 $stuff/list_modules.sh \
pankso@12285 288 $(cat $stuff/modules.list) > $WOK/$PACKAGE/source/tmp/modules.list
pankso@3864 289 while read module; do
pascal@521 290 dir=$(dirname $module)
pankso@535 291 [ -d $path/$dir ] || mkdir -p $path/$dir
pankso@12285 292 cp -a $_pkg/lib/modules/$KBASEVER-slitaz/kernel/$module $path/$dir
pankso@12285 293 done < $WOK/$PACKAGE/source/tmp/modules.list
pascal@397 294 # Remove unresolved links
pankso@12285 295 rm -f $fs/lib/modules/$KBASEVER-slitaz/build
pankso@12285 296 rm -f $fs/lib/modules/$KBASEVER-slitaz/source
pankso@12285 297 # Cook all packages with a kernel module
pascal@13937 298 for i in $(cd $WOK; grep -l 'cook linux$' */receipt)
pankso@12285 299 do
pascal@13937 300 echo cook ${i%/receipt}
pankso@12285 301 done
pankso@12285 302 # Fixed modules.dep to use right path
pankso@12285 303 # saves 100kb of space too
pankso@12285 304 sed -i "s|$_pkg||g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep
pankso@12285 305 sed -i "s|99.98.$KBASEVER-slitaz|$KBASEVER-slitaz|g" $fs/lib/modules/$KBASEVER-slitaz/modules.dep
pankso@12803 306 # Check and echo any module in kernel .config that's not added to
pankso@5640 307 # one of linux-* pkgs
pankso@12803 308 $stuff/check_modules.sh
pankso@3 309 }
pankso@3 310
pankso@3 311 # Pre and post install commands for Tazpkg.
pankso@3 312 post_install()
pankso@3 313 {
pascal@521 314 echo "Processing post-install commands..."
pankso@12803 315 case "$ARCH" in
pankso@12803 316 arm)
pankso@12803 317 echo "Kernel : /boot/linux-$VERSION-slitaz-$ARCH"
pankso@12803 318 echo "Modules: /lib/modules/$VERSION-slitaz"
pankso@12803 319 return 0 ;;
pankso@12803 320 esac
pankso@12285 321 chroot "$1/" depmod -a $KBASEVER-slitaz
pankso@5640 322 # GRUB stuff.
pankso@1154 323 if [ -f "$1/boot/grub/menu.lst" ]; then
border@13797 324 root_dev="/dev/`lsblk | grep '/$'| grep -o '[a-z]d[a-z][0-9]*'`" # current root device
border@13797 325 grub_part="$(( `echo $root_dev | grep -o '[0-9]*$'`-1 ))"
border@13797 326 grub_dev="`grep $(echo $root_dev | grep -o '^/dev/.d.' ) $1/boot/grub/device.map |\
border@13797 327 cut -f1 | sed "s/)$/.$grub_part)/g"`" # use device.map to find grub device number
border@13797 328
border@13797 329 # Add and clean kernel entrys in case of upgrade for installed system.
border@13797 330 if ! grep -q vmlinuz-$VERSION-slitaz $1/boot/grub/menu.lst; then
border@13797 331
border@13797 332 #clean the old entry
border@13797 333 # TODO somewhere, the old vmlinuz file is removed.
border@13797 334 # but the entry is still there. this cause a grub error:15 when selected
border@13797 335 # see http://bugs.slitaz.org/?id=74
border@13797 336
border@13797 337 #add the new
border@13797 338 cat >> $1/boot/grub/menu.lst << EOT
pankso@4056 339
pankso@4056 340 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
border@13754 341 $grub_dev
border@13754 342 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev quiet
pankso@4056 343 EOT
border@13754 344 # Make it the default entry
border@13754 345 last_entry=$(( $(grep -c '^title' $1/boot/grub/menu.lst)-1 ))
border@13754 346 sed -e "s/^default.*/default $last_entry/g" -i $1/boot/grub/menu.lst
pankso@4056 347 fi
pankso@4056 348 # Display information message.
border@13754 349 cat <<EOT
pankso@4056 350 ----
pankso@4056 351 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
pankso@1154 352
pankso@1154 353 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
pankso@1154 354 $grub_dev
pankso@4056 355 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
pascal@886 356 ----
pascal@886 357 EOT
pankso@1154 358 fi
pankso@3 359 }