wok-next annotate linux/receipt @ rev 19595
Up linux (4.9.4)
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Sat Jan 21 17:27:31 2017 +0200 (2017-01-21) |
parents | 5534f89ab5ad |
children | b53ebb2699ba |
rev | line source |
---|---|
pankso@3 | 1 # SliTaz package receipt. |
pankso@3 | 2 |
pankso@3 | 3 PACKAGE="linux" |
al@19595 | 4 VERSION="4.9.4" |
al@19595 | 5 KBASEVER="4.9" |
pankso@3 | 6 CATEGORY="base-system" |
al@19583 | 7 SHORT_DESC="The Linux Kernel and modules" |
pankso@3864 | 8 MAINTAINER="devel@slitaz.org" |
pascal@14657 | 9 LICENSE="GPL2" |
al@19583 | 10 WEB_SITE="https://www.kernel.org/" |
pankso@12803 | 11 HOST_ARCH="i486 arm x86_64" |
pankso@12803 | 12 |
al@19595 | 13 TARBALL="$PACKAGE-$KBASEVER.tar.xz" |
al@19583 | 14 WGET_URL="https://www.kernel.org/pub/linux/kernel/v4.x/$TARBALL" |
al@19583 | 15 |
pankso@15855 | 16 DEPENDS="kmod" |
al@19595 | 17 BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch kmod bc" |
al@19583 | 18 SPLIT="lguest linux-acpi linux-agp linux-aoe linux-appletalk linux-arcnet \ |
al@19595 | 19 linux-autofs linux-bluetooth linux-bridge linux-btrfs linux-cifs linux-coda \ |
al@19583 | 20 linux-cpufreq linux-cramfs linux-crypto linux-cryptoloop linux-dialup \ |
al@19595 | 21 linux-dlm linux-drm linux-ecryptfs linux-efi linux-ethernet linux-exofs \ |
al@19595 | 22 linux-firewire linux-firmware linux-gfs2 linux-hfs linux-hfsplus linux-hid \ |
al@19595 | 23 linux-hwmon linux-ide linux-input-misc linux-input-tablet \ |
al@19583 | 24 linux-input-touchscreen linux-ipv6 linux-irda linux-isdn linux-jfs \ |
al@19583 | 25 linux-joystick linux-kvm linux-logfs linux-md linux-media linux-memstick \ |
al@19583 | 26 linux-minix linux-mmc linux-module-headers linux-mwave linux-nbd linux-ncpfs \ |
al@19595 | 27 linux-netfilter linux-nfc linux-nfs linux-nfsd linux-ocfs2 linux-orangefs \ |
al@19595 | 28 linux-radio linux-reiserfs linux-romfs linux-sched linux-scsi linux-sound \ |
al@19595 | 29 linux-source linux-speakup linux-squashfs linux-staging linux-toshiba \ |
al@19595 | 30 linux-usb-gadget linux-usb-misc linux-usbdsl linux-usbip linux-uwb linux-video \ |
al@19595 | 31 linux-wan linux-watchdog linux-wimax linux-wireless linux-without-modules \ |
al@19595 | 32 linux-zram" |
al@19595 | 33 SIBLINGS="linux-api-headers linux-dev linux-man" |
al@19595 | 34 |
al@19595 | 35 if [ "$KBASEVER" != "${VERSION%.0}" ]; then |
al@19595 | 36 PATCH="$(dirname $WGET_URL)/patch-$VERSION.xz" |
al@19595 | 37 EXTRA_SOURCE_FILES="$(basename $PATCH)" |
al@19595 | 38 fi |
pankso@12824 | 39 |
pankso@15855 | 40 # |
pankso@15855 | 41 # The Linux receipt handle cross compilation. For x86_64 we actually use |
pankso@15855 | 42 # the uclibc-cross-compiler-x86_64 and for ARM we use a real cross env. |
al@19583 | 43 # Please discuss any change and keep it simple, don't play with VERSION |
al@19583 | 44 # string or Kernel SUBLEVEL because depmod and Pankso don't like that! |
pankso@15855 | 45 # |
al@19583 | 46 # The receipt also handle some cook options for faster build: |
pankso@15855 | 47 # --nonomods : Skip bzImage without modules build |
pankso@15855 | 48 # |
pankso@3 | 49 |
pankso@12824 | 50 # Handle multiarch compilation. Less bdeps when cross-compiling for ARM |
pankso@12803 | 51 case "$ARCH" in |
al@19595 | 52 arm) BUILD_DEPENDS="xz" ;; |
pankso@12824 | 53 x86_64) BUILD_DEPENDS="xz" ;; |
pankso@12824 | 54 esac |
pankso@12824 | 55 |
pankso@15855 | 56 # Handle multiarch installation. ARM use Busybox modutils, so avoid any |
pankso@15855 | 57 # deps on kmod. SLITAZ_ARCH can have also custom post_install commands |
pankso@15921 | 58 if [ -f $root/etc/slitaz/slitaz.conf ]; then |
pankso@15921 | 59 . $root/etc/slitaz/slitaz.conf |
pankso@15921 | 60 case "$SLITAZ_ARCH" in |
pankso@15921 | 61 arm) DEPENDS="" ;; |
pankso@15921 | 62 esac |
pankso@15921 | 63 fi |
pankso@12824 | 64 |
pankso@3 | 65 # Rules to configure and make the package. |
pankso@3 | 66 compile_rules() |
pankso@3 | 67 { |
al@19595 | 68 # Update sources to the $VERSION using base sources ($KBASEVER) and patch |
al@19595 | 69 if [ "$KBASEVER" != "${VERSION%.0}" ]; then |
al@19595 | 70 [ -s $SRC/$(basename $PATCH) ] || wget $PATCH -O $SRC/$(basename $PATCH) |
al@19595 | 71 # don't patch twice for `cook $PACKAGE --continue` |
al@19595 | 72 if [ ! -f "done.patch-$VERSION" ]; then |
al@19595 | 73 xzcat $SRC/$(basename $PATCH) | patch -Np1 |
al@19595 | 74 touch done.patch-$VERSION |
al@19595 | 75 fi |
al@19595 | 76 fi |
al@19595 | 77 |
al@19595 | 78 # |
pankso@15921 | 79 if [ -f "/usr/share/boot/initrd" ]; then |
pankso@15921 | 80 cp /usr/share/boot/initrd initrd.cpio |
pankso@15921 | 81 fi |
pankso@12803 | 82 |
pankso@15855 | 83 # Handle cross compilation |
pankso@12803 | 84 case "$ARCH" in |
pankso@12803 | 85 arm) |
pankso@15855 | 86 echo "Compiling: $ARCH Kernel" |
pankso@12824 | 87 make mrproper |
pankso@12824 | 88 patch -Np1 < $stuff/$ARCH/linux-arm.patch || exit 1 |
pankso@12824 | 89 cp -f $stuff/$ARCH/linux-arm.config .config |
pascal@15733 | 90 yes '' | make ARCH=$ARCH oldconfig |
pankso@12803 | 91 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- bzImage && |
pankso@12803 | 92 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- modules && |
pankso@12803 | 93 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- \ |
pankso@12803 | 94 INSTALL_MOD_PATH=$DESTDIR modules_install && |
pankso@12803 | 95 mkdir -p $DESTDIR/boot && |
pankso@12824 | 96 cp -a arch/arm/boot/zImage \ |
pankso@12803 | 97 $DESTDIR/boot/linux-$VERSION-slitaz-$ARCH |
al@19595 | 98 #$stuff/tools/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz |
pankso@12803 | 99 return 0 ;; |
pankso@12803 | 100 x86_64) |
al@19583 | 101 echo "TODO: Maybe use default? But cross compile in x86_64 chroot" |
pankso@12803 | 102 echo "so we can remove the 64 build by uclibc-cross-compiler-x86_64" |
pankso@12803 | 103 return 0 ;; |
pankso@12803 | 104 esac |
pankso@12803 | 105 |
al@19595 | 106 # Get and apply Aufs patches |
al@19595 | 107 . $stuff/tools/aufs-patches |
al@19583 | 108 |
pankso@12285 | 109 echo "cook:linux" > $command |
pankso@12285 | 110 |
al@19595 | 111 # Apply misc patches |
pankso@9731 | 112 echo "Applying patches..." |
pascal@521 | 113 while read patch_file; do |
pascal@1442 | 114 if [ -f done.$patch_file ]; then |
al@19583 | 115 echo "Skipping $patch_file"; continue |
pascal@1442 | 116 fi |
al@19583 | 117 echo -e "\nApply $patch_file" |
al@19595 | 118 patch -p1 -i $stuff/patches/$patch_file || return 1 |
pascal@1442 | 119 touch done.$patch_file |
al@19595 | 120 done < $stuff/patches/patch.order |
al@19583 | 121 |
pankso@15855 | 122 # Mrproper and lguest |
al@19583 | 123 echo "Making kernel proper and then build lguest..." |
pankso@3864 | 124 make mrproper |
al@19583 | 125 cd tools/lguest |
pankso@15855 | 126 make lguest || return 1 |
pankso@15855 | 127 cd $src |
al@19583 | 128 |
pankso@15855 | 129 # |
pankso@15855 | 130 # Linux Arch i386 - GCC arch i486 |
pankso@12294 | 131 # |
al@19583 | 132 echo "Making x86 Kernel..." |
pankso@12803 | 133 |
pankso@12294 | 134 # Build bzImage without modules first |
al@19583 | 135 if [ -z "$nonomods" ]; then |
pankso@15855 | 136 cp -f $stuff/$PACKAGE-slitaz.config .config |
pankso@15855 | 137 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config |
al@19583 | 138 # We can't keep every driver in staging??? |
al@19595 | 139 sed -i \ |
al@19595 | 140 -e 's/^CONFIG_RTL8192/#&/' \ |
pankso@15855 | 141 -e 's/^CONFIG_R8187SE/#&/' \ |
pankso@15855 | 142 -e 's/^CONFIG_RT2870/#&/' .config |
al@19583 | 143 |
al@19595 | 144 title 'Configure bzImage without modules...' |
pankso@15855 | 145 yes '' | make ARCH=i386 oldconfig |
al@19583 | 146 |
al@19595 | 147 title 'Building bzImage without modules...' |
pascal@15670 | 148 make ARCH=i386 -j 4 bzImage || exit 1 |
al@19583 | 149 |
al@19595 | 150 mkdir -p $DESTDIR |
pankso@15855 | 151 mv arch/x86/boot/bzImage $DESTDIR |
pankso@15855 | 152 mv System.map System.map-without-modules |
pankso@12294 | 153 fi |
al@19583 | 154 |
pankso@12294 | 155 # Build bzImage with modules |
pankso@12294 | 156 cp -f $stuff/$PACKAGE-slitaz.config .config |
al@19583 | 157 |
al@19595 | 158 title 'Configure bzImage with modules...' |
pascal@15733 | 159 yes '' | make ARCH=i386 oldconfig |
al@19583 | 160 |
al@19583 | 161 |
al@19595 | 162 title 'Building bzImage with modules...' |
pascal@15670 | 163 make ARCH=i386 -j 4 bzImage && |
pascal@15670 | 164 make ARCH=i386 -j 4 modules && |
al@19595 | 165 make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR modules_install && |
pascal@15670 | 166 make ARCH=i386 INSTALL_HDR_PATH=$DESTDIR/usr headers_install && |
al@19583 | 167 |
pankso@15855 | 168 [ -s arch/x86/boot/bzImage ] || return 1 |
al@19595 | 169 mkdir -p $DESTDIR/boot |
pankso@12294 | 170 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz |
al@19583 | 171 |
al@19595 | 172 $stuff/tools/install_module_headers.sh $DESTDIR $src $VERSION-slitaz |
al@19583 | 173 |
pascal@7667 | 174 ln System.map System.map-modules |
pascal@7667 | 175 ln Module.symvers Module.symvers-modules |
pankso@3864 | 176 } |
erjo@253 | 177 |
pankso@3 | 178 # Rules to gen a SliTaz package suitable for Tazpkg. |
pankso@3 | 179 genpkg_rules() |
pankso@3 | 180 { |
pankso@12803 | 181 case "$ARCH" in |
pankso@12803 | 182 arm) |
pankso@12803 | 183 echo "Packing: ARM Kernel" |
pankso@12803 | 184 cp -a $install/* $fs |
pankso@12803 | 185 rm -f $fs/lib/modules/*/build $fs/lib/modules/*/source |
pankso@12803 | 186 return 0 ;; |
pankso@12803 | 187 x86_64) |
pankso@12803 | 188 echo "TODO: use default or custom x86_64 packing" |
pankso@12803 | 189 return 0 ;; |
pankso@12803 | 190 esac |
pankso@12803 | 191 |
al@19595 | 192 # Copy the Kernel |
al@18734 | 193 cp -a $install/boot $fs |
al@18734 | 194 |
al@19595 | 195 # Copy base modules |
al@19595 | 196 . $stuff/tools/copy_modules.sh |
al@18734 | 197 |
al@18734 | 198 # We only need module.{order,builtin} because other map files are |
al@18734 | 199 # generated by depmod in post_install |
al@19595 | 200 cook_copy_files modules.order modules.builtin |
al@19595 | 201 rm -rf $fs/usr |
al@18734 | 202 |
al@19595 | 203 # Pack all packages with a Kernel modules |
al@19583 | 204 [ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1 |
al@19583 | 205 for i in $SPLIT; do |
al@19583 | 206 cook $i |
al@18734 | 207 done |
al@18734 | 208 |
al@19595 | 209 # Checking for Linux Kernel modules that don't belong to any of the packages |
al@19595 | 210 $stuff/tools/check_modules.sh |
pankso@3 | 211 } |
pankso@3 | 212 |
pankso@3 | 213 # Pre and post install commands for Tazpkg. |
pankso@3 | 214 post_install() |
pankso@3 | 215 { |
al@18734 | 216 # Handle multiarch installation |
al@18734 | 217 case "$SLITAZ_ARCH" in |
pankso@12803 | 218 arm) |
pankso@12803 | 219 echo "Kernel : /boot/linux-$VERSION-slitaz-$ARCH" |
pankso@12803 | 220 echo "Modules: /lib/modules/$VERSION-slitaz" |
pankso@12803 | 221 return 0 ;; |
pankso@12803 | 222 esac |
al@18734 | 223 |
pankso@15855 | 224 # GRUB stuff. |
pankso@15855 | 225 if [ -f "$1/boot/grub/menu.lst" ]; then |
pankso@15855 | 226 # Current root device |
pankso@15855 | 227 root_dev="/dev/$(lsblk | grep '/$'| grep -o '[a-z]d[a-z][0-9]*')" |
pankso@15855 | 228 grub_part="$(( $(echo $root_dev | grep -o '[0-9]*$')-1 ))" |
pankso@15855 | 229 # Use device.map to find grub device number |
pankso@15855 | 230 grub_dev="$(grep $(echo $root_dev | grep -o '^/dev/.d.' ) \ |
al@19583 | 231 "$1/boot/grub/device.map" | cut -f1 | sed "s/)$/.$grub_part)/g")" |
al@18734 | 232 |
al@19583 | 233 # Add and clean Kernel entries in case of upgrade for installed system. |
pascal@18730 | 234 if ! grep -q vmlinuz-$VERSION-slitaz "$1/boot/grub/menu.lst"; then |
al@18734 | 235 |
pankso@15855 | 236 # Clean the old entry |
pankso@15855 | 237 # TODO: old vmlinuz file is removed but the entry is still there. |
pankso@15855 | 238 # So grub error:15 when selected: http://bugs.slitaz.org/?id=74 |
border@13797 | 239 |
pankso@15855 | 240 # Add the new entry |
al@19583 | 241 cat >> "$1/boot/grub/menu.lst" <<EOT |
pankso@4056 | 242 |
pankso@4056 | 243 title SliTaz GNU/Linux (Kernel $VERSION-slitaz) |
border@13754 | 244 $grub_dev |
border@13754 | 245 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev quiet |
pankso@4056 | 246 EOT |
border@13754 | 247 # Make it the default entry |
pascal@18730 | 248 last_entry=$(( $(grep -c '^title' "$1/boot/grub/menu.lst")-1 )) |
pascal@18730 | 249 sed -e "s/^default.*/default $last_entry/g" -i "$1/boot/grub/menu.lst" |
pankso@4056 | 250 fi |
al@18734 | 251 |
pankso@4056 | 252 # Display information message. |
al@19595 | 253 [ -z "$quiet" ] && cat <<EOT |
al@18734 | 254 |
pankso@4056 | 255 ---- |
al@19583 | 256 GRUB is installed, these three lines must be in your /boot/grub/menu.lst: |
pankso@1154 | 257 |
pankso@1154 | 258 title SliTaz GNU/Linux (Kernel $VERSION-slitaz) |
pankso@1154 | 259 $grub_dev |
pankso@4056 | 260 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev |
pascal@886 | 261 ---- |
pascal@886 | 262 EOT |
pankso@1154 | 263 fi |
al@19586 | 264 : |
pankso@3 | 265 } |