wok-tiny view linux/receipt @ rev 183

linux: fix bundle.S
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Sep 26 17:09:38 2023 +0000 (7 months ago)
parents d5c772484b59
children
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 $2 -o $1.o -Wa,-algms=$1.lst -c $stuff/$1.S &&
27 objcopy --only-section=.text -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 setup_code()
37 {
38 echo $((514 + $(od -An -j 513 -N 1 -i $1)))
39 }
41 # Rules to configure and make the package.
42 compile_rules()
43 {
44 export CFLAGS="-march=i386 -Os -pipe -fomit-frame-pointer"
45 for i in $stuff/linux-$VERSION-*.u ; do
46 patch -p0 < $i
47 done
48 sed -i 's/O_CREAT/&|O_TRUNC/' init/initramfs.c
49 sed -i 's|hostname|echo tank|' scripts/mkcompile_h
51 mkdir $src/slitaz
52 cp $stuff/list_modules.sh $src/slitaz
53 S2bin bootloader
54 S2bin helper
55 S2bin unpacklz4
56 cp $stuff/pack $stuff/un*.S .
58 sed -i '/config %config:/{NNNps/config %config:/%config:/}' Makefile &&
59 sed -i 's/^config %config:/config:/' Makefile
61 #2.6.20
62 sed -i '/\/ %\/:/{NNps/\/ %\/:/%\/:/}' Makefile &&
63 sed -i 's/^\/ %\/:/\/:/' Makefile
64 sed -i 's|.*netinet/in|#include <limits.h>\n&|' scripts/mod/sumversion.c
66 cp $stuff/linux-$VERSION-slitaz.config .config
67 rootfs
68 yes '' | make ARCH=i386 HOSTCC=gcc config
69 make ARCH=i386 CC=gcc HOSTCC=gcc -j 4 bzImage
70 cp arch/i386/boot/bzImage arch/i386/boot/bzImage.made.386
71 sh ./pack --build arch/i386/boot/bzImage.made.386
73 grep -q "CONFIG_MODULES=y" .config &&
74 make ARCH=i386 CC=gcc HOSTCC=gcc -j 4 modules &&
75 make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR -j 1 modules_install || true
76 S2bin bundle
77 cp $stuff/bundle .
78 sh ./bundle
79 S2bin cmdline -DEDIT_CMDLINE ; mv cmdline.bin editcmdline.bin
80 S2bin cmdline
81 [ $(upx --version 2> /dev/null | sed '/upx/!d;s|upx ||;s|\.||;q')0 -ge 3960 ] &&
82 upx --ultra-brute arch/i386/boot/bzImage
83 cp arch/i386/boot/bzImage arch/i386/boot/bzImage.386
84 cp .config .config.386
85 cp System.map System.map.386
86 cp $stuff/linux-$VERSION-slitaz.config.586 .config
87 rootfs
88 yes '' | make ARCH=i386 HOSTCC=gcc config
89 make ARCH=i386 CC=gcc HOSTCC=gcc -j 4 bzImage
90 cp arch/i386/boot/bzImage arch/i386/boot/bzImage.made
91 which upx 2> /dev/null && upx --ultra-brute arch/i386/boot/bzImage
92 }
94 # Rules to gen a SliTaz package suitable for Tazpkg.
95 genpkg_rules()
96 {
97 mkdir $fs/boot
98 cp -a $src/pack $fs/boot/
99 cp -a $src/bundle.sh $fs/boot/bundle
100 cp -a $src/cmdline.bin $fs/boot/
101 cp -a $src/editcmdline.bin $fs/boot/
102 for i in '' .386 ; do
103 [ -s $src/arch/i386/boot/bzImage$i ] || continue
104 cp -a $src/arch/i386/boot/bzImage$i $fs/boot/
105 dd if=$src/bootloader.bin of=$fs/boot/bzImage$i conv=notrunc 2> /dev/null
106 cp -a $src/System.map$i $fs/boot/
107 cp -a $src/.config$i $fs/boot/config$i
108 done
109 }
111 config_form()
112 {
113 cat <<EOT
114 <p>
115 Tune the kernel according to the CPU type
116 </p>
117 <table>
118 <tr>
119 <td><input type="radio" name="CPU586" $([ "$CPU586" = "no" ] && echo "checked=checked ")value="no"> for any CPU starting from 386sx</td>
120 <td><input type="radio" name="CPU586" $([ "$CPU586" != "no" ] && echo "checked=checked ")value="yes"> optimized for pentium or newer CPU</td>
121 </tr>
122 </table>
123 <input type="checkbox" name="EDIT_CMDLINE" ${EDIT_CMDLINE:+ckecked="ckecked" }/>
124 The user can edit the kernel cmdline at boot time.
125 EOT
126 }
128 # Pre and post install commands for Tazpkg.
129 post_install()
130 {
131 for i in $1/boot/*.386 ; do
132 [ "$CPU586" = "yes" ] && rm -f $i || mv -f $i ${i%.386}
133 done 2> /dev/null
134 [ -s $1/boot/cmdline ] && cat $1/boot/cmdline | sed 's/^ *//' | \
135 dd of=$1/boot/bzImage conv=notrunc bs=1 seek=768 count=3072 &&
136 dd if=$1/boot/cmdline.bin bs=1 seek=$(setup_code $1/boot/bzImage) of=$1/boot/bzImage conv=notrunc
137 [ "$EDIT_CMDLINE" ] &&
138 dd if=$1/boot/editcmdline.bin bs=1 seek=$(setup_code $1/boot/bzImage) of=$1/boot/bzImage conv=notrunc
139 $1/boot/pack $1/boot/bzImage
140 }