wok-next view linux/receipt @ rev 19585

linux: add openssl-dev to bdeps
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Jan 02 09:24:14 2017 +0200 (2017-01-02)
parents 119e586fb823
children cccf3f5a91f2
line source
1 # SliTaz package receipt.
3 PACKAGE="linux"
4 VERSION="4.9.0"
5 CATEGORY="base-system"
6 SHORT_DESC="The Linux Kernel and modules"
7 MAINTAINER="devel@slitaz.org"
8 LICENSE="GPL2"
9 WEB_SITE="https://www.kernel.org/"
10 HOST_ARCH="i486 arm x86_64"
12 TARBALL="$PACKAGE-${VERSION%.0}.tar.xz"
13 WGET_URL="https://www.kernel.org/pub/linux/kernel/v4.x/$TARBALL"
15 DEPENDS="kmod"
16 BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch kmod bc openssl-dev \
17 uclibc-cross-compiler-x86_64"
18 SPLIT="lguest linux-acpi linux-agp linux-aoe linux-appletalk linux-arcnet \
19 linux-autofs linux-bluetooth linux-bridge linux-cifs linux-coda linux-configfs \
20 linux-cpufreq linux-cramfs linux-crypto linux-cryptoloop linux-dialup \
21 linux-dlm linux-drm linux-exofs linux-firewire linux-firmware linux-gfs2 \
22 linux-hfs linux-hfsplus linux-hwmon linux-input-misc linux-input-tablet \
23 linux-input-touchscreen linux-ipv6 linux-irda linux-isdn linux-jfs \
24 linux-joystick linux-kvm linux-logfs linux-md linux-media linux-memstick \
25 linux-minix linux-mmc linux-module-headers linux-mwave linux-nbd linux-ncpfs \
26 linux-netfilter linux-nfsd linux-ocfs2 linux-radio linux-reiserfs linux-romfs \
27 linux-sched linux-scsi linux-sound linux-source linux-speakup linux-squashfs \
28 linux-staging linux-toshiba linux-usb-misc linux-usbdsl linux-usbip linux-uwb \
29 linux-video linux-wan linux-wimax linux-wireless linux-without-modules \
30 linux-zram linux64 linux64-acpi linux64-agp linux64-aoe linux64-appletalk \
31 linux64-arcnet linux64-autofs linux64-bluetooth linux64-bridge linux64-btrfs \
32 linux64-cifs linux64-coda linux64-configfs linux64-cpufreq linux64-cramfs \
33 linux64-crypto linux64-cryptoloop linux64-dialup linux64-dlm linux64-drm \
34 linux64-exofs linux64-firewire linux64-gfs2 linux64-hfs linux64-hfsplus \
35 linux64-hwmon linux64-input-misc linux64-input-tablet \
36 linux64-input-touchscreen linux64-ipv6 linux64-irda linux64-isdn linux64-jfs \
37 linux64-joystick linux64-kvm linux64-logfs linux64-md linux64-media \
38 linux64-memstick linux64-minix linux64-mmc linux64-module-headers \
39 linux64-mwave linux64-nbd linux64-ncpfs linux64-netfilter linux64-nfsd \
40 linux64-ocfs2 linux64-radio linux64-reiserfs linux64-romfs linux64-sched \
41 linux64-scsi linux64-sound linux64-speakup linux64-squashfs linux64-staging \
42 linux64-usb-misc linux64-usbdsl linux64-usbip linux64-uwb linux64-video \
43 linux64-wan linux64-wimax linux64-wireless linux64-without-modules \
44 linux64-zram"
46 #
47 # The Linux receipt handle cross compilation. For x86_64 we actually use
48 # the uclibc-cross-compiler-x86_64 and for ARM we use a real cross env.
49 # Please discuss any change and keep it simple, don't play with VERSION
50 # string or Kernel SUBLEVEL because depmod and Pankso don't like that!
51 #
52 # The receipt also handle some cook options for faster build:
53 # --nox64 : Skip the x86_64 cross compilation
54 # --nonomods : Skip bzImage without modules build
55 #
56 nox64='yes' # hardcoded now
58 # Aufs enable chroot
59 AUFS_NOT_RAMFS="uclibc-cross-compiler-x86_64 is not compatible with aufs+tmpfs 8("
61 # Handle multiarch compilation. Less bdeps when cross-compiling for ARM
62 case "$ARCH" in
63 arm) BUILD_DEPENDS="xz" ;;
64 x86_64) BUILD_DEPENDS="xz" ;;
65 esac
67 # Handle multiarch installation. ARM use Busybox modutils, so avoid any
68 # deps on kmod. SLITAZ_ARCH can have also custom post_install commands
69 if [ -f $root/etc/slitaz/slitaz.conf ]; then
70 . $root/etc/slitaz/slitaz.conf
71 case "$SLITAZ_ARCH" in
72 arm) DEPENDS="" ;;
73 esac
74 fi
76 add_headers_for_type()
77 {
78 # $1: type, for example "VIDEO_"
79 # $2: where to search, for example "drivers/media"
80 echo -e "\n\nAdding headers for $1..."
81 for i in $(cd $src/$2; find -name Kconfig | sed 's|^\./||'); do
82 if fgrep -q "config $1" $src/$2/$i; then
83 echo " * $2/$j/*.h"
84 j=$(dirname $i)
85 mkdir -p $1/$path/$2/$j
86 cp -a $src/$2/$j/*.h $1/$path/$2/$j
87 fi
88 done
89 }
91 install_module_headers()
92 {
93 local path="usr/src/linux-$KVERSION"
94 mkdir -p $1/lib/modules/$KVERSION
95 ln -sf /$path $1/lib/modules/$KVERSION/build
96 install -D -m644 $src/Makefile $1/$path/Makefile
97 install -D -m644 $src/kernel/Makefile $1/$path/kernel/Makefile
98 install -D -m644 $src/.config $1/$path/.config
99 mkdir -p $1/$path/include
101 cp -a $src/include/* $1/$path/include/
103 # copy arch includes for external modules
104 mkdir -p $1/$path/arch/x86
105 cp -a $src/arch/x86/include $1/$path/arch/x86/
107 # copy files necessary for later builds, like nvidia and vmware
108 cp -a $src/Module.symvers $1/$path
109 cp -a $src/scripts $1/$path
110 # fix permissions on scripts dir
111 chmod og-w -R $1/$path/scripts
112 mkdir -p $1/$path/.tmp_versions
114 mkdir -p $1/$path/arch/x86/kernel
115 cp -a $src/arch/x86/Makefile $1/$path/arch/x86/
116 cp -a $src/arch/x86/Makefile_32.cpu $1/$path/arch/x86/
117 cp -a $src/arch/x86/kernel/asm-offsets.s $1/$path/arch/x86/kernel/
119 # add headers for lirc package
120 # mkdir -p $1/$path/drivers/media/video
121 # cp -a $src/drivers/media/video/*.h $1/$path/drivers/media/video/
122 #
123 # for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102 ; do
124 # mkdir -p $1/$path/drivers/media/video/$i
125 # cp -a $src/drivers/media/video/$i/*.h $1/$path/drivers/media/video/$i
126 # done
128 add_headers_for_type 'VIDEO_' 'drivers/media'
130 # add docbook makefile
131 install -D -m644 $src/Documentation/DocBook/Makefile \
132 $1/$path/Documentation/DocBook/Makefile
134 # add md headers
135 # mkdir -p $1/$path/drivers/md
136 # cp -a $src/drivers/md/*.h $1/$path/drivers/md
137 add_headers_for_type 'MD_' 'drivers'
139 # add inotify.h
140 mkdir -p $1/$path/include/linux
141 cp -a $src/include/linux/inotify.h $1/$path/include/linux/
143 # add wireless headers
144 # mkdir -p $1/$path/net/mac80211/
145 # cp -a $src/net/mac80211/*.h $1/$path/net/mac80211/
146 add_headers_for_type 'MAC80211' 'net'
148 # add dvb headers for external modules
149 # in reference to:
150 # http://bugs.archlinux.org/task/9912
151 # mkdir -p $1/$path/drivers/media/dvb/dvb-core
152 # cp -a $src/drivers/media/dvb/dvb-core/*.h $1/$path/drivers/media/dvb/dvb-core/
153 add_headers_for_type 'DVB_' 'drivers/media'
155 # add dvb headers for external modules
156 # in reference to:
157 # http://bugs.archlinux.org/task/11194
158 # if [ -d $src/include/config/dvb/ ]; then
159 # mkdir -p $1/$path/include/config/dvb/
160 # cp $src/include/config/dvb/*.h $1/$path/include/config/dvb/
161 # fi
162 #
164 # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
165 # in reference to:
166 # http://bugs.archlinux.org/task/13146
167 # mkdir -p $1/$path/drivers/media/dvb/frontends/
168 # cp -a $src/drivers/media/dvb/frontends/lgdt330x.h $1/$path/drivers/media/dvb/frontends/
169 # cp -a $src/drivers/media/video/msp3400-driver.h $1/$path/drivers/media/dvb/frontends/
171 # add dvb headers
172 # in reference to:
173 # http://bugs.archlinux.org/task/20402
174 # mkdir -p $1/$path/drivers/media/dvb/dvb-usb
175 # cp -a $src/drivers/media/dvb/dvb-usb/*.h $1/$path/drivers/media/dvb/dvb-usb/
176 # mkdir -p $1/$path/drivers/media/dvb/frontends
177 # cp -a $src/drivers/media/dvb/frontends/*.h $1/$path/drivers/media/dvb/frontends/
178 # mkdir -p $1/$path/drivers/media/common/tuners
179 # cp -a $src/drivers/media/common/tuners/*.h $1/$path/drivers/media/common/tuners/
181 # add xfs and shmem for aufs building
182 mkdir -p $1/$path/fs/xfs
183 mkdir -p $1/$path/mm
184 cp -a $src/fs/xfs/xfs_sb.h $1/$path/fs/xfs/xfs_sb.h
186 # copy in Kconfig files
187 for i in $(find . -name "Kconfig*"); do
188 mkdir -p $1/$path/$(echo $i | sed 's|/Kconfig.*||')
189 cp -a $src/$i $1/$path/$i
190 done
192 chown -R root.root $1/$path
193 find $1/$path -type d -exec chmod 755 {} \;
194 # remove unneeded architectures
195 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}
196 }
199 # Rules to configure and make the package.
200 compile_rules()
201 {
202 if [ -f "/usr/share/boot/initrd" ]; then
203 cp /usr/share/boot/initrd initrd.cpio
204 fi
206 # Handle cross compilation
207 case "$ARCH" in
208 arm)
209 echo "Compiling: $ARCH Kernel"
210 make mrproper
211 patch -Np1 < $stuff/$ARCH/linux-arm.patch || exit 1
212 cp -f $stuff/$ARCH/linux-arm.config .config
213 yes '' | make ARCH=$ARCH oldconfig
214 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- bzImage &&
215 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- modules &&
216 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- \
217 INSTALL_MOD_PATH=$DESTDIR modules_install &&
218 mkdir -p $DESTDIR/boot &&
219 cp -a arch/arm/boot/zImage \
220 $DESTDIR/boot/linux-$VERSION-slitaz-$ARCH
221 #$stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
222 return 0 ;;
223 x86_64)
224 echo "TODO: Maybe use default? But cross compile in x86_64 chroot"
225 echo "so we can remove the 64 build by uclibc-cross-compiler-x86_64"
226 return 0 ;;
227 esac
229 # Check for Aufs and get source/patches if needed
230 echo "Checking for Aufs packages..."
231 AUFSVER=$(grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g')
232 AUFSDIR="$WOK/aufs/source/aufs-${AUFSVER}"
233 if [ ! -d "$AUFSDIR" ]; then
234 [ ! -f "$SRC/aufs-${AUFSVER}.tar.bz2" ] && cook aufs --getsrc
235 mkdir -p $WOK/aufs/source/
236 echo "Extracting: aufs-${AUFSVER}.tar.bz2"
237 tar xjf $SRC/aufs-${AUFSVER}.tar.bz2 -C $WOK/aufs/source/
238 fi
240 echo "cook:linux" > $command
242 echo "Copying Aufs files and patches..."
243 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
244 cp -a $AUFSDIR/aufs4-*.patch $stuff
246 # SliTaz db stuff
247 [ -d $WOK/$PACKAGE/source/slitaz ] && rm -rf $WOK/$PACKAGE/source/slitaz
248 mkdir -p $WOK/$PACKAGE/source/slitaz
249 echo "$WGET_URL" > $WOK/$PACKAGE/source/slitaz/url
250 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/source/slitaz
251 cp $stuff/bootloader.sh $WOK/$PACKAGE/source/slitaz
253 # Apply patches
254 echo "Applying patches..."
255 while read patch_file; do
256 echo "$patch_file" >> $WOK/$PACKAGE/source/slitaz/patches
257 cp $stuff/$patch_file $WOK/$PACKAGE/source/slitaz
258 if [ -f done.$patch_file ]; then
259 echo "Skipping $patch_file"; continue
260 fi
261 echo -e "\nApply $patch_file"
262 patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || return 1
263 touch done.$patch_file
264 done <<EOT
265 aufs4-base.patch
266 aufs4-standalone.patch
267 aufs4-loopback.patch
268 aufs4-mmap.patch
269 EOT
271 # Mrproper and lguest
272 echo "Making kernel proper and then build lguest..."
273 make mrproper
274 cd tools/lguest
275 make lguest || return 1
276 cd $src
278 #
279 # Arch x86_64: TODO have a real cross environment
280 #
281 if [ -z "$nox64" ]; then
282 echo "Making x86_64 Kernel"
284 # Build bzImage64 without modules first
285 if [ -z "$nonomods" ]; then
286 cp -f $stuff/$PACKAGE-slitaz.config64 .config
287 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
288 # We can't keep every driver in staging???
289 sed -i -e 's/^CONFIG_RTL8192/#&/' \
290 -e 's/^CONFIG_R8187SE/#&/' \
291 -e 's/^CONFIG_RT2870/#&/' .config
293 echo -e "\n* Configure bzImage64 without modules...\n"
294 yes '' | make ARCH=x86_64 oldconfig
296 echo -e "\n* Building bzImage64 without modules...\n"
297 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || exit 1
299 [ -d $DESTDIR ] || mkdir -p $DESTDIR/linux64
300 mv arch/x86/boot/bzImage $DESTDIR/linux64
301 mv System.map System.map-without-modules64
302 fi
304 # Build bzImage64 with modules
305 cp -f $stuff/$PACKAGE-slitaz.config64 .config
307 echo -e "\n* Configure bzImage64 with modules...\n"
308 yes '' | make ARCH=x86_64 oldconfig
310 echo -e "\n* Building bzImage64 with modules...\n"
311 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage &&
312 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- modules &&
313 make ARCH=x86_64 INSTALL_MOD_PATH=$DESTDIR/linux64 modules_install &&
314 make ARCH=x86_64 INSTALL_HDR_PATH=$DESTDIR/linux64/usr headers_install &&
316 ln .config $WOK/$PACKAGE/source/slitaz/config64
317 [ -s arch/x86/boot/bzImage ] || return 1
318 mkdir -p $DESTDIR/linux64/boot 2>/dev/null
319 mv arch/x86/boot/bzImage $DESTDIR/linux64/boot/vmlinuz-$VERSION-slitaz64
320 KVERSION=$VERSION-slitaz64
321 install_module_headers $DESTDIR/linux64
322 ln System.map System.map-modules64
323 ln Module.symvers Module.symvers-modules64
324 else
325 echo "* Skipping: x86_64 Kernel..."
326 fi
328 #
329 # Linux Arch i386 - GCC arch i486
330 #
331 echo "Making x86 Kernel..."
333 # Build bzImage without modules first
334 if [ -z "$nonomods" ]; then
335 cp -f $stuff/$PACKAGE-slitaz.config .config
336 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
337 # We can't keep every driver in staging???
338 sed -i -e 's/^CONFIG_RTL8192/#&/' \
339 -e 's/^CONFIG_R8187SE/#&/' \
340 -e 's/^CONFIG_RT2870/#&/' .config
342 echo -e "\n* Configure bzImage without modules...\n"
343 yes '' | make ARCH=i386 oldconfig
345 echo -e "\n* Building bzImage without modules...\n"
346 make ARCH=i386 -j 4 bzImage || exit 1
348 [ -d $DESTDIR ] || mkdir -p $DESTDIR
349 mv arch/x86/boot/bzImage $DESTDIR
350 mv System.map System.map-without-modules
351 fi
353 # Build bzImage with modules
354 cp -f $stuff/$PACKAGE-slitaz.config .config
356 echo -e "\n* Configure bzImage with modules...\n"
357 yes '' | make ARCH=i386 oldconfig
359 ln .config $WOK/$PACKAGE/source/slitaz/config
361 echo -e "\n* Building bzImage with modules...\n"
362 make ARCH=i386 -j 4 bzImage &&
363 make ARCH=i386 -j 4 modules &&
364 make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR modules_install &&
365 make ARCH=i386 INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
367 [ -s arch/x86/boot/bzImage ] || return 1
368 mkdir -p $DESTDIR/boot 2> /dev/null
369 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
370 KVERSION=$VERSION-slitaz
372 install_module_headers $DESTDIR
374 # Compress all modules.
375 if [ -d "$DESTDIR/lib/modules/$VERSION-slitaz" ]; then
376 $stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
377 else
378 return 1
379 fi
380 if [ -d "$DESTDIR/linux64/lib/modules/$VERSION-slitaz64" ]; then
381 $stuff/gztazmod.sh $DESTDIR/linux64/lib/modules/$VERSION-slitaz64
382 fi
383 ln System.map System.map-modules
384 ln Module.symvers Module.symvers-modules
385 }
387 # Rules to gen a SliTaz package suitable for Tazpkg.
388 genpkg_rules()
389 {
390 case "$ARCH" in
391 arm)
392 echo "Packing: ARM Kernel"
393 cp -a $install/* $fs
394 rm -f $fs/lib/modules/*/build $fs/lib/modules/*/source
395 return 0 ;;
396 x86_64)
397 echo "TODO: use default or custom x86_64 packing"
398 return 0 ;;
399 esac
401 export PACKAGE VERSION
402 local path
403 cp -a $install/boot $fs
405 # Compress all modules.
406 path=$fs/lib/modules/$VERSION-slitaz/kernel
407 mkdir -p $path
409 # Get the base modules
410 export src install
411 mkdir -p $WOK/$PACKAGE/source/tmp
413 # Warning: stuff/list_modules.sh must find the generated modules.list
414 $stuff/list_modules.sh \
415 $(cat $stuff/modules.list) > $WOK/$PACKAGE/source/tmp/modules.list
417 while read module; do
418 dir=$(dirname $module)
419 [ -d $path/$dir ] || mkdir -p $path/$dir
420 cp -a $install/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
421 done < $WOK/$PACKAGE/source/tmp/modules.list
423 # Remove unresolved links
424 rm -f $fs/lib/modules/$VERSION-slitaz/build
425 rm -f $fs/lib/modules/$VERSION-slitaz/source
427 # We only need module.{order,builtin} because other map files are
428 # generated by depmod in post_install
429 cp -a $install/lib/modules/$VERSION-slitaz/modules.order \
430 $install/lib/modules/$VERSION-slitaz/modules.builtin \
431 $fs/lib/modules/$VERSION-slitaz
433 # Pack all packages with a Kernel module
434 [ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1
435 for i in $SPLIT; do
436 cook $i
437 done
439 # Check any module in Kernel .config that's not added to a linux-* pkgs
440 # and remove aufs patches: we don't need them in HG wok.
441 $stuff/check_modules.sh
442 rm -f $stuff/aufs4-*
443 }
445 # Pre and post install commands for Tazpkg.
446 post_install()
447 {
448 chroot "$root/" depmod -a $VERSION-slitaz
450 # Handle multiarch installation
451 case "$SLITAZ_ARCH" in
452 arm)
453 echo "Kernel : /boot/linux-$VERSION-slitaz-$ARCH"
454 echo "Modules: /lib/modules/$VERSION-slitaz"
455 return 0 ;;
456 esac
458 # GRUB stuff.
459 if [ -f "$1/boot/grub/menu.lst" ]; then
460 # Current root device
461 root_dev="/dev/$(lsblk | grep '/$'| grep -o '[a-z]d[a-z][0-9]*')"
462 grub_part="$(( $(echo $root_dev | grep -o '[0-9]*$')-1 ))"
463 # Use device.map to find grub device number
464 grub_dev="$(grep $(echo $root_dev | grep -o '^/dev/.d.' ) \
465 "$1/boot/grub/device.map" | cut -f1 | sed "s/)$/.$grub_part)/g")"
467 # Add and clean Kernel entries in case of upgrade for installed system.
468 if ! grep -q vmlinuz-$VERSION-slitaz "$1/boot/grub/menu.lst"; then
470 # Clean the old entry
471 # TODO: old vmlinuz file is removed but the entry is still there.
472 # So grub error:15 when selected: http://bugs.slitaz.org/?id=74
474 # Add the new entry
475 cat >> "$1/boot/grub/menu.lst" <<EOT
477 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
478 $grub_dev
479 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev quiet
480 EOT
481 # Make it the default entry
482 last_entry=$(( $(grep -c '^title' "$1/boot/grub/menu.lst")-1 ))
483 sed -e "s/^default.*/default $last_entry/g" -i "$1/boot/grub/menu.lst"
484 fi
486 # Display information message.
487 cat <<EOT
489 ----
490 GRUB is installed, these three lines must be in your /boot/grub/menu.lst:
492 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
493 $grub_dev
494 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
495 ----
496 EOT
497 fi
498 true
499 }