wok-4.x view linux/receipt @ rev 12471

Mass Rebuild of base packages
author Stanislas Leduc <shann@slitaz.org>
date Thu Nov 10 11:11:46 2022 +0000 (18 months ago)
parents d4e29f7d8c7c
children
line source
1 # SliTaz package receipt.
3 PACKAGE="linux"
4 VERSION="2.6.37"
5 CATEGORY="base-system"
6 SHORT_DESC="The Linux kernel and modules."
7 MAINTAINER="devel@slitaz.org"
8 TARBALL="$PACKAGE-$VERSION.tar.bz2"
9 WEB_SITE="http://www.kernel.org/"
10 WGET_URL="ftp://www.kernel.org/pub/linux/kernel/v${VERSION:0:3}/$TARBALL"
11 CONFIG_FILES="/lib/modules/$VERSION-slitaz/modules.dep"
13 DEPENDS="depmod"
14 BUILD_DEPENDS="slitaz-toolchain perl git lzma patch"
16 # Rules to configure and make the package.
17 compile_rules()
18 {
19 cd $src
20 # this is code to help update the kernel version faster
21 #for i in $(grep -l 'WANTED="linux"' $WOK/*/receipt)
22 #do
23 # sed -i 's|VERSION="OLDVERSION"|VERSION="NEWVERSION"|g' $i
24 #done
26 # Check for Aufs and cook it if unbuilt.
27 echo "Checking for Aufs packages..."
28 _AUFSVER=`grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
29 _AUFSSRCDIR="$WOK/aufs/source"
30 _AUFSDIR="$_AUFSSRCDIR/aufs-${_AUFSVER}"
31 if [ ! -d "$_AUFSDIR" ]; then
32 [ ! -f "$SRC/aufs-${i_AUFSVER}.tar.bz2" ] && cook aufs --getsrc
33 mkdir -p $_AUFSSRCDIR
34 tar xjf $SRC/aufs-${_AUFSVER}.tar.bz2 -C $_AUFSSRCDIR/
35 ( cd $_AUFSDIR ; [ -d fs ] || git checkout origin/aufs${VERSION%.*} )
36 fi
38 echo "Copying Aufs files and patches..."
39 cp -a $_AUFSDIR/Documentation $_AUFSDIR/fs $_AUFSDIR/include $src
40 cp -a $_AUFSDIR/*.patch $stuff
42 # SliTaz db
43 rm -rf $WOK/$PACKAGE/slitaz && mkdir $WOK/$PACKAGE/slitaz
44 echo "$WGET_URL" > $WOK/$PACKAGE/slitaz/url
45 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/slitaz
46 cp $stuff/bootloader.sh $WOK/$PACKAGE/slitaz
48 # Apply patches
49 # Thanks again timesys and Karthi Softek for patchs to build kernel 2.6 with
50 # new toolchain (glibc 2.19 / gcc 4.9.2)
51 # https://blog.karthisoftek.com/a?ID=01350-31995d4f-821e-4241-bbb8-b9c697c001e9
52 echo "Applying patches..."
53 while read patch_file; do
54 echo "$patch_file" >> $WOK/$PACKAGE/slitaz/patches
55 cp $stuff/$patch_file $WOK/$PACKAGE/slitaz
56 if [ -f done.$patch_file ]; then
57 echo "Skipping $patch_file"
58 continue
59 fi
60 echo "Apply $patch_file"
61 patch -p1 < $WOK/$PACKAGE/slitaz/$patch_file || return 1
62 touch done.$patch_file
63 done <<EOT
64 $PACKAGE-diff-$VERSION.u
65 $PACKAGE-header-$VERSION.u
66 $PACKAGE-freeinitrd-$VERSION.u
67 $PACKAGE-perf_event-$VERSION.u
68 aufs2-base.patch
69 aufs2-standalone.patch
70 001-squashfs-decompressors-add-xz-decompressor-module.patch
71 002-squashfs-decompressors-add-boot-time-xz-support.patch
72 003-squashfs-x86-support-xz-compressed-kernel.patch
73 004-squashfs-add-xz-compression-support.patch
74 005-squashfs-add-xz-compression-configuration-option.patch
75 $PACKAGE-CVE-2016-5195.u
76 linux-2.6-no-unused-but-set-variable.patch
77 linux-2.6-syscall-ptrace.patch
78 linux-2.6-kvm-emulate.patch
79 EOT
81 echo "Make kernel proper and then build lguest"
83 make mrproper
84 cd Documentation/lguest
85 make $MAKEFLAGS lguest || return 1
86 cd $src
88 echo "Make bzImage without modules first"
90 # Build bzImage without modules first
91 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
92 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
94 # We can't keep every driver in staging
95 sed -i -e 's/^CONFIG_RTL8192/#&/' \
96 -e 's/^CONFIG_R8187SE/#&/' \
97 -e 's/^CONFIG_RT2870/#&/' .config
98 yes '' | make oldconfig
99 make $MAKEFLAGS bzImage || return 1
100 [ -d $PWD/_pkg ] || mkdir -p $PWD/_pkg
101 mv arch/x86/boot/bzImage $PWD/_pkg
102 mv System.map System.map-without-modules
104 echo "Now build bzImage with modules"
106 # Build bzImage with modules
107 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
108 make oldconfig
109 ln .config $WOK/$PACKAGE/slitaz/config
110 make $MAKEFLAGS bzImage &&
111 make $MAKEFLAGS modules &&
112 make INSTALL_MOD_PATH=$PWD/_pkg modules_install &&
113 make INSTALL_HDR_PATH=$PWD/_pkg/usr headers_install &&
114 [ -s arch/x86/boot/bzImage ] || return 1
115 mkdir -p $PWD/_pkg/boot 2> /dev/null
116 mv arch/x86/boot/bzImage $PWD/_pkg/boot/vmlinuz-$VERSION-slitaz
118 echo "Compressing all modules"
120 # Compress all modules.
121 $stuff/gztazmod.sh $PWD/_pkg/lib/modules/$VERSION-slitaz
122 ln System.map System.map-modules
123 ln Module.symvers Module.symvers-modules
124 }
126 # Rules to gen a SliTaz package suitable for Tazpkg.
127 genpkg_rules()
128 {
129 local path
130 cp -a $_pkg/boot $fs
131 # Compress all modules.
132 #$stuff/gztazmod.sh $_pkg/lib/modules/$VERSION-slitaz
133 path=$fs/lib/modules/$VERSION-slitaz/kernel
134 mkdir -p $path
135 cp -a $_pkg/lib/modules/$VERSION-slitaz/mo* \
136 $fs/lib/modules/$VERSION-slitaz
137 # Get the base modules
138 export src
139 export _pkg
140 mkdir $WOK/$PACKAGE/tmp
141 $stuff/list_modules.sh \
142 $(cat stuff/modules-$VERSION.list) > $WOK/$PACKAGE/tmp/modules.list
143 while read module; do
144 dir=$(dirname $module)
145 [ -d $path/$dir ] || mkdir -p $path/$dir
146 cp -a $_pkg/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
147 done < $WOK/$PACKAGE/tmp/modules.list
148 # Remove unresolved links
149 rm -f $fs/lib/modules/$VERSION-slitaz/build
150 rm -f $fs/lib/modules/$VERSION-slitaz/source
151 # Check and echo any module in kernel .config that's not added to
152 # one of linux-* pkgs
153 export PACKAGE
154 $stuff/check_modules.sh
155 }
157 # Pre and post install commands for Tazpkg.
158 post_install()
159 {
160 echo "Processing post-install commands..."
161 chroot "$1/" depmod -a $VERSION-slitaz
162 # GRUB stuff.
163 if [ -f "$1/boot/grub/menu.lst" ]; then
164 root_dev=`cat $1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1`
165 grub_dev=`cat $1/boot/grub/menu.lst | grep "root (" | head -n 1`
166 # Add new kernel entry in case of upgrade for installed system.
167 if ! grep -q $PACKAGE-$VERSION-slitaz $1/boot/grub/menu.lst; then
168 cat >> $1/boot/grub/menu.lst << EOT
170 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
171 $grub_dev
172 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
173 EOT
174 fi
175 # Display information message.
176 cat <<EOT
177 ----
178 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
180 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
181 $grub_dev
182 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
183 ----
184 EOT
185 fi
186 }