wok-6.x view linux/receipt @ rev 19079
firefox-official: update depends
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Thu Apr 28 01:31:42 2016 +0300 (2016-04-28) |
parents | 9e01bc6321ea |
children | ccc74276c193 |
line source
1 # SliTaz package receipt.
3 PACKAGE="linux"
4 VERSION="3.2.71"
5 CATEGORY="base-system"
6 SHORT_DESC="The Linux kernel and modules."
7 MAINTAINER="devel@slitaz.org"
8 LICENSE="GPL2"
9 TARBALL="$PACKAGE-$VERSION.tar.xz"
10 WEB_SITE="http://www.kernel.org/"
11 WGET_URL="http://www.kernel.org/pub/linux/kernel/v3.0/$TARBALL"
12 HOST_ARCH="i486 arm x86_64"
14 DEPENDS="kmod"
15 BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch kmod \
16 uclibc-cross-compiler-x86_64"
18 #
19 # The Linux receipt handle cross compilation. For x86_64 we actually use
20 # the uclibc-cross-compiler-x86_64 and for ARM we use a real cross env.
21 # Please discuss any change and keep it simple, dont play with VERSION
22 # string or Kernel SUBLEVEL because depmod and Pankso dont like that!
23 #
24 # The receipt also handle some cook options for faster build:
25 # --nox64 : Skip the x86_64 cross compilation
26 # --nonomods : Skip bzImage without modules build
27 #
29 # Aufs enable chroot
30 AUFS_NOT_RAMFS="uclibc-cross-compiler-x86_64 is not compatible with aufs+tmpfs 8("
32 # Handle multiarch compilation. Less bdeps when cross-compiling for ARM
33 case "$ARCH" in
34 arm) BUILD_DEPENDS="xz" ;;
35 x86_64) BUILD_DEPENDS="xz" ;;
36 esac
38 # Handle multiarch installation. ARM use Busybox modutils, so avoid any
39 # deps on kmod. SLITAZ_ARCH can have also custom post_install commands
40 if [ -f $root/etc/slitaz/slitaz.conf ]; then
41 . $root/etc/slitaz/slitaz.conf
42 case "$SLITAZ_ARCH" in
43 arm) DEPENDS="" ;;
44 esac
45 fi
47 install_module_headers()
48 {
49 local path
50 path=usr/src/linux-$KVERSION
51 mkdir -p $1/lib/modules/$KVERSION
52 ln -sf /$path $1/lib/modules/$KVERSION/build
53 install -D -m644 $src/Makefile \
54 $1/$path/Makefile
55 install -D -m644 $src/kernel/Makefile \
56 $1/$path/kernel/Makefile
57 install -D -m644 $src/.config \
58 $1/$path/.config
59 mkdir -p $1/$path/include
61 for i in acpi asm-generic config crypto drm generated linux math-emu \
62 media net pcmcia scsi sound trace video xen; do
63 cp -a $src/include/$i $1/$path/include/
64 done
66 # copy arch includes for external modules
67 mkdir -p $1/$path/arch/x86
68 cp -a $src/arch/x86/include $1/$path/arch/x86/
70 # copy files necessary for later builds, like nvidia and vmware
71 cp -a $src/Module.symvers $1/$path/Module.symvers
72 cp -a $src/scripts $1/$path
73 # fix permissions on scripts dir
74 chmod og-w -R $1/$path/scripts
75 mkdir -p $1/$path/.tmp_versions
77 mkdir -p $1/$path/arch/x86/kernel
78 cp -a $src/arch/x86/Makefile $1/$path/arch/x86/
79 cp -a $src/arch/x86/Makefile_32.cpu $1/$path/arch/x86/
80 cp -a $src/arch/x86/kernel/asm-offsets.s $1/$path/arch/x86/kernel/
82 # add headers for lirc package
83 mkdir -p $1/$path/drivers/media/video
84 cp -a $src/drivers/media/video/*.h $1/$path/drivers/media/video/
86 for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102 ; do
87 mkdir -p $1/$path/drivers/media/video/$i
88 cp -a $src/drivers/media/video/$i/*.h $1/$path/drivers/media/video/$i
89 done
91 # add docbook makefile
92 install -D -m644 $src/Documentation/DocBook/Makefile \
93 $1/$path/Documentation/DocBook/Makefile
95 # add dm headers
96 mkdir -p $1/$path/drivers/md
97 cp -a $src/drivers/md/*.h $1/$path/drivers/md
99 # add inotify.h
100 mkdir -p $1/$path/include/linux
101 cp -a $src/include/linux/inotify.h $1/$path/include/linux/
103 # add wireless headers
104 mkdir -p $1/$path/net/mac80211/
105 cp -a $src/net/mac80211/*.h $1/$path/net/mac80211/
107 # add dvb headers for external modules
108 # in reference to:
109 # http://bugs.archlinux.org/task/9912
110 mkdir -p $1/$path/drivers/media/dvb/dvb-core
111 cp -a $src/drivers/media/dvb/dvb-core/*.h $1/$path/drivers/media/dvb/dvb-core/
113 # add dvb headers for external modules
114 # in reference to:
115 # http://bugs.archlinux.org/task/11194
116 if [ -d $src/include/config/dvb/ ]; then
117 mkdir -p $1/$path/include/config/dvb/
118 cp $src/include/config/dvb/*.h $1/$path/include/config/dvb/
119 fi
121 # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
122 # in reference to:
123 # http://bugs.archlinux.org/task/13146
124 mkdir -p $1/$path/drivers/media/dvb/frontends/
125 cp -a $src/drivers/media/dvb/frontends/lgdt330x.h $1/$path/drivers/media/dvb/frontends/
126 cp -a $src/drivers/media/video/msp3400-driver.h $1/$path/drivers/media/dvb/frontends/
128 # add dvb headers
129 # in reference to:
130 # http://bugs.archlinux.org/task/20402
131 mkdir -p $1/$path/drivers/media/dvb/dvb-usb
132 cp -a $src/drivers/media/dvb/dvb-usb/*.h $1/$path/drivers/media/dvb/dvb-usb/
133 mkdir -p $1/$path/drivers/media/dvb/frontends
134 cp -a $src/drivers/media/dvb/frontends/*.h $1/$path/drivers/media/dvb/frontends/
135 mkdir -p $1/$path/drivers/media/common/tuners
136 cp -a $src/drivers/media/common/tuners/*.h $1/$path/drivers/media/common/tuners/
138 # add xfs and shmem for aufs building
139 mkdir -p $1/$path/fs/xfs
140 mkdir -p $1/$path/mm
141 cp -a $src/fs/xfs/xfs_sb.h $1/$path/fs/xfs/xfs_sb.h
143 # copy in Kconfig files
144 for i in $(find . -name "Kconfig*"); do
145 mkdir -p $1/$path/$(echo $i | sed 's|/Kconfig.*||')
146 cp -a $src/$i $1/$path/$i
147 done
149 chown -R root.root $1/$path
150 find $1/$path -type d -exec chmod 755 {} \;
151 # remove unneeded architectures
152 rm -rf $1/$path/arch/{alpha,arm,arm26,avr32,blackfin,cris,frv,h8300,ia64,m32r,m68k,m68knommu,mips,microblaze,mn10300,parisc,powerpc,ppc,s390,sh,sh64,sparc,sparc64,um,v850,xtensa}
153 }
155 # Rules to configure and make the package.
156 compile_rules()
157 {
158 if [ -f "/usr/share/boot/initrd" ]; then
159 cp /usr/share/boot/initrd initrd.cpio
160 fi
162 # Handle cross compilation
163 case "$ARCH" in
164 arm)
165 echo "Compiling: $ARCH Kernel"
166 make mrproper
167 patch -Np1 < $stuff/$ARCH/linux-arm.patch || exit 1
168 cp -f $stuff/$ARCH/linux-arm.config .config
169 yes '' | make ARCH=$ARCH oldconfig
170 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- bzImage &&
171 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- modules &&
172 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- \
173 INSTALL_MOD_PATH=$DESTDIR modules_install &&
174 mkdir -p $DESTDIR/boot &&
175 cp -a arch/arm/boot/zImage \
176 $DESTDIR/boot/linux-$VERSION-slitaz-$ARCH
177 #$stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
178 return 0 ;;
179 x86_64)
180 echo "TODO: Maybe use default ? But cross compile in x86_64 chroot"
181 echo "so we can remove the 64 build by uclibc-cross-compiler-x86_64"
182 return 0 ;;
183 esac
185 # Check for Aufs and get source/patches if needed
186 echo "Checking for Aufs packages..."
187 AUFSVER=$(grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g')
188 AUFSDIR="$WOK/aufs/source/aufs-${AUFSVER}"
189 if [ ! -d "$AUFSDIR" ]; then
190 [ ! -f "$SRC/aufs-${AUFSVER}.tar.bz2" ] && cook aufs --getsrc
191 mkdir -p $WOK/aufs/source/
192 echo "Extracting: aufs-${AUFSVER}.tar.bz2"
193 tar xjf $SRC/aufs-${AUFSVER}.tar.bz2 -C $WOK/aufs/source/
194 fi
196 echo "cook:linux" > $command
198 echo "Copying Aufs files and patches..."
199 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
200 cp -a $AUFSDIR/aufs3-*.patch $stuff
202 # SliTaz db stuff
203 [ -d $WOK/$PACKAGE/source/slitaz ] && rm -rf $WOK/$PACKAGE/source/slitaz
204 mkdir -p $WOK/$PACKAGE/source/slitaz
205 echo "$WGET_URL" > $WOK/$PACKAGE/source/slitaz/url
206 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/source/slitaz
207 cp $stuff/bootloader.sh $WOK/$PACKAGE/source/slitaz
209 # Apply patches
210 echo "Applying patches..."
211 while read patch_file; do
212 echo "$patch_file" >> $WOK/$PACKAGE/source/slitaz/patches
213 cp $stuff/$patch_file $WOK/$PACKAGE/source/slitaz
214 if [ -f done.$patch_file ]; then
215 echo "Skipping $patch_file" && continue
216 fi
217 echo "Apply $patch_file"
218 patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || return 1
219 touch done.$patch_file
220 done <<EOT
221 $PACKAGE-diff.u
222 $PACKAGE-header.u
223 $PACKAGE-freeinitrd.u
224 $PACKAGE-subroot.u
225 $PACKAGE-romfs.u
226 $PACKAGE-hardlinks.u
227 aufs3-base.patch
228 aufs3-standalone.patch
229 aufs3-loopback.patch
230 aufs3-mmap.patch
231 channel-negative-one-maxim.patch
232 mac80211.compat08082009.wl_frag+ack_v1.patch
233 EOT
235 # Mrproper and lguest
236 echo "Make kernel proper and then build lguest..."
237 make mrproper
238 cd Documentation/virtual/lguest
239 make lguest || return 1
240 cd $src
242 #
243 # Arch x86_64: TODO have a real cross environment
244 #
245 if [ ! "$nox64" ]; then
246 echo "Compiling: x86_64 Kernel"
248 # Build bzImage64 without modules first
249 if [ ! "$nonomods" ]; then
250 cp -f $stuff/$PACKAGE-slitaz.config64 .config
251 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
252 # We can't keep every driver in staging ???
253 sed -i -e 's/^CONFIG_RTL8192/#&/' \
254 -e 's/^CONFIG_R8187SE/#&/' \
255 -e 's/^CONFIG_RT2870/#&/' .config
256 echo -e "\n* Configure bzImage64 without modules...\n"
257 yes '' | make ARCH=x86_64 oldconfig
258 echo -e "\n* Building bzImage64 without modules...\n"
259 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || exit 1
260 [ -d $DESTDIR ] || mkdir -p $DESTDIR/linux64
261 mv arch/x86/boot/bzImage $DESTDIR/linux64
262 mv System.map System.map-without-modules64
263 fi
265 # Build bzImage64 with modules
266 cp -f $stuff/$PACKAGE-slitaz.config64 .config
267 echo -e "\n* Configure bzImage64 with modules...\n"
268 yes '' | make ARCH=x86_64 oldconfig
269 echo -e "\n* Building bzImage64 with modules...\n"
270 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage &&
271 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- modules &&
272 make ARCH=x86_64 INSTALL_MOD_PATH=$DESTDIR/linux64 modules_install &&
273 make ARCH=x86_64 INSTALL_HDR_PATH=$DESTDIR/linux64/usr headers_install &&
274 ln .config $WOK/$PACKAGE/source/slitaz/config64
275 [ -s arch/x86/boot/bzImage ] || return 1
276 mkdir -p $DESTDIR/linux64/boot 2> /dev/null
277 mv arch/x86/boot/bzImage $DESTDIR/linux64/boot/vmlinuz-$VERSION-slitaz64
278 KVERSION=$VERSION-slitaz64
279 install_module_headers $DESTDIR/linux64
280 ln System.map System.map-modules64
281 ln Module.symvers Module.symvers-modules64
282 else
283 echo "* Skipping: x86_64 Kernel..."
284 fi
286 #
287 # Linux Arch i386 - GCC arch i486
288 #
289 echo "Compiling: i386 Kernel..."
291 # Build bzImage without modules first
292 if [ ! "$nonomods" ]; then
293 cp -f $stuff/$PACKAGE-slitaz.config .config
294 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
295 # We can't keep every driver in staging ???
296 sed -i -e 's/^CONFIG_RTL8192/#&/' \
297 -e 's/^CONFIG_R8187SE/#&/' \
298 -e 's/^CONFIG_RT2870/#&/' .config
299 echo -e "\n* Configure bzImage without modules...\n"
300 yes '' | make ARCH=i386 oldconfig
301 echo -e "\n* Building bzImage without modules...\n"
302 make ARCH=i386 -j 4 bzImage || exit 1
303 [ -d $DESTDIR ] || mkdir -p $DESTDIR
304 mv arch/x86/boot/bzImage $DESTDIR
305 mv System.map System.map-without-modules
306 fi
308 # Build bzImage with modules
309 cp -f $stuff/$PACKAGE-slitaz.config .config
310 echo -e "\n* Configure bzImage with modules...\n"
311 yes '' | make ARCH=i386 oldconfig
312 ln .config $WOK/$PACKAGE/source/slitaz/config
313 echo -e "\n* Building bzImage with modules...\n"
314 make ARCH=i386 -j 4 bzImage &&
315 make ARCH=i386 -j 4 modules &&
316 make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR modules_install &&
317 make ARCH=i386 INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
318 [ -s arch/x86/boot/bzImage ] || return 1
319 mkdir -p $DESTDIR/boot 2> /dev/null
320 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
321 KVERSION=$VERSION-slitaz
322 install_module_headers $DESTDIR
324 # Compress all modules.
325 if [ -d "$DESTDIR/lib/modules/$VERSION-slitaz" ]; then
326 $stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
327 else
328 return 1
329 fi
330 if [ -d "$DESTDIR/linux64/lib/modules/$VERSION-slitaz64" ]; then
331 $stuff/gztazmod.sh $DESTDIR/linux64/lib/modules/$VERSION-slitaz64
332 fi
333 ln System.map System.map-modules
334 ln Module.symvers Module.symvers-modules
335 }
337 # Rules to gen a SliTaz package suitable for Tazpkg.
338 genpkg_rules()
339 {
340 case "$ARCH" in
341 arm)
342 echo "Packing: ARM Kernel"
343 cp -a $install/* $fs
344 rm -f $fs/lib/modules/*/build $fs/lib/modules/*/source
345 return 0 ;;
346 x86_64)
347 echo "TODO: use default or custom x86_64 packing"
348 return 0 ;;
349 esac
351 export PACKAGE VERSION
352 local path
353 cp -a $install/boot $fs
355 # Compress all modules.
356 path=$fs/lib/modules/$VERSION-slitaz/kernel
357 mkdir -p $path
359 # Get the base modules
360 export src install
361 mkdir -p $WOK/$PACKAGE/source/tmp
362 # Warning stuff/list_modules.sh must find the generated modules.list
363 $stuff/list_modules.sh \
364 $(cat $stuff/modules.list) > $WOK/$PACKAGE/source/tmp/modules.list
365 while read module; do
366 dir=$(dirname $module)
367 [ -d $path/$dir ] || mkdir -p $path/$dir
368 cp -a $install/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
369 done < $WOK/$PACKAGE/source/tmp/modules.list
371 # Remove unresolved links
372 rm -f $fs/lib/modules/$VERSION-slitaz/build
373 rm -f $fs/lib/modules/$VERSION-slitaz/source
375 # We only need module.{order,builtin} because other map files are
376 # generated by depmod in post_install
377 cp -a $install/lib/modules/$VERSION-slitaz/modules.order \
378 $install/lib/modules/$VERSION-slitaz/modules.builtin \
379 $fs/lib/modules/$VERSION-slitaz
381 # Pack all packages with a kernel module
382 for i in $(cd $WOK; grep -l '^WANTED="linux"' */receipt); do
383 [ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1
384 cook ${i%/receipt}
385 done
387 # Check any module in kernel .config that's not added to a linux-* pkgs
388 # and remove aufs patches: we dont need them in HG wok.
389 $stuff/check_modules.sh
390 rm -f $stuff/aufs3-*
391 }
393 # Pre and post install commands for Tazpkg.
394 post_install()
395 {
396 chroot "$root/" depmod -a $VERSION-slitaz
398 # Handle multiarch installation
399 case "$SLITAZ_ARCH" in
400 arm)
401 echo "Kernel : /boot/linux-$VERSION-slitaz-$ARCH"
402 echo "Modules: /lib/modules/$VERSION-slitaz"
403 return 0 ;;
404 esac
406 # GRUB stuff.
407 if [ -f "$1/boot/grub/menu.lst" ]; then
408 # Current root device
409 root_dev="/dev/$(lsblk | grep '/$'| grep -o '[a-z]d[a-z][0-9]*')"
410 grub_part="$(( $(echo $root_dev | grep -o '[0-9]*$')-1 ))"
411 # Use device.map to find grub device number
412 grub_dev="$(grep $(echo $root_dev | grep -o '^/dev/.d.' ) \
413 "$1/boot/grub/device.map" | cut -f1 | sed "s/)$/.$grub_part)/g")"
415 # Add and clean kernel entries in case of upgrade for installed system.
416 if ! grep -q vmlinuz-$VERSION-slitaz "$1/boot/grub/menu.lst"; then
418 # Clean the old entry
419 # TODO: old vmlinuz file is removed but the entry is still there.
420 # So grub error:15 when selected: http://bugs.slitaz.org/?id=74
422 # Add the new entry
423 cat >> "$1/boot/grub/menu.lst" << EOT
425 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
426 $grub_dev
427 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev quiet
428 EOT
429 # Make it the default entry
430 last_entry=$(( $(grep -c '^title' "$1/boot/grub/menu.lst")-1 ))
431 sed -e "s/^default.*/default $last_entry/g" -i "$1/boot/grub/menu.lst"
432 fi
434 # Display information message.
435 cat <<EOT
437 ----
438 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
440 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
441 $grub_dev
442 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
443 ----
444 EOT
445 fi
446 true
447 }