wok-tiny view linux/receipt @ rev 174

Up linux 2.6.20 (avoid 386 & 486 problems)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Jul 14 14:20:00 2021 +0000 (2021-07-14)
parents eb617e43dc08
children 5e2b41f82f13
line source
1 # SliTaz package receipt.
3 PACKAGE="linux"
4 VERSION="2.6.20"
5 CATEGORY="base-system"
6 SHORT_DESC="The Linux kernel."
7 TARGET="i486"
8 MAINTAINER="devel@slitaz.org"
9 LICENSE="GPL2"
10 TARBALL="$PACKAGE-$VERSION.tar.bz2"
11 WEB_SITE="http://www.kernel.org/"
12 WGET_URL="https://www.kernel.org/pub/linux/kernel/v${VERSION:0:3}/$TARBALL"
13 AUTO_SELECTION="always"
15 DEPENDS=""
16 BUILD_DEPENDS="slitaz-toolchain perl git lzma wget upx"
17 INSTALL_DEPENDS="lz4 grep"
19 case "$TARGET" in
20 i486) SUGGESTED="memtest ipxe plop tfttest x86test";; # bundle may install a boot menu
21 esac
23 S2bin()
24 {
25 [ -s $stuff/$1.S ] &&
26 cc -o $1.o -Wa,-algms=$1.lst -c $stuff/$1.S &&
27 objcopy -O binary $1.o $1.bin
28 }
30 rootfs()
31 {
32 [ -s $stuff/root.cpio ] && cp $stuff/root.cpio . &&
33 sed -i 's|CONFIG_INITRAMFS_SOURCE="|&root.cpio|' .config
34 }
36 # Rules to configure and make the package.
37 compile_rules()
38 {
39 export CFLAGS="-march=i386 -Os -pipe -fomit-frame-pointer"
40 for i in $stuff/linux-$VERSION-*.u ; do
41 patch -p0 < $i
42 done
43 sed -i 's/O_CREAT/&|O_TRUNC/' init/initramfs.c
44 sed -i 's|hostname|echo tank|' scripts/mkcompile_h
46 mkdir $src/slitaz
47 cp $stuff/list_modules.sh $src/slitaz
48 S2bin bootloader
49 S2bin helper
50 S2bin unpacklz4
51 cp $stuff/pack .
52 sh ./pack --build
54 sed -i '/config %config:/{NNNps/config %config:/%config:/}' Makefile &&
55 sed -i 's/^config %config:/config:/' Makefile
57 #2.6.20
58 sed -i '/\/ %\/:/{NNps/\/ %\/:/%\/:/}' Makefile &&
59 sed -i 's/^\/ %\/:/\/:/' Makefile
60 sed -i 's|.*netinet/in|#include <limits.h>\n&|' scripts/mod/sumversion.c
62 cp $stuff/linux-$VERSION-slitaz.config .config
63 rootfs
64 yes '' | make ARCH=i386 HOSTCC=gcc config
65 make ARCH=i386 CC=gcc HOSTCC=gcc -j 4 bzImage
67 grep -q "CONFIG_MODULES=y" .config &&
68 make ARCH=i386 CC=gcc HOSTCC=gcc -j 4 modules &&
69 make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR -j 1 modules_install || true
70 S2bin bundle
71 cp $stuff/bundle .
72 sh ./bundle
73 S2bin cmdline
74 [ $(upx --version 2> /dev/null | sed '/upx/!d;s|upx ||;s|\.||;q')0 -ge 3960 ] &&
75 upx --ultra-brute arch/i386/boot/bzImage
76 cp arch/i386/boot/bzImage arch/i386/boot/bzImage.386
77 cp .config .config.386
78 cp System.map System.map.386
79 cp $stuff/linux-$VERSION-slitaz.config.586 .config
80 rootfs
81 yes '' | make ARCH=i386 HOSTCC=gcc config
82 make ARCH=i386 CC=gcc HOSTCC=gcc -j 4 bzImage
83 which upx 2> /dev/null && upx --ultra-brute arch/i386/boot/bzImage
84 }
86 # Rules to gen a SliTaz package suitable for Tazpkg.
87 genpkg_rules()
88 {
89 mkdir $fs/boot
90 cp -a $src/pack $fs/boot/
91 cp -a $src/bundle.sh $fs/boot/bundle
92 for i in '' .386 ; do
93 [ -s $src/arch/i386/boot/bzImage$i ] || continue
94 cp -a $src/arch/i386/boot/bzImage$i $fs/boot/
95 dd if=$src/bootloader.bin of=$fs/boot/bzImage$i conv=notrunc
96 dd if=$src/cmdline.bin bs=1 seek=560 of=$fs/boot/bzImage$i conv=notrunc
97 cp -a $src/System.map$i $fs/boot/
98 cp -a $src/.config$i $fs/boot/config$i
99 done
100 }
102 config_form()
103 {
104 cat <<EOT
105 <p>
106 Tune the kernel according to the CPU type
107 </p>
108 <table>
109 <tr>
110 <td><input type="radio" name="CPU586" $([ "$CPU586" = "no" ] && echo "checked=checked ")value="no"> for any CPU starting from 386sx</td>
111 <td><input type="radio" name="CPU586" $([ "$CPU586" != "no" ] && echo "checked=checked ")value="yes"> optimized for pentium or newer CPU</td>
112 </tr>
113 </table>
114 EOT
115 }
117 # Pre and post install commands for Tazpkg.
118 post_install()
119 {
120 for i in $1/boot/*.386 ; do
121 [ "$CPU586" = "yes" ] && rm -f $i || mv -f $i ${i%.386}
122 done 2> /dev/null
123 [ -s $1/boot/cmdline ] && cat $1/boot/cmdline | sed 's/^ *//' | \
124 dd of=$1/boot/bzImage conv=notrunc bs=1 seek=768 count=3072
125 $1/boot/pack $1/boot/bzImage
126 }