wok annotate linux/receipt @ rev 17267
Add linux-romfs
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Oct 23 18:05:56 2014 +0200 (2014-10-23) |
parents | 765487dd22da |
children | d06c0bbee2d8 |
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@17029 | 16 uclibc-cross-compiler-x86_64" |
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 |
pascal@17267 | 118 $PACKAGE-romfs.u |
pankso@12285 | 119 aufs3-base.patch |
pankso@12285 | 120 aufs3-standalone.patch |
pankso@12285 | 121 aufs3-loopback.patch |
mojo@15707 | 122 aufs3-mmap.patch |
pankso@12285 | 123 channel-negative-one-maxim.patch |
pankso@12285 | 124 mac80211.compat08082009.wl_frag+ack_v1.patch |
pascal@521 | 125 EOT |
pankso@15855 | 126 |
pankso@15855 | 127 # Mrproper and lguest |
pankso@15855 | 128 echo "Make kernel proper and then build lguest..." |
pankso@3864 | 129 make mrproper |
pankso@12285 | 130 cd Documentation/virtual/lguest |
pankso@15855 | 131 make lguest || return 1 |
pankso@15855 | 132 cd $src |
pankso@15855 | 133 |
pankso@15855 | 134 # |
pankso@15855 | 135 # Arch x86_64: TODO have a real cross environment |
pankso@15855 | 136 # |
pankso@15870 | 137 if [ ! "$nox64" ]; then |
pankso@15855 | 138 echo "Compiling: x86_64 Kernel" |
pankso@15855 | 139 |
pankso@15855 | 140 # Build bzImage64 without modules first |
pankso@15870 | 141 if [ ! "$nonomods" ]; then |
pankso@15855 | 142 cp -f $stuff/$PACKAGE-slitaz.config64 .config |
pankso@15855 | 143 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config |
pankso@15855 | 144 # We can't keep every driver in staging ??? |
pankso@15855 | 145 sed -i -e 's/^CONFIG_RTL8192/#&/' \ |
pankso@15855 | 146 -e 's/^CONFIG_R8187SE/#&/' \ |
pankso@15855 | 147 -e 's/^CONFIG_RT2870/#&/' .config |
pankso@15855 | 148 echo -e "\n* Configure bzImage64 without modules...\n" |
pankso@15855 | 149 yes '' | make ARCH=x86_64 oldconfig |
pankso@15855 | 150 echo -e "\n* Building bzImage64 without modules...\n" |
pankso@15855 | 151 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || exit 1 |
pankso@15855 | 152 [ -d $DESTDIR ] || mkdir -p $DESTDIR/linux64 |
pankso@15855 | 153 mv arch/x86/boot/bzImage $DESTDIR/linux64 |
pankso@15855 | 154 mv System.map System.map-without-modules64 |
pankso@15855 | 155 fi |
pankso@15855 | 156 |
pankso@15855 | 157 # Build bzImage64 with modules |
pankso@15855 | 158 cp -f $stuff/$PACKAGE-slitaz.config64 .config |
pankso@15855 | 159 echo -e "\n* Configure bzImage64 with modules...\n" |
pankso@15855 | 160 yes '' | make ARCH=x86_64 oldconfig |
pankso@15855 | 161 echo -e "\n* Building bzImage64 with modules...\n" |
pankso@15855 | 162 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage && |
pankso@15855 | 163 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- modules && |
pankso@15855 | 164 make ARCH=x86_64 INSTALL_MOD_PATH=$DESTDIR/linux64 modules_install && |
pankso@15855 | 165 make ARCH=x86_64 INSTALL_HDR_PATH=$DESTDIR/linux64/usr headers_install && |
pankso@15855 | 166 ln .config $WOK/$PACKAGE/source/slitaz/config64 |
pankso@15855 | 167 [ -s arch/x86/boot/bzImage ] || return 1 |
pankso@15855 | 168 mkdir -p $DESTDIR/linux64/boot 2> /dev/null |
pascal@17031 | 169 mv arch/x86/boot/bzImage $DESTDIR/linux64/boot/vmlinuz-$VERSION-slitaz64 |
pankso@15855 | 170 ln System.map System.map-modules64 |
pankso@15855 | 171 ln Module.symvers Module.symvers-modules64 |
pankso@15855 | 172 else |
pankso@15855 | 173 echo "* Skipping: x86_64 Kernel..." |
pankso@12285 | 174 fi |
pankso@15855 | 175 |
pankso@12294 | 176 # |
pankso@15855 | 177 # Linux Arch i386 - GCC arch i486 |
pankso@12294 | 178 # |
pankso@15855 | 179 echo "Compiling: i386 Kernel..." |
pankso@12803 | 180 |
pankso@12294 | 181 # Build bzImage without modules first |
pankso@15870 | 182 if [ ! "$nonomods" ]; then |
pankso@15855 | 183 cp -f $stuff/$PACKAGE-slitaz.config .config |
pankso@15855 | 184 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config |
pankso@15855 | 185 # We can't keep every driver in staging ??? |
pankso@15855 | 186 sed -i -e 's/^CONFIG_RTL8192/#&/' \ |
pankso@15855 | 187 -e 's/^CONFIG_R8187SE/#&/' \ |
pankso@15855 | 188 -e 's/^CONFIG_RT2870/#&/' .config |
pankso@15855 | 189 echo -e "\n* Configure bzImage without modules...\n" |
pankso@15855 | 190 yes '' | make ARCH=i386 oldconfig |
pankso@15855 | 191 echo -e "\n* Building bzImage without modules...\n" |
pascal@15670 | 192 make ARCH=i386 -j 4 bzImage || exit 1 |
pankso@15855 | 193 [ -d $DESTDIR ] || mkdir -p $DESTDIR |
pankso@15855 | 194 mv arch/x86/boot/bzImage $DESTDIR |
pankso@15855 | 195 mv System.map System.map-without-modules |
pankso@12294 | 196 fi |
pankso@15855 | 197 |
pankso@12294 | 198 # Build bzImage with modules |
pankso@12294 | 199 cp -f $stuff/$PACKAGE-slitaz.config .config |
pankso@15855 | 200 echo -e "\n* Configure bzImage with modules...\n" |
pascal@15733 | 201 yes '' | make ARCH=i386 oldconfig |
pankso@12294 | 202 ln .config $WOK/$PACKAGE/source/slitaz/config |
pankso@15855 | 203 echo -e "\n* Building bzImage with modules...\n" |
pascal@15670 | 204 make ARCH=i386 -j 4 bzImage && |
pascal@15670 | 205 make ARCH=i386 -j 4 modules && |
pascal@15670 | 206 make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR modules_install && |
pascal@15670 | 207 make ARCH=i386 INSTALL_HDR_PATH=$DESTDIR/usr headers_install && |
pankso@15855 | 208 [ -s arch/x86/boot/bzImage ] || return 1 |
pankso@12294 | 209 mkdir -p $DESTDIR/boot 2> /dev/null |
pankso@12294 | 210 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz |
pankso@15855 | 211 |
slaxemulator@6719 | 212 # Compress all modules. |
pankso@15855 | 213 if [ -d "$DESTDIR/lib/modules/$VERSION-slitaz" ]; then |
pankso@15855 | 214 $stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz |
pankso@15855 | 215 else |
pankso@15855 | 216 return 1 |
pankso@15855 | 217 fi |
pascal@17031 | 218 if [ -d "$DESTDIR/linux64/lib/modules/$VERSION-slitaz64" ]; then |
pascal@17031 | 219 $stuff/gztazmod.sh $DESTDIR/linux64/lib/modules/$VERSION-slitaz64 |
pankso@15855 | 220 fi |
pascal@7667 | 221 ln System.map System.map-modules |
pascal@7667 | 222 ln Module.symvers Module.symvers-modules |
pankso@3864 | 223 } |
erjo@253 | 224 |
pankso@3 | 225 # Rules to gen a SliTaz package suitable for Tazpkg. |
pankso@3 | 226 genpkg_rules() |
pankso@3 | 227 { |
pankso@12803 | 228 case "$ARCH" in |
pankso@12803 | 229 arm) |
pankso@12803 | 230 echo "Packing: ARM Kernel" |
pankso@12803 | 231 cp -a $install/* $fs |
pankso@12803 | 232 rm -f $fs/lib/modules/*/build $fs/lib/modules/*/source |
pankso@12803 | 233 return 0 ;; |
pankso@12803 | 234 x86_64) |
pankso@12803 | 235 echo "TODO: use default or custom x86_64 packing" |
pankso@12803 | 236 return 0 ;; |
pankso@12803 | 237 esac |
pankso@12803 | 238 |
pascal@12300 | 239 export PACKAGE VERSION |
pascal@521 | 240 local path |
pascal@15603 | 241 cp -a $install/boot $fs |
pankso@15855 | 242 |
pankso@3 | 243 # Compress all modules. |
pankso@15855 | 244 path=$fs/lib/modules/$VERSION-slitaz/kernel |
pascal@521 | 245 mkdir -p $path |
pankso@15855 | 246 |
pankso@5640 | 247 # Get the base modules |
pankso@15855 | 248 export src install |
pankso@12285 | 249 mkdir -p $WOK/$PACKAGE/source/tmp |
pascal@13577 | 250 # Warning stuff/list_modules.sh must find the generated modules.list |
slaxemulator@9701 | 251 $stuff/list_modules.sh \ |
pankso@15855 | 252 $(cat $stuff/modules.list) > $WOK/$PACKAGE/source/tmp/modules.list |
pankso@3864 | 253 while read module; do |
pascal@521 | 254 dir=$(dirname $module) |
pankso@535 | 255 [ -d $path/$dir ] || mkdir -p $path/$dir |
pankso@15855 | 256 cp -a $install/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir |
pankso@12285 | 257 done < $WOK/$PACKAGE/source/tmp/modules.list |
pankso@15855 | 258 |
pascal@397 | 259 # Remove unresolved links |
pankso@15855 | 260 rm -f $fs/lib/modules/$VERSION-slitaz/build |
pankso@15855 | 261 rm -f $fs/lib/modules/$VERSION-slitaz/source |
pankso@15855 | 262 |
pankso@15855 | 263 # We only need module.{order,builtin} because other map files are |
pankso@15855 | 264 # generated by depmod in post_install |
pankso@15855 | 265 cp -a $install/lib/modules/$VERSION-slitaz/modules.order \ |
pankso@15855 | 266 $install/lib/modules/$VERSION-slitaz/modules.builtin \ |
pankso@15855 | 267 $fs/lib/modules/$VERSION-slitaz |
pankso@15855 | 268 |
pankso@15855 | 269 # Pack all packages with a kernel module |
pankso@15855 | 270 for i in $(cd $WOK; grep -l '^WANTED="linux"' */receipt) |
pankso@12285 | 271 do |
pankso@15855 | 272 [ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1 |
pankso@15855 | 273 cook ${i%/receipt} |
pankso@12285 | 274 done |
pankso@15855 | 275 |
pankso@15855 | 276 # Check any module in kernel .config that's not added to a linux-* pkgs |
pankso@15855 | 277 # and remove aufs patches: we dont need them in HG wok. |
pankso@15855 | 278 $stuff/check_modules.sh |
pankso@15855 | 279 rm -f $stuff/aufs3-* |
pankso@3 | 280 } |
pankso@3 | 281 |
pankso@3 | 282 # Pre and post install commands for Tazpkg. |
pankso@3 | 283 post_install() |
pankso@3 | 284 { |
pascal@521 | 285 echo "Processing post-install commands..." |
pankso@15855 | 286 chroot "$root/" depmod -a $VERSION-slitaz |
pankso@15855 | 287 |
pankso@15855 | 288 # Handle multiarch installation |
pankso@15855 | 289 case "$SLITAZ_ARCH" in |
pankso@12803 | 290 arm) |
pankso@12803 | 291 echo "Kernel : /boot/linux-$VERSION-slitaz-$ARCH" |
pankso@12803 | 292 echo "Modules: /lib/modules/$VERSION-slitaz" |
pankso@12803 | 293 return 0 ;; |
pankso@12803 | 294 esac |
pankso@15855 | 295 |
pankso@15855 | 296 # GRUB stuff. |
pankso@15855 | 297 if [ -f "$1/boot/grub/menu.lst" ]; then |
pankso@15855 | 298 # Current root device |
pankso@15855 | 299 root_dev="/dev/$(lsblk | grep '/$'| grep -o '[a-z]d[a-z][0-9]*')" |
pankso@15855 | 300 grub_part="$(( $(echo $root_dev | grep -o '[0-9]*$')-1 ))" |
pankso@15855 | 301 # Use device.map to find grub device number |
pankso@15855 | 302 grub_dev="$(grep $(echo $root_dev | grep -o '^/dev/.d.' ) \ |
pankso@15855 | 303 $1/boot/grub/device.map | cut -f1 | sed "s/)$/.$grub_part)/g")" |
border@13797 | 304 |
pankso@15855 | 305 # Add and clean kernel entries in case of upgrade for installed system. |
pankso@15855 | 306 if ! grep -q vmlinuz-$VERSION-slitaz $1/boot/grub/menu.lst; then |
border@13797 | 307 |
pankso@15855 | 308 # Clean the old entry |
pankso@15855 | 309 # TODO: old vmlinuz file is removed but the entry is still there. |
pankso@15855 | 310 # So grub error:15 when selected: http://bugs.slitaz.org/?id=74 |
border@13797 | 311 |
pankso@15855 | 312 # Add the new entry |
pankso@15855 | 313 cat >> $1/boot/grub/menu.lst << EOT |
pankso@4056 | 314 |
pankso@4056 | 315 title SliTaz GNU/Linux (Kernel $VERSION-slitaz) |
border@13754 | 316 $grub_dev |
border@13754 | 317 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev quiet |
pankso@4056 | 318 EOT |
border@13754 | 319 # Make it the default entry |
border@13754 | 320 last_entry=$(( $(grep -c '^title' $1/boot/grub/menu.lst)-1 )) |
border@13754 | 321 sed -e "s/^default.*/default $last_entry/g" -i $1/boot/grub/menu.lst |
pankso@4056 | 322 fi |
pankso@15855 | 323 |
pankso@4056 | 324 # Display information message. |
pankso@15855 | 325 cat <<EOT |
pankso@4056 | 326 ---- |
pankso@4056 | 327 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst: |
pankso@1154 | 328 |
pankso@1154 | 329 title SliTaz GNU/Linux (Kernel $VERSION-slitaz) |
pankso@1154 | 330 $grub_dev |
pankso@4056 | 331 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev |
pascal@886 | 332 ---- |
pascal@886 | 333 EOT |
pankso@1154 | 334 fi |
pankso@3 | 335 } |