wok-current view linux-libre/receipt @ rev 19799
linux-libre: define AUFSDIR
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Feb 24 17:29:56 2017 +0100 (2017-02-24) |
parents | e129640c4d69 |
children | 9e8d7fd12ee2 |
line source
1 # SliTaz package receipt.
3 PACKAGE="linux-libre"
4 VERSION="2.6.37-gnu"
5 CATEGORY="base-system"
6 SHORT_DESC="The Linux Libre kernel and modules."
7 MAINTAINER="gokhlayeh@slitaz.org"
8 LICENSE="GPL2"
9 PROVIDE="linux"
10 TARBALL="$PACKAGE-$VERSION.tar.bz2"
11 WEB_SITE="http://www.fsfla.org/svnwiki/selibre/linux-libre/"
12 WGET_URL="http://www.fsfla.org/svnwiki/selibre/linux-libre/download/releases/$VERSION/$TARBALL"
13 CONFIG_FILES="/lib/modules/$VERSION-slitaz/modules.dep"
15 DEPENDS="depmod"
16 BUILD_DEPENDS="slitaz-toolchain perl git lzma patch aufs"
18 # Rules to configure and make the package.
19 compile_rules()
20 {
21 # this is code to help update the kernel version faster
22 #for i in $(grep -l 'WANTED="linux-libre"' $WOK/*/receipt)
23 #do
24 # sed -i 's|VERSION="OLDVERSION"|VERSION="NEWVERSION"|g' $i
25 #done
27 [ ! -x /usr/bin/cook ] && report open-bloc
29 # Check for Aufs and cook it if unbuilt.
30 echo "Checking for Aufs packages..."
31 _AUFSVER=`grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
32 AUFSDIR=$WOK/aufs/source/aufs-${_AUFSVER}
33 if [ ! -x /usr/bin/cook ]; then
34 # We only need aufs source. Also cooking now is a bad idea since it
35 # needs linux-module-headers.
36 AUFSDIR=$WOK/aufs/aufs-${_AUFSVER}
37 [ -d "$AUFSDIR" ] && rm -rf $AUFSDIR
38 tazwok get-src aufs --target=$AUFSDIR || { report close-bloc; return 1; }
39 fi
41 echo "Copying Aufs files and patches..."
42 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
43 cp -a $AUFSDIR/*.patch $stuff
45 # SliTaz db
46 rm -rf $WOK/$PACKAGE/slitaz && mkdir $WOK/$PACKAGE/slitaz
47 echo "$WGET_URL" > $WOK/$PACKAGE/slitaz/url
48 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/slitaz
49 cp $stuff/bootloader.sh $WOK/$PACKAGE/slitaz
51 # Apply patches
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 || { report close-bloc; 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 aufs2-base.patch
68 aufs2-standalone.patch
69 001-squashfs-decompressors-add-xz-decompressor-module.patch
70 002-squashfs-decompressors-add-boot-time-xz-support.patch
71 003-squashfs-x86-support-xz-compressed-kernel.patch
72 004-squashfs-add-xz-compression-support.patch
73 005-squashfs-add-xz-compression-configuration-option.patch
74 EOT
76 [ ! -x /usr/bin/cook ] && report step "Make kernel proper and then build lguest"
78 make mrproper
79 cd Documentation/lguest
80 make $MAKEFLAGS lguest || { report close-bloc; return 1; }
81 cd $src
83 [ ! -x /usr/bin/cook ] && report step "Make bzImage without modules first"
85 # Build bzImage without modules first
86 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
87 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
89 # We can't keep every driver in staging
90 sed -i -e 's/^CONFIG_RTL8192/#&/' \
91 -e 's/^CONFIG_R8187SE/#&/' \
92 -e 's/^CONFIG_RT2870/#&/' .config
93 yes '' | make oldconfig
94 make $MAKEFLAGS bzImage || { report close-bloc; return 1; }
95 [ -d $DESTDIR ] || mkdir -p $DESTDIR
96 mv arch/x86/boot/bzImage $DESTDIR
97 mv System.map System.map-without-modules
99 [ ! -x /usr/bin/cook ] && report step "Now build bzImage with modules"
101 # Build bzImage with modules
102 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
103 make oldconfig
104 ln .config $WOK/$PACKAGE/slitaz/config
105 make $MAKEFLAGS bzImage &&
106 make $MAKEFLAGS modules &&
107 make INSTALL_MOD_PATH=$DESTDIR modules_install &&
108 make INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
109 [ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; }
110 mkdir -p $DESTDIR/boot 2> /dev/null
111 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
113 [ ! -x /usr/bin/cook ] && report step "Compressing all modules"
115 # Compress all modules.
116 $stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
117 ln System.map System.map-modules
118 ln Module.symvers Module.symvers-modules
120 if [ ! -x /usr/bin/cook ]; then
121 report close-bloc
122 fi
123 }
125 # Rules to gen a SliTaz package suitable for Tazpkg.
126 genpkg_rules()
127 {
128 local path
129 cp -a $install/boot $fs
130 # Compress all modules.
131 #$stuff/gztazmod.sh $install/lib/modules/$VERSION-slitaz
132 path=$fs/lib/modules/$VERSION-slitaz/kernel
133 mkdir -p $path
134 cp -a $install/lib/modules/$VERSION-slitaz/mo* \
135 $fs/lib/modules/$VERSION-slitaz
136 # Get the base modules
137 export src
138 export _pkg
139 mkdir $WOK/$PACKAGE/tmp
140 $stuff/list_modules.sh \
141 $(cat stuff/modules-$VERSION.list) > $WOK/$PACKAGE/tmp/modules.list
142 while read module; do
143 dir=$(dirname $module)
144 [ -d $path/$dir ] || mkdir -p $path/$dir
145 cp -a $install/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
146 done < $WOK/$PACKAGE/tmp/modules.list
147 # Remove unresolved links
148 rm -f $fs/lib/modules/$VERSION-slitaz/build
149 rm -f $fs/lib/modules/$VERSION-slitaz/source
151 # Pack all packages with a kernel module
152 for i in $(cd $WOK; grep -l '^WANTED="linux-libre"' */receipt); do
153 [ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1
154 cook ${i%/receipt}
155 done
157 # Check and echo any module in kernel .config that's not added to
158 # one of linux-* pkgs
159 export PACKAGE
160 $stuff/check_modules.sh
161 }
163 # Pre and post install commands for Tazpkg.
164 post_install()
165 {
166 chroot "$1/" depmod -a $VERSION-slitaz
167 # GRUB stuff.
168 if [ -f "$1/boot/grub/menu.lst" ]; then
169 root_dev=$(cat "$1/boot/grub/menu.lst" | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1)
170 grub_dev=$(cat "$1/boot/grub/menu.lst" | grep "root (" | head -n 1)
171 # Add new kernel entry in case of upgrade for installed system.
172 if ! grep -q $PACKAGE-$VERSION-slitaz "$1/boot/grub/menu.lst"; then
173 cat >> "$1/boot/grub/menu.lst" <<EOT
175 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
176 $grub_dev
177 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
178 EOT
179 fi
180 # Display information message.
181 cat <<EOT
182 ----
183 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
185 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
186 $grub_dev
187 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
188 ----
189 EOT
190 fi
191 true
192 }