wok-next annotate linux/receipt @ rev 20893

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