wok annotate linux-libre/receipt @ rev 20604

Up linux-libre (3.18.129)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Dec 17 23:42:42 2018 +0100 (2018-12-17)
parents 10c74e95b062
children 0f7e6289846d
rev   line source
gokhlayeh@9257 1 # SliTaz package receipt.
gokhlayeh@9257 2
gokhlayeh@9257 3 PACKAGE="linux-libre"
pascal@20604 4 VERSION="3.18.129-gnu"
gokhlayeh@9257 5 CATEGORY="base-system"
gokhlayeh@9257 6 SHORT_DESC="The Linux Libre kernel and modules."
gokhlayeh@9257 7 MAINTAINER="gokhlayeh@slitaz.org"
pascal@14657 8 LICENSE="GPL2"
gokhlayeh@9257 9 PROVIDE="linux"
pascal@14201 10 TARBALL="$PACKAGE-$VERSION.tar.bz2"
gokhlayeh@9257 11 WEB_SITE="http://www.fsfla.org/svnwiki/selibre/linux-libre/"
gokhlayeh@9257 12 WGET_URL="http://www.fsfla.org/svnwiki/selibre/linux-libre/download/releases/$VERSION/$TARBALL"
gokhlayeh@9257 13
pascal@20604 14 DEPENDS="kmod"
pascal@20604 15 BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch kmod bc \
pascal@20604 16 sysfsutils-dev libtool glib-dev libwrap libwrap-dev udev-dev"
slaxemulator@10638 17
gokhlayeh@9257 18 # Rules to configure and make the package.
gokhlayeh@9257 19 compile_rules()
gokhlayeh@9257 20 {
gokhlayeh@9257 21 # SliTaz db
gokhlayeh@11396 22 rm -rf $WOK/$PACKAGE/slitaz && mkdir $WOK/$PACKAGE/slitaz
slaxemulator@9337 23 echo "$WGET_URL" > $WOK/$PACKAGE/slitaz/url
gokhlayeh@9257 24 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/slitaz
gokhlayeh@9257 25 cp $stuff/bootloader.sh $WOK/$PACKAGE/slitaz
slaxemulator@10638 26
gokhlayeh@9257 27 # Apply patches
gokhlayeh@11396 28 echo "Applying patches..."
gokhlayeh@9257 29 while read patch_file; do
gokhlayeh@9257 30 echo "$patch_file" >> $WOK/$PACKAGE/slitaz/patches
gokhlayeh@9257 31 cp $stuff/$patch_file $WOK/$PACKAGE/slitaz
gokhlayeh@9257 32 if [ -f done.$patch_file ]; then
gokhlayeh@9257 33 echo "Skipping $patch_file"
gokhlayeh@9257 34 continue
gokhlayeh@9257 35 fi
gokhlayeh@9257 36 echo "Apply $patch_file"
pascal@20604 37 patch -p1 < $WOK/$PACKAGE/slitaz/$patch_file || return 1
gokhlayeh@9257 38 touch done.$patch_file
gokhlayeh@9257 39 done <<EOT
pascal@20604 40 $PACKAGE-lzma-$VERSION.u
gokhlayeh@9257 41 $PACKAGE-freeinitrd-$VERSION.u
gokhlayeh@9257 42 EOT
gokhlayeh@11396 43
gokhlayeh@9257 44 make mrproper
pascal@20604 45 cd tools/lguest
pascal@20604 46 make $MAKEFLAGS lguest || return 1
gokhlayeh@9257 47 cd $src
gokhlayeh@9257 48
gokhlayeh@9257 49 # Build bzImage without modules first
gokhlayeh@9257 50 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
gokhlayeh@9257 51 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
al@18741 52
gokhlayeh@9257 53 yes '' | make oldconfig
pascal@20604 54 make $MAKEFLAGS bzImage || return 1
pascal@15602 55 [ -d $DESTDIR ] || mkdir -p $DESTDIR
pascal@15602 56 mv arch/x86/boot/bzImage $DESTDIR
gokhlayeh@9257 57 mv System.map System.map-without-modules
gokhlayeh@9257 58
gokhlayeh@9257 59 # Build bzImage with modules
gokhlayeh@9257 60 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
gokhlayeh@9257 61 make oldconfig
gokhlayeh@9257 62 ln .config $WOK/$PACKAGE/slitaz/config
gokhlayeh@11396 63 make $MAKEFLAGS bzImage &&
gokhlayeh@11396 64 make $MAKEFLAGS modules &&
pascal@15602 65 make INSTALL_MOD_PATH=$DESTDIR modules_install &&
pascal@15602 66 make INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
pascal@20604 67 [ -s arch/x86/boot/bzImage ] || return 1
pascal@15602 68 mkdir -p $DESTDIR/boot 2> /dev/null
pascal@15602 69 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
al@18741 70
gokhlayeh@9257 71 # Compress all modules.
pascal@15602 72 $stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
gokhlayeh@9257 73 ln System.map System.map-modules
gokhlayeh@9257 74 ln Module.symvers Module.symvers-modules
gokhlayeh@9257 75 }
gokhlayeh@9257 76
gokhlayeh@9257 77 # Rules to gen a SliTaz package suitable for Tazpkg.
gokhlayeh@9257 78 genpkg_rules()
gokhlayeh@9257 79 {
al@18741 80 local path
al@18741 81 cp -a $install/boot $fs
al@18741 82 # Compress all modules.
al@18741 83 #$stuff/gztazmod.sh $install/lib/modules/$VERSION-slitaz
al@18741 84 path=$fs/lib/modules/$VERSION-slitaz/kernel
al@18741 85 mkdir -p $path
al@18741 86 cp -a $install/lib/modules/$VERSION-slitaz/mo* \
gokhlayeh@9257 87 $fs/lib/modules/$VERSION-slitaz
al@18741 88 # Get the base modules
al@18741 89 export src
al@18741 90 export _pkg
al@18741 91 mkdir $WOK/$PACKAGE/tmp
al@18741 92 $stuff/list_modules.sh \
gokhlayeh@11396 93 $(cat stuff/modules-$VERSION.list) > $WOK/$PACKAGE/tmp/modules.list
al@18741 94 while read module; do
al@18741 95 dir=$(dirname $module)
al@18741 96 [ -d $path/$dir ] || mkdir -p $path/$dir
al@18741 97 cp -a $install/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
al@18741 98 done < $WOK/$PACKAGE/tmp/modules.list
al@18741 99 # Remove unresolved links
al@18741 100 rm -f $fs/lib/modules/$VERSION-slitaz/build
al@18741 101 rm -f $fs/lib/modules/$VERSION-slitaz/source
pascal@17733 102
al@18741 103 # Pack all packages with a kernel module
al@18741 104 for i in $(cd $WOK; grep -l '^WANTED="linux-libre"' */receipt); do
al@18741 105 [ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1
al@18741 106 cook ${i%/receipt}
al@18741 107 done
al@18741 108
al@18741 109 # Check and echo any module in kernel .config that's not added to
al@18741 110 # one of linux-* pkgs
al@18741 111 export PACKAGE
al@18741 112 $stuff/check_modules.sh
gokhlayeh@9257 113 }
gokhlayeh@9257 114
gokhlayeh@9257 115 # Pre and post install commands for Tazpkg.
gokhlayeh@9257 116 post_install()
gokhlayeh@9257 117 {
al@18741 118 chroot "$1/" depmod -a $VERSION-slitaz
al@18741 119 # GRUB stuff.
al@18741 120 if [ -f "$1/boot/grub/menu.lst" ]; then
al@18741 121 root_dev=$(cat "$1/boot/grub/menu.lst" | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1)
al@18741 122 grub_dev=$(cat "$1/boot/grub/menu.lst" | grep "root (" | head -n 1)
gokhlayeh@9257 123 # Add new kernel entry in case of upgrade for installed system.
pascal@18730 124 if ! grep -q $PACKAGE-$VERSION-slitaz "$1/boot/grub/menu.lst"; then
al@18741 125 cat >> "$1/boot/grub/menu.lst" <<EOT
gokhlayeh@9257 126
gokhlayeh@9257 127 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
gokhlayeh@9257 128 $grub_dev
gokhlayeh@9257 129 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
gokhlayeh@9257 130 EOT
gokhlayeh@9257 131 fi
gokhlayeh@9257 132 # Display information message.
al@18741 133 cat <<EOT
gokhlayeh@9257 134 ----
gokhlayeh@9257 135 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
gokhlayeh@9257 136
gokhlayeh@9257 137 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
gokhlayeh@9257 138 $grub_dev
gokhlayeh@9257 139 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
gokhlayeh@9257 140 ----
gokhlayeh@9257 141 EOT
al@18741 142 fi
al@18741 143 true
gokhlayeh@9257 144 }