wok-current annotate linux/receipt @ rev 16320
Up openssl (1.0.1g) with Heartbeat overflow fix
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Apr 09 20:47:43 2014 +0000 (2014-04-09) |
parents | 673b107f2fd7 |
children | 532076da08b9 |
rev | line source |
---|---|
pankso@3 | 1 # SliTaz package receipt. |
pankso@3 | 2 |
pankso@3 | 3 PACKAGE="linux" |
pascal@15670 | 4 VERSION="3.2.53" |
pankso@3 | 5 CATEGORY="base-system" |
pankso@3 | 6 SHORT_DESC="The Linux kernel and modules." |
pankso@3864 | 7 MAINTAINER="devel@slitaz.org" |
pascal@14657 | 8 LICENSE="GPL2" |
pankso@15855 | 9 TARBALL="$PACKAGE-$VERSION.tar.xz" |
pankso@3 | 10 WEB_SITE="http://www.kernel.org/" |
pascal@14234 | 11 WGET_URL="ftp://ftp.kernel.org/pub/linux/kernel/v3.0/$TARBALL" |
pankso@12803 | 12 HOST_ARCH="i486 arm x86_64" |
pankso@12803 | 13 |
pankso@15855 | 14 DEPENDS="kmod" |
pankso@15855 | 15 BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch kmod \ |
pascal@14754 | 16 uclibc-cross-compiler-x86_64 busybox-boot" |
pankso@12824 | 17 |
pankso@15855 | 18 # |
pankso@15855 | 19 # The Linux receipt handle cross compilation. For x86_64 we actually use |
pankso@15855 | 20 # the uclibc-cross-compiler-x86_64 and for ARM we use a real cross env. |
pankso@15855 | 21 # Please discuss any change and keep it simple, dont play with VERSION |
pankso@15855 | 22 # string or Kernel SUBLEVEL because depmod and Pankso dont like that! |
pankso@15855 | 23 # |
pankso@15855 | 24 # The receipt also handle some cook options for faster build: |
pankso@15855 | 25 # --nox64 : Skip the x86_64 cross compilation |
pankso@15855 | 26 # --nonomods : Skip bzImage without modules build |
pankso@15855 | 27 # |
pankso@12812 | 28 |
pankso@12803 | 29 # Aufs enable chroot |
pascal@14223 | 30 AUFS_NOT_RAMFS="uclibc-cross-compiler-x86_64 is not compatible with aufs+tmpfs 8(" |
pankso@3 | 31 |
pankso@12824 | 32 # Handle multiarch compilation. Less bdeps when cross-compiling for ARM |
pankso@12803 | 33 case "$ARCH" in |
pankso@15855 | 34 arm) BUILD_DEPENDS="xz" ;; |
pankso@12824 | 35 x86_64) BUILD_DEPENDS="xz" ;; |
pankso@12824 | 36 esac |
pankso@12824 | 37 |
pankso@15855 | 38 # Handle multiarch installation. ARM use Busybox modutils, so avoid any |
pankso@15855 | 39 # deps on kmod. SLITAZ_ARCH can have also custom post_install commands |
pankso@15921 | 40 if [ -f $root/etc/slitaz/slitaz.conf ]; then |
pankso@15921 | 41 . $root/etc/slitaz/slitaz.conf |
pankso@15921 | 42 case "$SLITAZ_ARCH" in |
pankso@15921 | 43 arm) DEPENDS="" ;; |
pankso@15921 | 44 esac |
pankso@15921 | 45 fi |
pankso@12824 | 46 |
pankso@3 | 47 # Rules to configure and make the package. |
pankso@3 | 48 compile_rules() |
pankso@3 | 49 { |
pankso@15921 | 50 if [ -f "/usr/share/boot/initrd" ]; then |
pankso@15921 | 51 cp /usr/share/boot/initrd initrd.cpio |
pankso@15921 | 52 fi |
pankso@12803 | 53 |
pankso@15855 | 54 # Handle cross compilation |
pankso@12803 | 55 case "$ARCH" in |
pankso@12803 | 56 arm) |
pankso@15855 | 57 echo "Compiling: $ARCH Kernel" |
pankso@12824 | 58 make mrproper |
pankso@12824 | 59 patch -Np1 < $stuff/$ARCH/linux-arm.patch || exit 1 |
pankso@12824 | 60 cp -f $stuff/$ARCH/linux-arm.config .config |
pascal@15733 | 61 yes '' | make ARCH=$ARCH oldconfig |
pankso@12803 | 62 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- bzImage && |
pankso@12803 | 63 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- modules && |
pankso@12803 | 64 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- \ |
pankso@12803 | 65 INSTALL_MOD_PATH=$DESTDIR modules_install && |
pankso@12803 | 66 mkdir -p $DESTDIR/boot && |
pankso@12824 | 67 cp -a arch/arm/boot/zImage \ |
pankso@12803 | 68 $DESTDIR/boot/linux-$VERSION-slitaz-$ARCH |
pankso@15921 | 69 #$stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz |
pankso@12803 | 70 return 0 ;; |
pankso@12803 | 71 x86_64) |
pankso@12803 | 72 echo "TODO: Maybe use default ? But cross compile in x86_64 chroot" |
pankso@12803 | 73 echo "so we can remove the 64 build by uclibc-cross-compiler-x86_64" |
pankso@12803 | 74 return 0 ;; |
pankso@12803 | 75 esac |
pankso@12803 | 76 |
pankso@15855 | 77 # Check for Aufs and get source/patches if needed |
pankso@9731 | 78 echo "Checking for Aufs packages..." |
pankso@15855 | 79 AUFSVER=$(grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g') |
pankso@15855 | 80 AUFSDIR="$WOK/aufs/source/aufs-${AUFSVER}" |
pankso@15855 | 81 if [ ! -d "$AUFSDIR" ]; then |
pankso@15855 | 82 [ ! -f "$SRC/aufs-${AUFSVER}.tar.bz2" ] && cook aufs --getsrc |
pankso@12288 | 83 mkdir -p $WOK/aufs/source/ |
pankso@15855 | 84 echo "Extracting: aufs-${AUFSVER}.tar.bz2" |
pankso@15855 | 85 tar xjf $SRC/aufs-${AUFSVER}.tar.bz2 -C $WOK/aufs/source/ |
pankso@9731 | 86 fi |
pankso@15855 | 87 |
pankso@12285 | 88 echo "cook:linux" > $command |
pankso@12285 | 89 |
pankso@9731 | 90 echo "Copying Aufs files and patches..." |
slaxemulator@7297 | 91 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src |
pankso@12285 | 92 cp -a $AUFSDIR/aufs3-*.patch $stuff |
pankso@12285 | 93 |
pankso@15855 | 94 # SliTaz db stuff |
pankso@15855 | 95 [ -d $WOK/$PACKAGE/source/slitaz ] && rm -rf $WOK/$PACKAGE/source/slitaz |
pankso@12285 | 96 mkdir -p $WOK/$PACKAGE/source/slitaz |
pankso@12290 | 97 echo "$WGET_URL" > $WOK/$PACKAGE/source/slitaz/url |
pankso@12285 | 98 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/source/slitaz |
pankso@12285 | 99 cp $stuff/bootloader.sh $WOK/$PACKAGE/source/slitaz |
pankso@12803 | 100 |
pankso@5640 | 101 # Apply patches |
pankso@9731 | 102 echo "Applying patches..." |
pascal@521 | 103 while read patch_file; do |
pankso@12285 | 104 echo "$patch_file" >> $WOK/$PACKAGE/source/slitaz/patches |
pankso@12285 | 105 cp $stuff/$patch_file $WOK/$PACKAGE/source/slitaz |
pascal@1442 | 106 if [ -f done.$patch_file ]; then |
pankso@15855 | 107 echo "Skipping $patch_file" && continue |
pascal@1442 | 108 fi |
pascal@521 | 109 echo "Apply $patch_file" |
pankso@15855 | 110 patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || return 1 |
pascal@1442 | 111 touch done.$patch_file |
pascal@521 | 112 done <<EOT |
pankso@12285 | 113 $PACKAGE-diff.u |
pankso@12285 | 114 $PACKAGE-header.u |
pankso@12285 | 115 $PACKAGE-freeinitrd.u |
pascal@14759 | 116 $PACKAGE-subroot.u |
pascal@15675 | 117 $PACKAGE-CVE-2013-2929.u |
pankso@12285 | 118 aufs3-base.patch |
pankso@12285 | 119 aufs3-standalone.patch |
pankso@12285 | 120 aufs3-loopback.patch |
mojo@15707 | 121 aufs3-mmap.patch |
pankso@12285 | 122 channel-negative-one-maxim.patch |
pankso@12285 | 123 mac80211.compat08082009.wl_frag+ack_v1.patch |
pascal@521 | 124 EOT |
pankso@15855 | 125 |
pankso@15855 | 126 # Mrproper and lguest |
pankso@15855 | 127 echo "Make kernel proper and then build lguest..." |
pankso@3864 | 128 make mrproper |
pankso@12285 | 129 cd Documentation/virtual/lguest |
pankso@15855 | 130 make lguest || return 1 |
pankso@15855 | 131 cd $src |
pankso@15855 | 132 |
pankso@15855 | 133 # |
pankso@15855 | 134 # Arch x86_64: TODO have a real cross environment |
pankso@15855 | 135 # |
pankso@15870 | 136 if [ ! "$nox64" ]; then |
pankso@15855 | 137 echo "Compiling: x86_64 Kernel" |
pankso@15855 | 138 |
pankso@15855 | 139 # Build bzImage64 without modules first |
pankso@15870 | 140 if [ ! "$nonomods" ]; then |
pankso@15855 | 141 cp -f $stuff/$PACKAGE-slitaz.config64 .config |
pankso@15855 | 142 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config |
pankso@15855 | 143 # We can't keep every driver in staging ??? |
pankso@15855 | 144 sed -i -e 's/^CONFIG_RTL8192/#&/' \ |
pankso@15855 | 145 -e 's/^CONFIG_R8187SE/#&/' \ |
pankso@15855 | 146 -e 's/^CONFIG_RT2870/#&/' .config |
pankso@15855 | 147 echo -e "\n* Configure bzImage64 without modules...\n" |
pankso@15855 | 148 yes '' | make ARCH=x86_64 oldconfig |
pankso@15855 | 149 echo -e "\n* Building bzImage64 without modules...\n" |
pankso@15855 | 150 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || exit 1 |
pankso@15855 | 151 [ -d $DESTDIR ] || mkdir -p $DESTDIR/linux64 |
pankso@15855 | 152 mv arch/x86/boot/bzImage $DESTDIR/linux64 |
pankso@15855 | 153 mv System.map System.map-without-modules64 |
pankso@15855 | 154 fi |
pankso@15855 | 155 |
pankso@15855 | 156 # Build bzImage64 with modules |
pankso@15855 | 157 cp -f $stuff/$PACKAGE-slitaz.config64 .config |
pankso@15855 | 158 echo -e "\n* Configure bzImage64 with modules...\n" |
pankso@15855 | 159 yes '' | make ARCH=x86_64 oldconfig |
pankso@15855 | 160 echo -e "\n* Building bzImage64 with modules...\n" |
pankso@15855 | 161 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage && |
pankso@15855 | 162 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- modules && |
pankso@15855 | 163 make ARCH=x86_64 INSTALL_MOD_PATH=$DESTDIR/linux64 modules_install && |
pankso@15855 | 164 make ARCH=x86_64 INSTALL_HDR_PATH=$DESTDIR/linux64/usr headers_install && |
pankso@15855 | 165 ln .config $WOK/$PACKAGE/source/slitaz/config64 |
pankso@15855 | 166 [ -s arch/x86/boot/bzImage ] || return 1 |
pankso@15855 | 167 mkdir -p $DESTDIR/linux64/boot 2> /dev/null |
pankso@15855 | 168 mv arch/x86/boot/bzImage $DESTDIR/linux64/boot/vmlinuz-$VERSION-slitaz |
pankso@15855 | 169 ln System.map System.map-modules64 |
pankso@15855 | 170 ln Module.symvers Module.symvers-modules64 |
pankso@15855 | 171 else |
pankso@15855 | 172 echo "* Skipping: x86_64 Kernel..." |
pankso@12285 | 173 fi |
pankso@15855 | 174 |
pankso@12294 | 175 # |
pankso@15855 | 176 # Linux Arch i386 - GCC arch i486 |
pankso@12294 | 177 # |
pankso@15855 | 178 echo "Compiling: i386 Kernel..." |
pankso@12803 | 179 |
pankso@12294 | 180 # Build bzImage without modules first |
pankso@15870 | 181 if [ ! "$nonomods" ]; then |
pankso@15855 | 182 cp -f $stuff/$PACKAGE-slitaz.config .config |
pankso@15855 | 183 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config |
pankso@15855 | 184 # We can't keep every driver in staging ??? |
pankso@15855 | 185 sed -i -e 's/^CONFIG_RTL8192/#&/' \ |
pankso@15855 | 186 -e 's/^CONFIG_R8187SE/#&/' \ |
pankso@15855 | 187 -e 's/^CONFIG_RT2870/#&/' .config |
pankso@15855 | 188 echo -e "\n* Configure bzImage without modules...\n" |
pankso@15855 | 189 yes '' | make ARCH=i386 oldconfig |
pankso@15855 | 190 echo -e "\n* Building bzImage without modules...\n" |
pascal@15670 | 191 make ARCH=i386 -j 4 bzImage || exit 1 |
pankso@15855 | 192 [ -d $DESTDIR ] || mkdir -p $DESTDIR |
pankso@15855 | 193 mv arch/x86/boot/bzImage $DESTDIR |
pankso@15855 | 194 mv System.map System.map-without-modules |
pankso@12294 | 195 fi |
pankso@15855 | 196 |
pankso@12294 | 197 # Build bzImage with modules |
pankso@12294 | 198 cp -f $stuff/$PACKAGE-slitaz.config .config |
pankso@15855 | 199 echo -e "\n* Configure bzImage with modules...\n" |
pascal@15733 | 200 yes '' | make ARCH=i386 oldconfig |
pankso@12294 | 201 ln .config $WOK/$PACKAGE/source/slitaz/config |
pankso@15855 | 202 echo -e "\n* Building bzImage with modules...\n" |
pascal@15670 | 203 make ARCH=i386 -j 4 bzImage && |
pascal@15670 | 204 make ARCH=i386 -j 4 modules && |
pascal@15670 | 205 make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR modules_install && |
pascal@15670 | 206 make ARCH=i386 INSTALL_HDR_PATH=$DESTDIR/usr headers_install && |
pankso@15855 | 207 [ -s arch/x86/boot/bzImage ] || return 1 |
pankso@12294 | 208 mkdir -p $DESTDIR/boot 2> /dev/null |
pankso@12294 | 209 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz |
pankso@15855 | 210 |
slaxemulator@6719 | 211 # Compress all modules. |
pankso@15855 | 212 if [ -d "$DESTDIR/lib/modules/$VERSION-slitaz" ]; then |
pankso@15855 | 213 $stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz |
pankso@15855 | 214 else |
pankso@15855 | 215 return 1 |
pankso@15855 | 216 fi |
pankso@15855 | 217 if [ -d "$DESTDIR/linux64/lib/modules/$VERSION-slitaz" ]; then |
pankso@15855 | 218 $stuff/gztazmod.sh $DESTDIR/linux64/lib/modules/$VERSION-slitaz |
pankso@15855 | 219 fi |
pascal@7667 | 220 ln System.map System.map-modules |
pascal@7667 | 221 ln Module.symvers Module.symvers-modules |
pankso@3864 | 222 } |
erjo@253 | 223 |
pankso@3 | 224 # Rules to gen a SliTaz package suitable for Tazpkg. |
pankso@3 | 225 genpkg_rules() |
pankso@3 | 226 { |
pankso@12803 | 227 case "$ARCH" in |
pankso@12803 | 228 arm) |
pankso@12803 | 229 echo "Packing: ARM Kernel" |
pankso@12803 | 230 cp -a $install/* $fs |
pankso@12803 | 231 rm -f $fs/lib/modules/*/build $fs/lib/modules/*/source |
pankso@12803 | 232 return 0 ;; |
pankso@12803 | 233 x86_64) |
pankso@12803 | 234 echo "TODO: use default or custom x86_64 packing" |
pankso@12803 | 235 return 0 ;; |
pankso@12803 | 236 esac |
pankso@12803 | 237 |
pascal@12300 | 238 export PACKAGE VERSION |
pascal@521 | 239 local path |
pascal@15603 | 240 cp -a $install/boot $fs |
pankso@15855 | 241 |
pankso@3 | 242 # Compress all modules. |
pankso@15855 | 243 path=$fs/lib/modules/$VERSION-slitaz/kernel |
pascal@521 | 244 mkdir -p $path |
pankso@15855 | 245 |
pankso@5640 | 246 # Get the base modules |
pankso@15855 | 247 export src install |
pankso@12285 | 248 mkdir -p $WOK/$PACKAGE/source/tmp |
pascal@13577 | 249 # Warning stuff/list_modules.sh must find the generated modules.list |
slaxemulator@9701 | 250 $stuff/list_modules.sh \ |
pankso@15855 | 251 $(cat $stuff/modules.list) > $WOK/$PACKAGE/source/tmp/modules.list |
pankso@3864 | 252 while read module; do |
pascal@521 | 253 dir=$(dirname $module) |
pankso@535 | 254 [ -d $path/$dir ] || mkdir -p $path/$dir |
pankso@15855 | 255 cp -a $install/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir |
pankso@12285 | 256 done < $WOK/$PACKAGE/source/tmp/modules.list |
pankso@15855 | 257 |
pascal@397 | 258 # Remove unresolved links |
pankso@15855 | 259 rm -f $fs/lib/modules/$VERSION-slitaz/build |
pankso@15855 | 260 rm -f $fs/lib/modules/$VERSION-slitaz/source |
pankso@15855 | 261 |
pankso@15855 | 262 # We only need module.{order,builtin} because other map files are |
pankso@15855 | 263 # generated by depmod in post_install |
pankso@15855 | 264 cp -a $install/lib/modules/$VERSION-slitaz/modules.order \ |
pankso@15855 | 265 $install/lib/modules/$VERSION-slitaz/modules.builtin \ |
pankso@15855 | 266 $fs/lib/modules/$VERSION-slitaz |
pankso@15855 | 267 |
pankso@15855 | 268 # Pack all packages with a kernel module |
pankso@15855 | 269 for i in $(cd $WOK; grep -l '^WANTED="linux"' */receipt) |
pankso@12285 | 270 do |
pankso@15855 | 271 [ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1 |
pankso@15855 | 272 cook ${i%/receipt} |
pankso@12285 | 273 done |
pankso@15855 | 274 |
pankso@15855 | 275 # Check any module in kernel .config that's not added to a linux-* pkgs |
pankso@15855 | 276 # and remove aufs patches: we dont need them in HG wok. |
pankso@15855 | 277 $stuff/check_modules.sh |
pankso@15855 | 278 rm -f $stuff/aufs3-* |
pankso@3 | 279 } |
pankso@3 | 280 |
pankso@3 | 281 # Pre and post install commands for Tazpkg. |
pankso@3 | 282 post_install() |
pankso@3 | 283 { |
pascal@521 | 284 echo "Processing post-install commands..." |
pankso@15855 | 285 chroot "$root/" depmod -a $VERSION-slitaz |
pankso@15855 | 286 |
pankso@15855 | 287 # Handle multiarch installation |
pankso@15855 | 288 case "$SLITAZ_ARCH" in |
pankso@12803 | 289 arm) |
pankso@12803 | 290 echo "Kernel : /boot/linux-$VERSION-slitaz-$ARCH" |
pankso@12803 | 291 echo "Modules: /lib/modules/$VERSION-slitaz" |
pankso@12803 | 292 return 0 ;; |
pankso@12803 | 293 esac |
pankso@15855 | 294 |
pankso@15855 | 295 # GRUB stuff. |
pankso@15855 | 296 if [ -f "$1/boot/grub/menu.lst" ]; then |
pankso@15855 | 297 # Current root device |
pankso@15855 | 298 root_dev="/dev/$(lsblk | grep '/$'| grep -o '[a-z]d[a-z][0-9]*')" |
pankso@15855 | 299 grub_part="$(( $(echo $root_dev | grep -o '[0-9]*$')-1 ))" |
pankso@15855 | 300 # Use device.map to find grub device number |
pankso@15855 | 301 grub_dev="$(grep $(echo $root_dev | grep -o '^/dev/.d.' ) \ |
pankso@15855 | 302 $1/boot/grub/device.map | cut -f1 | sed "s/)$/.$grub_part)/g")" |
border@13797 | 303 |
pankso@15855 | 304 # Add and clean kernel entries in case of upgrade for installed system. |
pankso@15855 | 305 if ! grep -q vmlinuz-$VERSION-slitaz $1/boot/grub/menu.lst; then |
border@13797 | 306 |
pankso@15855 | 307 # Clean the old entry |
pankso@15855 | 308 # TODO: old vmlinuz file is removed but the entry is still there. |
pankso@15855 | 309 # So grub error:15 when selected: http://bugs.slitaz.org/?id=74 |
border@13797 | 310 |
pankso@15855 | 311 # Add the new entry |
pankso@15855 | 312 cat >> $1/boot/grub/menu.lst << EOT |
pankso@4056 | 313 |
pankso@4056 | 314 title SliTaz GNU/Linux (Kernel $VERSION-slitaz) |
border@13754 | 315 $grub_dev |
border@13754 | 316 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev quiet |
pankso@4056 | 317 EOT |
border@13754 | 318 # Make it the default entry |
border@13754 | 319 last_entry=$(( $(grep -c '^title' $1/boot/grub/menu.lst)-1 )) |
border@13754 | 320 sed -e "s/^default.*/default $last_entry/g" -i $1/boot/grub/menu.lst |
pankso@4056 | 321 fi |
pankso@15855 | 322 |
pankso@4056 | 323 # Display information message. |
pankso@15855 | 324 cat <<EOT |
pankso@4056 | 325 ---- |
pankso@4056 | 326 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst: |
pankso@1154 | 327 |
pankso@1154 | 328 title SliTaz GNU/Linux (Kernel $VERSION-slitaz) |
pankso@1154 | 329 $grub_dev |
pankso@4056 | 330 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev |
pascal@886 | 331 ---- |
pascal@886 | 332 EOT |
pankso@1154 | 333 fi |
pankso@3 | 334 } |