wok-tiny view linux/receipt @ rev 95

linux: add bootloader
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Oct 06 21:04:42 2015 +0200 (2015-10-06)
parents 371673f39e46
children 2cc2f08d75b7
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 BUILD_DEPENDS="slitaz-toolchain perl git lzma wget gcc2 advancecomp"
19 # Rules to configure and make the package.
20 compile_rules()
21 {
22 [ -s $SRC/$(basename $PATCH) ] ||
23 wget --no-check-certificate -O $SRC/$(basename $PATCH) $PATCH
24 bzcat $SRC/$(basename $PATCH) | patch -p1
25 sed -i 's|\([>\.]\)val|\1u.val|;s|\([>\.]\)next|\1u.next|;216s|};|} u;|' lib/inflate.c
26 sed '/DEBUG/,/* kstrdup/d' < mm/slab.c > mm/kstrdup.c
27 echo 'obj-y += kstrdup.o' >> mm/Makefile
28 sed -i 's|3.1024|11*256|' arch/i386/boot/compressed/misc.c
29 which advdef 2> /dev/null &&
30 sed -i 's|gzip)|&\n advdef -z4 $@|' usr/Makefile arch/i386/boot/compressed/Makefile
32 if [ ! -s $WOK/busybox/source/busybox*/rootfs.cpio ]; then
33 tazwok cook busybox
34 fi
35 cp $WOK/busybox/source/busybox*/rootfs.cpio $src
36 cp $WOK/busybox/source/busybox*/.config $src/config-busybox
37 mkdir $src/slitaz
38 cp $stuff/list_modules.sh $src/slitaz
39 cc -o bootloader.o -Wa,-algms=bootloader.lst -c $stuff/bootloader.S
40 objcopy -O binary bootloader.o bootloader.bin
42 sed -i 's/^config %config/config/' Makefile
43 cp $stuff/linux-$VERSION-slitaz.config .config
44 yes '' | make ARCH=i386 HOSTCC=gcc-2 config
45 make ARCH=i386 CC=gcc-2 HOSTCC=gcc-2 -j 4 bzImage
46 grep -q "CONFIG_MODULES=y" .config &&
47 make ARCH=i386 CC=gcc-2 HOSTCC=gcc-2 -j 4 modules &&
48 make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR -j 1 modules_install || true
49 }
51 # Rules to gen a SliTaz package suitable for Tazpkg.
52 genpkg_rules()
53 {
54 mkdir $fs/boot
55 cp -a $src/arch/i386/boot/bzImage $fs/boot/
56 dd if=$src/bootloader.bin of=$fs/boot/bzImage conv=notrunc
57 cp -a $src/System.map $fs/boot/
58 cp -a $src/.config $fs/boot/config
59 cp -a $src/config-busybox $fs/boot
60 cp -a $stuff/bundle $fs/boot
61 }
63 # Pre and post install commands for Tazpkg.
64 post_install()
65 {
66 echo "Processing post-install commands..."
67 chroot "$1/" depmod -a $VERSION-slitaz
68 # GRUB stuff.
69 if [ -f "$1/boot/grub/menu.lst" ]; then
70 root_dev=`cat $1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1`
71 grub_dev=`cat $1/boot/grub/menu.lst | grep "root (" | head -n 1`
72 # Add new kernel entry in case of upgrade for installed system.
73 if ! grep -q $SOURCE-$VERSION-slitaz $1/boot/grub/menu.lst; then
74 cat >> $1/boot/grub/menu.lst << EOT
76 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
77 $grub_dev
78 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
79 EOT
80 fi
81 # Display information message.
82 cat <<EOT
83 ----
84 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
86 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
87 $grub_dev
88 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
89 ----
90 EOT
91 fi
92 }