wok-next annotate linux/receipt @ rev 19772
Convert linux-* packages into linux v2 receipt, as well as linux-libre-* -> linux-libre single receipt (is jumbo one, there's a room for huge optimizations, in the case if someone else need it...), move linux64* receipts outside the wok.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Fri Jun 16 01:15:35 2017 +0300 (2017-06-16) |
parents | 960a052d15d3 |
children | cf03631202da |
rev | line source |
---|---|
al@19772 | 1 # SliTaz package receipt v2. |
pankso@3 | 2 |
pankso@3 | 3 PACKAGE="linux" |
al@19772 | 4 VERSION="4.9.30" |
al@19595 | 5 KBASEVER="4.9" |
pankso@3 | 6 CATEGORY="base-system" |
al@19772 | 7 SHORT_DESC="The Linux Kernel" |
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 |
al@19595 | 16 BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch kmod bc" |
al@19583 | 17 SPLIT="lguest linux-acpi linux-agp linux-aoe linux-appletalk linux-arcnet \ |
al@19595 | 18 linux-autofs linux-bluetooth linux-bridge linux-btrfs linux-cifs linux-coda \ |
al@19583 | 19 linux-cpufreq linux-cramfs linux-crypto linux-cryptoloop linux-dialup \ |
al@19595 | 20 linux-dlm linux-drm linux-ecryptfs linux-efi linux-ethernet linux-exofs \ |
al@19595 | 21 linux-firewire linux-firmware linux-gfs2 linux-hfs linux-hfsplus linux-hid \ |
al@19595 | 22 linux-hwmon linux-ide linux-input-misc linux-input-tablet \ |
al@19583 | 23 linux-input-touchscreen linux-ipv6 linux-irda linux-isdn linux-jfs \ |
al@19583 | 24 linux-joystick linux-kvm linux-logfs linux-md linux-media linux-memstick \ |
al@19583 | 25 linux-minix linux-mmc linux-module-headers linux-mwave linux-nbd linux-ncpfs \ |
al@19595 | 26 linux-netfilter linux-nfc linux-nfs linux-nfsd linux-ocfs2 linux-orangefs \ |
al@19595 | 27 linux-radio linux-reiserfs linux-romfs linux-sched linux-scsi linux-sound \ |
al@19595 | 28 linux-source linux-speakup linux-squashfs linux-staging linux-toshiba \ |
al@19595 | 29 linux-usb-gadget linux-usb-misc linux-usbdsl linux-usbip linux-uwb linux-video \ |
al@19595 | 30 linux-wan linux-watchdog linux-wimax linux-wireless linux-without-modules \ |
al@19595 | 31 linux-zram" |
al@19595 | 32 SIBLINGS="linux-api-headers linux-dev linux-man" |
al@19595 | 33 |
al@19595 | 34 if [ "$KBASEVER" != "${VERSION%.0}" ]; then |
al@19595 | 35 PATCH="$(dirname $WGET_URL)/patch-$VERSION.xz" |
al@19595 | 36 EXTRA_SOURCE_FILES="$(basename $PATCH)" |
al@19595 | 37 fi |
pankso@12824 | 38 |
pankso@15855 | 39 # |
pankso@15855 | 40 # The Linux receipt handle cross compilation. For x86_64 we actually use |
pankso@15855 | 41 # the uclibc-cross-compiler-x86_64 and for ARM we use a real cross env. |
al@19583 | 42 # Please discuss any change and keep it simple, don't play with VERSION |
al@19583 | 43 # string or Kernel SUBLEVEL because depmod and Pankso don't like that! |
pankso@15855 | 44 # |
al@19583 | 45 # The receipt also handle some cook options for faster build: |
pankso@15855 | 46 # --nonomods : Skip bzImage without modules build |
pankso@15855 | 47 # |
pankso@3 | 48 |
pankso@12824 | 49 # Handle multiarch compilation. Less bdeps when cross-compiling for ARM |
pankso@12803 | 50 case "$ARCH" in |
al@19595 | 51 arm) BUILD_DEPENDS="xz" ;; |
pankso@12824 | 52 x86_64) BUILD_DEPENDS="xz" ;; |
pankso@12824 | 53 esac |
pankso@12824 | 54 |
pankso@15855 | 55 # Handle multiarch installation. ARM use Busybox modutils, so avoid any |
pankso@15855 | 56 # deps on kmod. SLITAZ_ARCH can have also custom post_install commands |
pankso@15921 | 57 if [ -f $root/etc/slitaz/slitaz.conf ]; then |
pankso@15921 | 58 . $root/etc/slitaz/slitaz.conf |
pankso@15921 | 59 case "$SLITAZ_ARCH" in |
pankso@15921 | 60 arm) DEPENDS="" ;; |
pankso@15921 | 61 esac |
pankso@15921 | 62 fi |
pankso@12824 | 63 |
pankso@3 | 64 # Rules to configure and make the package. |
pankso@3 | 65 compile_rules() |
pankso@3 | 66 { |
al@19595 | 67 # Update sources to the $VERSION using base sources ($KBASEVER) and patch |
al@19595 | 68 if [ "$KBASEVER" != "${VERSION%.0}" ]; then |
al@19595 | 69 [ -s $SRC/$(basename $PATCH) ] || wget $PATCH -O $SRC/$(basename $PATCH) |
al@19595 | 70 # don't patch twice for `cook $PACKAGE --continue` |
al@19595 | 71 if [ ! -f "done.patch-$VERSION" ]; then |
al@19595 | 72 xzcat $SRC/$(basename $PATCH) | patch -Np1 |
al@19595 | 73 touch done.patch-$VERSION |
al@19595 | 74 fi |
al@19595 | 75 fi |
al@19595 | 76 |
al@19595 | 77 # |
pankso@15921 | 78 if [ -f "/usr/share/boot/initrd" ]; then |
pankso@15921 | 79 cp /usr/share/boot/initrd initrd.cpio |
pankso@15921 | 80 fi |
pankso@12803 | 81 |
pankso@15855 | 82 # Handle cross compilation |
pankso@12803 | 83 case "$ARCH" in |
pankso@12803 | 84 arm) |
pankso@15855 | 85 echo "Compiling: $ARCH Kernel" |
pankso@12824 | 86 make mrproper |
pankso@12824 | 87 patch -Np1 < $stuff/$ARCH/linux-arm.patch || exit 1 |
pankso@12824 | 88 cp -f $stuff/$ARCH/linux-arm.config .config |
pascal@15733 | 89 yes '' | make ARCH=$ARCH oldconfig |
pankso@12803 | 90 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- bzImage && |
pankso@12803 | 91 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- modules && |
pankso@12803 | 92 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- \ |
pankso@12803 | 93 INSTALL_MOD_PATH=$DESTDIR modules_install && |
pankso@12803 | 94 mkdir -p $DESTDIR/boot && |
pankso@12824 | 95 cp -a arch/arm/boot/zImage \ |
pankso@12803 | 96 $DESTDIR/boot/linux-$VERSION-slitaz-$ARCH |
al@19595 | 97 #$stuff/tools/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz |
pankso@12803 | 98 return 0 ;; |
pankso@12803 | 99 x86_64) |
al@19583 | 100 echo "TODO: Maybe use default? But cross compile in x86_64 chroot" |
pankso@12803 | 101 echo "so we can remove the 64 build by uclibc-cross-compiler-x86_64" |
pankso@12803 | 102 return 0 ;; |
pankso@12803 | 103 esac |
pankso@12803 | 104 |
al@19595 | 105 # Get and apply Aufs patches |
al@19595 | 106 . $stuff/tools/aufs-patches |
al@19583 | 107 |
pankso@12285 | 108 echo "cook:linux" > $command |
pankso@12285 | 109 |
al@19595 | 110 # Apply misc patches |
pankso@9731 | 111 echo "Applying patches..." |
pascal@521 | 112 while read patch_file; do |
pascal@1442 | 113 if [ -f done.$patch_file ]; then |
al@19583 | 114 echo "Skipping $patch_file"; continue |
pascal@1442 | 115 fi |
al@19583 | 116 echo -e "\nApply $patch_file" |
al@19595 | 117 patch -p1 -i $stuff/patches/$patch_file || return 1 |
pascal@1442 | 118 touch done.$patch_file |
al@19595 | 119 done < $stuff/patches/patch.order |
al@19583 | 120 |
pankso@15855 | 121 # Mrproper and lguest |
al@19583 | 122 echo "Making kernel proper and then build lguest..." |
pankso@3864 | 123 make mrproper |
al@19583 | 124 cd tools/lguest |
pankso@15855 | 125 make lguest || return 1 |
pankso@15855 | 126 cd $src |
al@19583 | 127 |
pankso@15855 | 128 # |
pankso@15855 | 129 # Linux Arch i386 - GCC arch i486 |
pankso@12294 | 130 # |
al@19583 | 131 echo "Making x86 Kernel..." |
pankso@12803 | 132 |
pankso@12294 | 133 # Build bzImage without modules first |
al@19583 | 134 if [ -z "$nonomods" ]; then |
pankso@15855 | 135 cp -f $stuff/$PACKAGE-slitaz.config .config |
pankso@15855 | 136 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config |
al@19583 | 137 # We can't keep every driver in staging??? |
al@19595 | 138 sed -i \ |
al@19595 | 139 -e 's/^CONFIG_RTL8192/#&/' \ |
pankso@15855 | 140 -e 's/^CONFIG_R8187SE/#&/' \ |
pankso@15855 | 141 -e 's/^CONFIG_RT2870/#&/' .config |
al@19583 | 142 |
al@19595 | 143 title 'Configure bzImage without modules...' |
pankso@15855 | 144 yes '' | make ARCH=i386 oldconfig |
al@19583 | 145 |
al@19595 | 146 title 'Building bzImage without modules...' |
pascal@15670 | 147 make ARCH=i386 -j 4 bzImage || exit 1 |
al@19583 | 148 |
al@19595 | 149 mkdir -p $DESTDIR |
pankso@15855 | 150 mv arch/x86/boot/bzImage $DESTDIR |
pankso@15855 | 151 mv System.map System.map-without-modules |
pankso@12294 | 152 fi |
al@19583 | 153 |
pankso@12294 | 154 # Build bzImage with modules |
pankso@12294 | 155 cp -f $stuff/$PACKAGE-slitaz.config .config |
al@19583 | 156 |
al@19595 | 157 title 'Configure bzImage with modules...' |
pascal@15733 | 158 yes '' | make ARCH=i386 oldconfig |
al@19583 | 159 |
al@19583 | 160 |
al@19595 | 161 title 'Building bzImage with modules...' |
pascal@15670 | 162 make ARCH=i386 -j 4 bzImage && |
pascal@15670 | 163 make ARCH=i386 -j 4 modules && |
al@19595 | 164 make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR modules_install && |
pascal@15670 | 165 make ARCH=i386 INSTALL_HDR_PATH=$DESTDIR/usr headers_install && |
al@19583 | 166 |
pankso@15855 | 167 [ -s arch/x86/boot/bzImage ] || return 1 |
al@19595 | 168 mkdir -p $DESTDIR/boot |
pankso@12294 | 169 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz |
al@19583 | 170 |
al@19595 | 171 $stuff/tools/install_module_headers.sh $DESTDIR $src $VERSION-slitaz |
al@19583 | 172 |
pascal@7667 | 173 ln System.map System.map-modules |
pascal@7667 | 174 ln Module.symvers Module.symvers-modules |
al@19772 | 175 |
al@19772 | 176 # for linux-zram package |
al@19772 | 177 mkdir -p $install/etc/init.d |
al@19772 | 178 install -o root -m 755 $stuff/compcache $install/etc/init.d/ |
al@19772 | 179 install -o root -m 644 $stuff/compcache.conf $install/etc/ |
al@19772 | 180 |
al@19772 | 181 # for lguest package |
al@19772 | 182 mkdir -p $install/usr/sbin |
al@19772 | 183 cp -a $src/tools/lguest/lguest $install/usr/sbin |
pankso@3864 | 184 } |
erjo@253 | 185 |
pankso@3 | 186 # Rules to gen a SliTaz package suitable for Tazpkg. |
pankso@3 | 187 genpkg_rules() |
pankso@3 | 188 { |
al@19772 | 189 DEPENDS="linux" # default, may be subject to change later |
al@19772 | 190 |
al@19772 | 191 case $PACKAGE in |
al@19772 | 192 *-acpi) c="ACPI modules";; |
al@19772 | 193 *-agp) c="AGP modules";; |
al@19772 | 194 *-aoe) c="AoE (ATA over Ethernet) modules";; |
al@19772 | 195 *-appletalk) c="Appletalk modules";; |
al@19772 | 196 *-arcnet) c="ARCnet modules";; |
al@19772 | 197 *-autofs) c="Automounter module";; |
al@19772 | 198 *-bluetooth) c="Bluetooth modules";; |
al@19772 | 199 *-bridge) c="Bridge modules";; |
al@19772 | 200 *-btrfs) c="Btrfs module"; DEPENDS="linux-crypto";; |
al@19772 | 201 *-cifs) c="CIFS module";; |
al@19772 | 202 *-coda) c="Coda module";; |
al@19772 | 203 *-cpufreq) c="Cpufreq modules";; |
al@19772 | 204 *-cramfs) c="CramFs module";; |
al@19772 | 205 *-crypto) c="Crypto modules";; |
al@19772 | 206 *-cryptoloop) c="Cryptoloop modules"; DEPENDS="linux-crypto";; |
al@19772 | 207 *-dialup) c="Dial-up modules";; |
al@19772 | 208 *-dlm) c="DLMFS module";; |
al@19772 | 209 *-drm) c="DRM module"; DEPENDS="linux-agp";; |
al@19772 | 210 *-ecryptfs) c="eCrypt FS module";; |
al@19772 | 211 *-efi) c="EFI modules";; |
al@19772 | 212 *-ethernet) c="Ethernet drivers";; |
al@19772 | 213 *-exofs) c="OSD based FS module"; DEPENDS="linux-crypto";; |
al@19772 | 214 *-firewire) c="Firewire modules";; |
al@19772 | 215 *-gfs2) c="GFS2 module";; |
al@19772 | 216 *-hfs) c="HFS module";; |
al@19772 | 217 *-hfsplus) c="HFSplus module";; |
al@19772 | 218 *-hid) c="HID (human interface device) modules";; |
al@19772 | 219 *-hwmon) c="Hwmon modules";; |
al@19772 | 220 *-ide) c="IDE modules";; |
al@19772 | 221 *-input-misc) c="misc. input drivers";; |
al@19772 | 222 *-input-tablet) c="tablet input drivers";; |
al@19772 | 223 *-input-touchscreen) c="touchscreen input drivers";; |
al@19772 | 224 *-ipv6) c="IPv6 modules"; DEPENDS="linux-netfilter";; |
al@19772 | 225 *-irda) c="IRDA modules";; |
al@19772 | 226 *-isdn) c="ISDN modules";; |
al@19772 | 227 *-jfs) c="JFS module";; |
al@19772 | 228 *-joystick) c="joystick modules";; |
al@19772 | 229 *-kvm) c="KVM and Virtio modules";; |
al@19772 | 230 *-logfs) c="Logfs module";; |
al@19772 | 231 *-md) c="MD modules"; DEPENDS="linux-crypto";; |
al@19772 | 232 *-media) c="media modules"; DEPENDS="linux-radio";; |
al@19772 | 233 *-memstick) c="Sony memory stick modules";; |
al@19772 | 234 *-minix) c="Minix module";; |
al@19772 | 235 *-mmc) c="MMC modules - card reader";; |
al@19772 | 236 *-mwave) c="ACP Modem driver module - for IBM Thinkpad";; |
al@19772 | 237 *-nbd) c="NBD (network block device) modules";; |
al@19772 | 238 *-ncpfs) c="NCPFS module";; |
al@19772 | 239 *-netfilter) c="Netfilter modules";; |
al@19772 | 240 *-nfc) c="NFC modules";; |
al@19772 | 241 *-nfs) c="NFS modules"; DEPENDS="linux-crypto";; |
al@19772 | 242 *-nfsd) c="NFS server module"; DEPENDS="linux-nfs";; |
al@19772 | 243 *-ocfs2) c="OCFS2 modules"; DEPENDS="linux-dlm";; |
al@19772 | 244 *-orangefs) c="OrangeFS module";; |
al@19772 | 245 *-radio) c="radio modules";; |
al@19772 | 246 *-reiserfs) c="ReiserFS module";; |
al@19772 | 247 *-romfs) c="ROMFS module";; |
al@19772 | 248 *-sched) c="Sched modules";; |
al@19772 | 249 *-scsi) c="SCSI modules";; |
al@19772 | 250 *-sound) c="sound modules" |
al@19772 | 251 copy firmware/ess/ firmware/korg/ firmware/sun/ firmware/yamaha/ |
al@19772 | 252 ;; |
al@19772 | 253 *-speakup) c="Speakup modules";; |
al@19772 | 254 *-squashfs) c="Squashfs module"; PROVIDE="squashfs-module";; |
al@19772 | 255 *-staging) c="staging kernel modules";; |
al@19772 | 256 *-toshiba) c="Toshiba module";; |
al@19772 | 257 *-usb-gadget) c="USB gadget modules";; |
al@19772 | 258 *-usb-misc) c="misc. USB drivers";; |
al@19772 | 259 *-usbdsl) c="USB DSL modem modules";; |
al@19772 | 260 *-usbip) c="Usbip module"; PROVIDE="usbip-module";; |
al@19772 | 261 *-uwb) c="UWB modules";; |
al@19772 | 262 *-video) c="video modules";; |
al@19772 | 263 *-wan) c="Wide Area Networks (WANs) modules"; DEPENDS="linux-wireless";; |
al@19772 | 264 *-watchdog) c="watchdog drivers";; |
al@19772 | 265 *-wimax) c="Wimax modules";; |
al@19772 | 266 *-wireless) c="wireless modules"; DEPENDS="linux-crypto wireless_tools";; |
al@19772 | 267 *-zram) c="compressed caching support"; PROVIDE="compcache" |
al@19772 | 268 copy compcache compcache.conf |
al@19772 | 269 ;; |
pankso@12803 | 270 esac |
pankso@12803 | 271 |
al@19772 | 272 case $PACKAGE in |
al@19772 | 273 linux) |
al@19772 | 274 case "$ARCH" in |
al@19772 | 275 arm) |
al@19772 | 276 echo "Packing: ARM Kernel" |
al@19772 | 277 cp -a $install/* $fs |
al@19772 | 278 rm -f $fs/lib/modules/*/build $fs/lib/modules/*/source |
al@19772 | 279 return 0 ;; |
al@19772 | 280 x86_64) |
al@19772 | 281 echo "TODO: use default or custom x86_64 packing" |
al@19772 | 282 return 0 ;; |
al@19772 | 283 esac |
al@18734 | 284 |
al@19772 | 285 # Copy the Kernel |
al@19772 | 286 cp -a $install/boot $fs |
al@18734 | 287 |
al@19772 | 288 # Copy base modules |
al@19772 | 289 . $stuff/tools/copy_modules.sh |
al@18734 | 290 |
al@19772 | 291 # We only need module.{order,builtin} because other map files are |
al@19772 | 292 # generated by depmod in post_install |
al@19772 | 293 copy modules.order modules.builtin |
al@19772 | 294 rm -rf $fs/usr |
al@18734 | 295 |
al@19772 | 296 # Pack all packages with a Kernel modules |
al@19772 | 297 [ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1 |
al@19772 | 298 |
al@19772 | 299 # Checking for Linux Kernel modules that don't belong to any of the packages |
al@19772 | 300 # $stuff/tools/check_modules.sh |
al@19772 | 301 DEPENDS="kmod" |
al@19772 | 302 ;; |
al@19772 | 303 *-firmware) |
al@19772 | 304 mkdir -p $fs/lib |
al@19772 | 305 cp -a $install/lib/firmware $fs/lib |
al@19772 | 306 # remove linux-sound firmware files |
al@19772 | 307 for i in ess korg sun yamaha; do |
al@19772 | 308 rm -rf $fs/lib/firmware/$i |
al@19772 | 309 done |
al@19772 | 310 CAT="non-free|firmware thats compiled from Linux source code" |
al@19772 | 311 PROVIDE="linux64-firmware" |
al@19772 | 312 ;; |
al@19772 | 313 *-module-headers) |
al@19772 | 314 CAT="development|header files and scripts for building modules for Linux Kernel" |
al@19772 | 315 KVERSION="$VERSION-slitaz" |
al@19772 | 316 DEPENDS="slitaz-toolchain" |
al@19772 | 317 mkdir -p $fs/lib/modules/$KVERSION $fs/usr |
al@19772 | 318 cp -a $install/usr/src $fs/usr |
al@19772 | 319 ;; |
al@19772 | 320 *-source) |
al@19772 | 321 CAT="development|source files" |
al@19772 | 322 DEPENDS="linux slitaz-toolchain ncurses-dev perl xz lzma patch busybox-boot" |
al@19772 | 323 |
al@19772 | 324 local _AUFSVER=$(. $WOK/aufs/receipt; echo $VERSION) |
al@19772 | 325 local AUFSDIR="aufs-${_AUFSVER}" |
al@19772 | 326 kps=$fs/usr/src/kernel-patches/slitaz |
al@19772 | 327 mkdir -p $kps \ |
al@19772 | 328 $fs/lib/modules/$VERSION-slitaz \ |
al@19772 | 329 $fs/usr/bin $fs/usr/sbin |
al@19772 | 330 |
al@19772 | 331 # URL |
al@19772 | 332 echo $(. $WOK/linux/receipt; echo $WGET_URL) > $kps/url |
al@19772 | 333 # stuff |
al@19772 | 334 cp $stuff/tools/* $stuff/bootloader.sh $kps |
al@19772 | 335 # Kernel patch |
al@19772 | 336 xzcat $SRC/patch-$VERSION.xz > $kps/linux-$VERSION.patch |
al@19772 | 337 echo "linux-$VERSION.patch" > $kps/patches |
al@19772 | 338 # Aufs patches |
al@19772 | 339 sed '/^aufs4.*patch$/!d' $stuff/tools/aufs-patches | \ |
al@19772 | 340 tee -a $kps/patches | \ |
al@19772 | 341 while read i; do |
al@19772 | 342 cp $WOK/aufs/source/*/$i $kps |
al@19772 | 343 done |
al@19772 | 344 # misc. patches |
al@19772 | 345 cat $stuff/patches/patch.order >> $kps/patches |
al@19772 | 346 cp $stuff/patches/* $kps |
al@19772 | 347 rm $kps/patch.order |
al@19772 | 348 # config |
al@19772 | 349 cp $WOK/linux/source/linux-$VERSION/.config $kps/config |
al@19772 | 350 |
al@19772 | 351 cp -a $stuff/linux-source/buildtaz $kps |
al@19772 | 352 cp -a $stuff/linux-source/make-tazpkg.u $kps |
al@19772 | 353 cp -a $stuff/linux-source/get-linux-source $fs/usr/bin |
al@19772 | 354 cp -a $stuff/linux-source/list_modules.sh $kps |
al@19772 | 355 cp -a $stuff/linux-source/rdev $fs/usr/sbin |
al@19772 | 356 ln -s rdev $fs/usr/sbin/rootflags |
al@19772 | 357 ln -s rdev $fs/usr/sbin/ramsize |
al@19772 | 358 ln -s rdev $fs/usr/sbin/vidmode |
al@19772 | 359 sed -i "s|=XXX|=$VERSION|g" $fs/usr/bin/get-linux-source |
al@19772 | 360 |
al@19772 | 361 # Copy Aufs4 source files |
al@19772 | 362 if [ -d $WOK/$WANTED/$AUFSDIR ]; then |
al@19772 | 363 mkdir $fs/usr/src/kernel-patches/slitaz/aufs4 |
al@19772 | 364 cp -a $WOK/$WANTED/$AUFSDIR/Documentation \ |
al@19772 | 365 $WOK/$WANTED/$AUFSDIR/fs $WOK/$WANTED/$AUFSDIR/include \ |
al@19772 | 366 $fs/usr/src/kernel-patches/slitaz/aufs4 |
al@19772 | 367 fi |
al@19772 | 368 |
al@19772 | 369 ln -s ../../../usr/src/linux-$VERSION $fs/lib/modules/$VERSION-slitaz/source |
al@19772 | 370 |
al@19772 | 371 chown -R root:root $fs |
al@19772 | 372 ;; |
al@19772 | 373 *-without-modules) |
al@19772 | 374 CAT="base-system|without module support" |
al@19772 | 375 PROVIDE="linux" |
al@19772 | 376 mkdir -p $fs/boot |
al@19772 | 377 cp -a $install/bzImage $fs/boot/vmlinuz-$VERSION-slitaz-without-modules |
al@19772 | 378 ;; |
al@19772 | 379 lguest) |
al@19772 | 380 CAT="base-system|paravirtualization tool" |
al@19772 | 381 DEPENDS=" " |
al@19772 | 382 copy lguest |
al@19772 | 383 ;; |
al@19772 | 384 *) |
al@19772 | 385 . $stuff/tools/copy_modules.sh |
al@19772 | 386 CAT="base-system|$c" |
al@19772 | 387 ;; |
al@19772 | 388 esac |
al@19772 | 389 |
al@19772 | 390 case $PACKAGE in |
al@19772 | 391 *fs|*fs2|*-coda|*-dlm|*-hfsplus|*-minix|*-nfsd) |
al@19772 | 392 CONFIG_FILES="/etc/filesystems";; |
al@19772 | 393 *-zram) |
al@19772 | 394 CONFIG_FILES="/etc/compcache.conf";; |
al@19772 | 395 esac |
pankso@3 | 396 } |
pankso@3 | 397 |
al@19772 | 398 |
al@19772 | 399 post_install_linux() { |
al@18734 | 400 # Handle multiarch installation |
al@18734 | 401 case "$SLITAZ_ARCH" in |
pankso@12803 | 402 arm) |
pankso@12803 | 403 echo "Kernel : /boot/linux-$VERSION-slitaz-$ARCH" |
pankso@12803 | 404 echo "Modules: /lib/modules/$VERSION-slitaz" |
pankso@12803 | 405 return 0 ;; |
pankso@12803 | 406 esac |
al@18734 | 407 |
pankso@15855 | 408 # GRUB stuff. |
pankso@15855 | 409 if [ -f "$1/boot/grub/menu.lst" ]; then |
pankso@15855 | 410 # Current root device |
pankso@15855 | 411 root_dev="/dev/$(lsblk | grep '/$'| grep -o '[a-z]d[a-z][0-9]*')" |
pankso@15855 | 412 grub_part="$(( $(echo $root_dev | grep -o '[0-9]*$')-1 ))" |
pankso@15855 | 413 # Use device.map to find grub device number |
pankso@15855 | 414 grub_dev="$(grep $(echo $root_dev | grep -o '^/dev/.d.' ) \ |
al@19583 | 415 "$1/boot/grub/device.map" | cut -f1 | sed "s/)$/.$grub_part)/g")" |
al@18734 | 416 |
al@19583 | 417 # Add and clean Kernel entries in case of upgrade for installed system. |
pascal@18730 | 418 if ! grep -q vmlinuz-$VERSION-slitaz "$1/boot/grub/menu.lst"; then |
al@18734 | 419 |
pankso@15855 | 420 # Clean the old entry |
pankso@15855 | 421 # TODO: old vmlinuz file is removed but the entry is still there. |
pankso@15855 | 422 # So grub error:15 when selected: http://bugs.slitaz.org/?id=74 |
border@13797 | 423 |
pankso@15855 | 424 # Add the new entry |
al@19583 | 425 cat >> "$1/boot/grub/menu.lst" <<EOT |
pankso@4056 | 426 |
pankso@4056 | 427 title SliTaz GNU/Linux (Kernel $VERSION-slitaz) |
border@13754 | 428 $grub_dev |
border@13754 | 429 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev quiet |
pankso@4056 | 430 EOT |
border@13754 | 431 # Make it the default entry |
pascal@18730 | 432 last_entry=$(( $(grep -c '^title' "$1/boot/grub/menu.lst")-1 )) |
pascal@18730 | 433 sed -e "s/^default.*/default $last_entry/g" -i "$1/boot/grub/menu.lst" |
pankso@4056 | 434 fi |
al@18734 | 435 |
pankso@4056 | 436 # Display information message. |
al@19595 | 437 [ -z "$quiet" ] && cat <<EOT |
al@18734 | 438 |
pankso@4056 | 439 ---- |
al@19583 | 440 GRUB is installed, these three lines must be in your /boot/grub/menu.lst: |
pankso@1154 | 441 |
pankso@1154 | 442 title SliTaz GNU/Linux (Kernel $VERSION-slitaz) |
pankso@1154 | 443 $grub_dev |
pankso@4056 | 444 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev |
pascal@886 | 445 ---- |
pascal@886 | 446 EOT |
pankso@1154 | 447 fi |
al@19586 | 448 : |
pankso@3 | 449 } |
al@19772 | 450 |
al@19772 | 451 pre_remove_linux_module_headers() { |
al@19772 | 452 if [ -e "$1/usr/src/linux" ]; then |
al@19772 | 453 rm -rf "$1/usr/src/linux" |
al@19772 | 454 fi |
al@19772 | 455 } |
al@19772 | 456 |
al@19772 | 457 # Added soft link to make it easier to point to kernel folder |
al@19772 | 458 post_install_linux_module_headers() { |
al@19772 | 459 KVERSION="$VERSION-slitaz" |
al@19772 | 460 [ -L "$1/usr/src/linux" ] && rm -f "$1/usr/src/linux" |
al@19772 | 461 ln -sf /usr/src/linux-$KVERSION "$1/usr/src/linux" |
al@19772 | 462 ln -sf /usr/src/linux-$KVERSION "$1/lib/modules/$KVERSION/build" |
al@19772 | 463 } |
al@19772 | 464 |
al@19772 | 465 post_install_linux_zram() { |
al@19772 | 466 chroot "$1/" depmod -a $VERSION-slitaz && |
al@19772 | 467 RAM=$(cat /proc/meminfo | grep MemTotal | sed s/[^0-9]//g) && |
al@19772 | 468 echo "SIZE_KB="$(($RAM/2)) > "$1/etc/compcache.conf" |
al@19772 | 469 [ -n "$quiet" ] || cat <<EOT |
al@19772 | 470 |
al@19772 | 471 You can add compressed swap according /etc/compcache.conf configuration with: |
al@19772 | 472 # /etc/init.d/compcache start |
al@19772 | 473 Or add compcache to the RUN_DAEMONS list of /etc/rcS.conf. |
al@19772 | 474 EOT |
al@19772 | 475 } |