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