wok-tiny view linux/receipt @ rev 141

linux: pack setup (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jul 07 11:56:18 2018 +0200 (2018-07-07)
parents d71bd8881bcd
children df0a7ccded6c
line source
1 # SliTaz package receipt.
3 PACKAGE="linux"
4 VERSION="2.6.14"
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 WEB_SITE2="http://elinux.org/Linux_Tiny"
14 PATCH="https://www.selenic.com/tiny/2.6.14-tiny1.patch.bz2"
15 AUTO_SELECTION="always"
17 DEPENDS=""
18 BUILD_DEPENDS="slitaz-toolchain perl git lzma wget gcc2"
19 BUILD_SUGGESTED="advancecomp zopfli lz4 grep"
21 case "$TARGET" in
22 i486) SUGGESTED="memtest ipxe";; # bundle may install a boot menu
23 esac
25 S2bin()
26 {
27 [ -s $stuff/$1.S ] &&
28 cc -o $1.o -Wa,-algms=$1.lst -c $stuff/$1.S &&
29 objcopy -O binary $1.o $1.bin
30 }
32 # Rules to configure and make the package.
33 compile_rules()
34 {
35 [ -s $SRC/$(basename $PATCH) ] ||
36 wget --no-check-certificate -O $SRC/$(basename $PATCH) $PATCH
37 bzcat $SRC/$(basename $PATCH) | patch -p1
38 patch -p0 < $stuff/linux-2.6.14-unpack.u
39 patch -p0 < $stuff/jsclipboard.u
40 sed -i 's|\([>\.]\)val|\1u.val|;s|\([>\.]\)next|\1u.next|;216s|};|} u;|' \
41 lib/inflate.c
42 sed '/DEBUG/,/* kstrdup/d' < mm/slab.c > mm/kstrdup.c
43 echo 'obj-y += kstrdup.o' >> mm/Makefile
44 sed -i 's|3.1024|11*256|' arch/i386/boot/compressed/misc.c
45 sed -i 's/O_CREAT/&|O_TRUNC/' init/initramfs.c
46 which advdef 2> /dev/null &&
47 sed -i 's|gzip)|&\n advdef -z4 $@|' \
48 usr/Makefile arch/i386/boot/compressed/Makefile
49 which zopfli 2> /dev/null &&
50 sed -i 's|gzip -f -9 <|time zopfli --i100 -c|' scripts/Makefile.lib
52 [ -s $WOK/busybox/source/busybox*/rootfs.cpio ] || tazwok cook busybox
53 cp $WOK/busybox/source/busybox*/rootfs.cpio $src
54 cp $WOK/busybox/source/busybox*/.config $src/config-busybox
55 mkdir $src/slitaz
56 cp $stuff/list_modules.sh $src/slitaz
57 S2bin bootloader
58 S2bin helper
59 S2bin unpacklz4
60 cp $stuff/pack .
61 ./pack --build
63 sed -i '/config %config:/{NNNps/config %config:/%config:/}' Makefile
64 sed -i 's/^config %config:/config:/' Makefile
65 cp $stuff/linux-$VERSION-slitaz.config .config
66 yes '' | make ARCH=i386 HOSTCC=gcc-2 config
67 make ARCH=i386 CC=gcc-2 HOSTCC=gcc-2 -j 4 bzImage
68 grep -q "CONFIG_MODULES=y" .config &&
69 make ARCH=i386 CC=gcc-2 HOSTCC=gcc-2 -j 4 modules &&
70 make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR -j 1 modules_install || true
71 S2bin bundle
72 cp $stuff/bundle .
73 ./bundle
74 S2bin cmdline
75 }
77 # Rules to gen a SliTaz package suitable for Tazpkg.
78 genpkg_rules()
79 {
80 mkdir $fs/boot
81 cp -a $src/arch/i386/boot/bzImage $fs/boot/
82 dd if=$src/bootloader.bin of=$fs/boot/bzImage conv=notrunc
83 dd if=$src/cmdline.bin bs=1 seek=560 of=$fs/boot/bzImage conv=notrunc
84 cp -a $src/pack $fs/boot/
85 cp -a $src/System.map $fs/boot/
86 cp -a $src/.config $fs/boot/config
87 cp -a $src/config-busybox $fs/boot
88 cp -a $src/bundle.sh $fs/boot/bundle
89 }
91 # Pre and post install commands for Tazpkg.
92 post_install()
93 {
94 echo "Processing post-install commands..."
95 chroot "$1/" /boot/depmod -a $VERSION-slitaz
96 [ -s $1/boot/cmdline ] && cat $1/boot/cmdline | sed 's/^ *//' | \
97 dd of=$1/boot/bzImage conv=notrunc bs=1 seek=768 count=3072 2> /dev/null
98 $1/boot/pack $1/boot/bzImage
100 # GRUB stuff.
101 if [ -f "$1/boot/grub/menu.lst" ]; then
102 root_dev=$(sed '/root=/!d;s/.*root=\([^ ]*\).*/\1/' \
103 < $1/boot/grub/menu.lst | head -n 1)
104 grub_dev=$(grep "root (" < $1/boot/grub/menu.lst | head -n 1)
105 # Add new kernel entry in case of upgrade for installed system.
106 grep -q $SOURCE-$VERSION-slitaz $1/boot/grub/menu.lst ||
107 [ -s $1/boot/cmdline ] && cmdline=" $(cat $1/boot/cmdline)"
108 cat >> $1/boot/grub/menu.lst << EOT
110 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
111 $grub_dev
112 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev$cmdline
113 EOT
114 # Display information message.
115 cat <<EOT
116 ----
117 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
119 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
120 $grub_dev
121 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev$cmdline
122 ----
123 EOT
124 fi
125 }