wok-next view linux/receipt @ rev 21018

Nasty typo broke the cooker
author Aleksej Bobylev <al.bobylev@gmail.com>
date Wed Oct 17 03:59:24 2018 +0300 (2018-10-17)
parents 751dc2b613cd
children d5aab818505e
line source
1 # SliTaz package receipt v2.
3 PACKAGE="linux"
4 VERSION="4.17.7"
5 KBASEVER="$(echo $VERSION | cut -d. -f1,2)"
6 CATEGORY="base-system"
7 SHORT_DESC="The Linux Kernel"
8 MAINTAINER="devel@slitaz.org"
9 LICENSE="GPL2"
10 WEB_SITE="https://www.kernel.org/"
11 HOST_ARCH="i486 arm x86_64"
13 TARBALL="$PACKAGE-$KBASEVER.tar.xz"
14 WGET_URL="https://www.kernel.org/pub/linux/kernel/v4.x/$TARBALL"
16 BUILD_DEPENDS_arm="xz"
17 BUILD_DEPENDS_x86_64="perl xz patch kmod bc elfutils-dev openssl-dev"
18 BUILD_DEPENDS="perl xz lzma patch kmod bc elfutils-dev openssl-dev" # git
19 # Removed: lguest, linux-firmware, linux-logfs, linux-irda, linux-toshiba
20 SPLIT="\
21 linux-acpi linux-agp linux-aoe \
22 linux-appletalk linux-arcnet linux-autofs \
23 linux-bluetooth linux-bridge linux-btrfs \
24 linux-cifs linux-coda linux-cpufreq \
25 linux-cramfs linux-crypto linux-cryptoloop \
26 linux-dialup linux-dlm linux-drm \
27 linux-ecryptfs linux-efi linux-ethernet \
28 linux-exofs linux-firewire linux-gfs2 \
29 linux-hfs linux-hfsplus linux-hid \
30 linux-hwmon linux-ide linux-input-misc \
31 linux-input-tablet linux-input-touchscreen linux-ipv6 \
32 linux-isdn linux-jfs \
33 linux-joystick linux-kvm linux-md \
34 linux-media linux-memstick linux-minix \
35 linux-mmc linux-module-headers linux-mwave \
36 linux-ncpfs linux-nbd linux-netfilter \
37 linux-nfc linux-nfs linux-nfsd \
38 linux-ocfs2 linux-orangefs linux-radio \
39 linux-reiserfs linux-romfs linux-sched \
40 linux-scsi linux-sound linux-source \
41 linux-speakup linux-squashfs linux-staging \
42 linux-usb-gadget linux-usb-misc linux-usbdsl \
43 linux-usbip linux-uwb linux-video \
44 linux-wan linux-watchdog linux-wimax \
45 linux-wireless linux-without-modules linux-zram"
46 COOKOPTS="skip-log-errors"
48 if [ "$KBASEVER" != "${VERSION%.0}" ]; then
49 PATCH="$(dirname $WGET_URL)/patch-$VERSION.xz"
50 EXTRA_SOURCE_FILES="$(basename $PATCH)"
51 fi
53 #
54 # The Linux receipt handle cross compilation; for ARM we use a real cross env.
55 # Please discuss any change and try to keep it simple.
56 #
57 # The receipt handle cook option for faster build:
58 # --nonomods : Skip bzImage without modules build
59 #
61 # CONFIG_PAGE_TABLE_ISOLATION
62 # against Meltdown currently available in 4.14 only for x86_64 architecture.
63 # CONFIG_RETPOLINE
64 # against Spectre v.2 available both for i386 and x86_64 architectures.
66 # Handle multiarch installation. ARM use Busybox modutils, so avoid any
67 # deps on kmod. SLITAZ_ARCH can have also custom post_install commands
68 if [ -f $root/etc/slitaz/slitaz.conf ]; then
69 . $root/etc/slitaz/slitaz.conf
70 case "$SLITAZ_ARCH" in
71 arm) DEPENDS="" ;;
72 esac
73 fi
75 # Rules to configure and make the package.
76 compile_rules() {
77 case $ARCH in
78 # Linux don't supported i386 CPU, but ARCH should be 'i386' if we need 32bit CPU support
79 i?86) ConfigFile="$stuff/linux-slitaz.config"; Arch='i386';;
80 x86_64) ConfigFile="$stuff/linux-slitaz64.config"; Arch='x86_64';;
81 arm*) ConfigFile="$stuff/arm/linux-arm.config"; Arch='arm';;
82 esac
84 # Update sources to the $VERSION using base sources ($KBASEVER) and patch
85 if [ "$KBASEVER" != "${VERSION%.0}" ]; then
86 [ -s $SRC/$(basename $PATCH) ] || wget $PATCH -O $SRC/$(basename $PATCH)
87 # don't patch twice for `cook $PACKAGE --continue`
88 if [ ! -f "done.patch-$VERSION" ]; then
89 xzcat $SRC/$(basename $PATCH) | patch -Np1
90 touch done.patch-$VERSION
91 fi
92 fi
94 #
95 if [ -f "/usr/share/boot/initrd" ]; then
96 cp /usr/share/boot/initrd initrd.cpio
97 fi
99 # Handle cross compilation
100 case "$ARCH" in
101 arm)
102 echo "Compiling: $Arch Kernel"
103 make mrproper
104 patch -Np1 < $stuff/arm/linux-arm.patch || exit 1
105 cp -f $ConfigFile .config
106 yes '' | make ARCH=$Arch oldconfig
107 make ARCH=$Arch CROSS_COMPILE=${HOST_SYSTEM}- bzImage &&
108 make ARCH=$Arch CROSS_COMPILE=${HOST_SYSTEM}- modules &&
109 make ARCH=$Arch CROSS_COMPILE=${HOST_SYSTEM}- \
110 INSTALL_MOD_PATH=$DESTDIR modules_install &&
111 mkdir -p $DESTDIR/boot &&
112 cp -a arch/arm/boot/zImage \
113 $DESTDIR/boot/linux-$VERSION-slitaz-$ARCH
114 #$stuff/tools/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
115 return 0 ;;
116 esac
118 # Get and apply Aufs patches
119 . $stuff/tools/aufs-patches
121 echo "cook:linux" > $command
123 # Apply misc patches
124 echo "Applying patches..."
125 while read patch_file; do
126 if [ -f done.$patch_file ]; then
127 echo "Skipping $patch_file"; continue
128 fi
129 echo -e "\nApply $patch_file"
130 patch -p1 -i $stuff/patches/$patch_file || return 1
131 touch done.$patch_file
132 done < $stuff/patches/patch.order
134 echo "Making kernel proper..."
135 make mrproper
139 echo "Making $Arch Kernel..."
141 # Build bzImage without modules first
142 if [ -z "$nonomods" ]; then
143 cp -f $ConfigFile .config
144 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
145 # We can't keep every driver in staging???
146 sed -i \
147 -e 's/^CONFIG_RTL8192/#&/' \
148 -e 's/^CONFIG_R8187SE/#&/' \
149 -e 's/^CONFIG_RT2870/#&/' .config
151 title 'Configure bzImage without modules...'
152 yes '' | make ARCH=$Arch oldconfig
154 title 'Building bzImage without modules...'
155 make ARCH=$Arch -j4 bzImage || exit 1
157 mkdir -p $DESTDIR
158 mv arch/x86/boot/bzImage $DESTDIR
159 mv System.map System.map-without-modules
160 fi
162 # Build bzImage with modules
163 cp -f $ConfigFile .config
165 title 'Configure bzImage with modules...'
166 yes '' | make ARCH=$Arch oldconfig
169 title 'Building bzImage with modules...'
170 make ARCH=$Arch -j4 bzImage &&
171 make ARCH=$Arch -j4 modules &&
172 make ARCH=$Arch INSTALL_MOD_PATH=$DESTDIR modules_install &&
173 make ARCH=$Arch INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
175 [ -s arch/x86/boot/bzImage ] || return 1
176 mkdir -p $DESTDIR/boot
177 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
179 $stuff/tools/install_module_headers.sh $DESTDIR $src $VERSION-slitaz
181 ln System.map System.map-modules
182 ln Module.symvers Module.symvers-modules
184 # for linux-zram package
185 mkdir -p $install/etc/init.d
186 install -o root -m755 $stuff/compcache $install/etc/init.d/
187 install -o root -m644 $stuff/compcache.conf $install/etc/
188 }
191 # Rules to gen a SliTaz package suitable for Tazpkg.
192 genpkg_rules() {
193 DEPENDS="linux" # default, may be subject to change later
195 case $PACKAGE in
196 *-acpi) c="ACPI modules";;
197 *-agp) c="AGP modules";;
198 *-aoe) c="AoE (ATA over Ethernet) modules";;
199 *-appletalk) c="Appletalk modules";;
200 *-arcnet) c="ARCnet modules";;
201 *-autofs) c="Automounter module";;
202 *-bluetooth) c="Bluetooth modules";;
203 *-bridge) c="Bridge modules";;
204 *-btrfs) c="Btrfs module"; DEPENDS="linux-crypto";;
205 *-cifs) c="CIFS module";;
206 *-coda) c="Coda module";;
207 *-cpufreq) c="Cpufreq modules";;
208 *-cramfs) c="CramFs module";;
209 *-crypto) c="Crypto modules";;
210 *-cryptoloop) c="Cryptoloop modules"; DEPENDS="linux-crypto";;
211 *-dialup) c="Dial-up modules";;
212 *-dlm) c="DLMFS module";;
213 *-drm) c="DRM module"; DEPENDS="linux-agp";;
214 *-ecryptfs) c="eCrypt FS module";;
215 *-efi) c="EFI modules";;
216 *-ethernet) c="Ethernet drivers"; DEPENDS="linux-crypto";;
217 *-exofs) c="OSD based FS module"; DEPENDS="linux-crypto";;
218 *-firewire) c="Firewire modules";;
219 *-gfs2) c="GFS2 module";;
220 *-hfs) c="HFS module";;
221 *-hfsplus) c="HFSplus module";;
222 *-hid) c="HID (human interface device) modules";;
223 *-hwmon) c="Hwmon modules";;
224 *-ide) c="IDE modules";;
225 *-input-misc) c="misc. input drivers";;
226 *-input-tablet) c="tablet input drivers";;
227 *-input-touchscreen) c="touchscreen input drivers";;
228 *-ipv6) c="IPv6 modules"; DEPENDS="linux-netfilter";;
229 *-isdn) c="ISDN modules";;
230 *-jfs) c="JFS module";;
231 *-joystick) c="joystick modules";;
232 *-kvm) c="KVM and Virtio modules";;
233 *-md) c="MD modules"; DEPENDS="linux-crypto";;
234 *-media) c="media modules"; DEPENDS="linux-radio";;
235 *-memstick) c="Sony memory stick modules";;
236 *-minix) c="Minix module";;
237 *-mmc) c="MMC modules - card reader";;
238 *-mwave) c="ACP Modem driver module - for IBM Thinkpad";;
239 *-nbd) c="NBD (network block device) modules";;
240 *-ncpfs) c="NCPFS module";;
241 *-netfilter) c="Netfilter modules";;
242 *-nfc) c="NFC modules";;
243 *-nfs) c="NFS modules"; DEPENDS="linux-crypto";;
244 *-nfsd) c="NFS server module"; DEPENDS="linux-nfs";;
245 *-ocfs2) c="OCFS2 modules"; DEPENDS="linux-dlm";;
246 *-orangefs) c="OrangeFS module";;
247 *-radio) c="radio modules"; DEPENDS="linux-sound";;
248 *-reiserfs) c="ReiserFS module";;
249 *-romfs) c="ROMFS module";;
250 *-sched) c="Sched modules";;
251 *-scsi) c="SCSI modules";;
252 *-sound) c="sound modules"
253 copy firmware/ess/ firmware/korg/ firmware/sun/ firmware/yamaha/
254 ;;
255 *-speakup) c="Speakup modules";;
256 *-squashfs) c="Squashfs module"; PROVIDE="squashfs-module";;
257 *-staging) c="staging kernel modules";;
258 *-toshiba) c="Toshiba module";;
259 *-usb-gadget) c="USB gadget modules";;
260 *-usb-misc) c="misc. USB drivers";;
261 *-usbdsl) c="USB DSL modem modules";;
262 *-usbip) c="Usbip module"; PROVIDE="usbip-module";;
263 *-uwb) c="UWB modules";;
264 *-video) c="video modules";;
265 *-wan) c="Wide Area Networks (WANs) modules"; DEPENDS="linux-wireless";;
266 *-watchdog) c="watchdog drivers";;
267 *-wimax) c="Wimax modules";;
268 *-wireless) c="wireless modules"; DEPENDS="linux-crypto wireless_tools";;
269 *-zram) c="compressed caching support"; PROVIDE="compcache"
270 copy compcache compcache.conf
271 ;;
272 esac
274 case $PACKAGE in
275 linux)
276 DEPENDS="kmod"
277 case "$ARCH" in
278 arm)
279 echo "Packing: ARM Kernel"
280 cp -a $install/* $fs
281 rm -f $fs/lib/modules/*/build $fs/lib/modules/*/source
282 return 0 ;;
283 esac
285 # Copy the Kernel
286 cp -a $install/boot $fs
288 # Copy base modules
289 . $stuff/tools/copy_modules.sh
291 # We only need modules.{order,builtin} because other map files are
292 # generated by depmod in post_install()
293 copy modules.order modules.builtin
294 rm -rf $fs/usr
296 # Pack all packages with a Kernel modules
297 [ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1
299 # Checking for Linux Kernel modules that don't belong to any of the packages
300 # $stuff/tools/check_modules.sh
301 # please, see web interface instead
302 ;;
303 *-firmware)
304 mkdir -p $fs/lib
305 cp -a $install/lib/firmware $fs/lib
306 # remove linux-sound firmware files
307 for i in ess korg sun yamaha; do
308 rm -rf $fs/lib/firmware/$i
309 done
310 CAT="non-free|firmware thats compiled from Linux source code"
311 PROVIDE="linux64-firmware"
312 ;;
313 *-module-headers)
314 CAT="development|header files and scripts for building modules for Linux Kernel"
315 KVERSION="$VERSION-slitaz"
316 DEPENDS="slitaz-toolchain"
317 mkdir -p $fs/lib/modules/$KVERSION $fs/usr
318 cp -a $install/usr/src $fs/usr
319 ;;
320 *-source)
321 CAT="development|source files"
322 DEPENDS="linux slitaz-toolchain ncurses-dev perl xz lzma patch busybox-boot"
324 local _AUFSVER=$(. $WOK/aufs/receipt; echo $VERSION)
325 local AUFSDIR="aufs-${_AUFSVER}"
326 kps=$fs/usr/src/kernel-patches/slitaz
327 mkdir -p $kps \
328 $fs/lib/modules/$VERSION-slitaz \
329 $fs/usr/bin $fs/usr/sbin
331 # URL
332 echo $(. $WOK/linux/receipt; echo $WGET_URL) > $kps/url
333 # stuff
334 cp $stuff/tools/* $stuff/bootloader.sh $kps
335 # Kernel patch
336 xzcat $SRC/patch-$VERSION.xz > $kps/linux-$VERSION.patch
337 echo "linux-$VERSION.patch" > $kps/patches
338 # Aufs patches
339 sed '/^aufs4.*patch$/!d' $stuff/tools/aufs-patches | \
340 tee -a $kps/patches | \
341 while read i; do
342 cp $WOK/aufs/source/*/$i $kps
343 done
344 # misc. patches
345 cat $stuff/patches/patch.order >> $kps/patches
346 cp $stuff/patches/* $kps
347 rm $kps/patch.order
348 # config
349 cp $WOK/linux/source/linux-$VERSION/.config $kps/config
351 cp -a $stuff/linux-source/buildtaz $kps
352 cp -a $stuff/linux-source/make-tazpkg.u $kps
353 cp -a $stuff/linux-source/get-linux-source $fs/usr/bin
354 cp -a $stuff/linux-source/list_modules.sh $kps
355 cp -a $stuff/linux-source/rdev $fs/usr/sbin
356 ln -s rdev $fs/usr/sbin/rootflags
357 ln -s rdev $fs/usr/sbin/ramsize
358 ln -s rdev $fs/usr/sbin/vidmode
359 sed -i "s|=XXX|=$VERSION|g" $fs/usr/bin/get-linux-source
361 # Copy Aufs4 source files
362 if [ -d $WOK/aufs/$AUFSDIR ]; then
363 mkdir $fs/usr/src/kernel-patches/slitaz/aufs4
364 cp -a $WOK/aufs/$AUFSDIR/Documentation \
365 $WOK/aufs/$AUFSDIR/fs \
366 $WOK/aufs/$AUFSDIR/include \
367 $fs/usr/src/kernel-patches/slitaz/aufs4
368 fi
370 ln -s ../../../usr/src/linux-$VERSION $fs/lib/modules/$VERSION-slitaz/source
372 chown -R root:root $fs
373 ;;
374 *-without-modules)
375 CAT="base-system|without module support"
376 PROVIDE="linux"
377 mkdir -p $fs/boot
378 cp -a $install/bzImage $fs/boot/vmlinuz-$VERSION-slitaz-without-modules
379 ;;
380 *)
381 . $stuff/tools/copy_modules.sh
382 CAT="base-system|$c"
383 ;;
384 esac
386 case $PACKAGE in
387 *fs|*fs2|*-coda|*-dlm|*-hfsplus|*-minix|*-nfsd)
388 CONFIG_FILES="/etc/filesystems";;
389 *-zram)
390 CONFIG_FILES="/etc/compcache.conf";;
391 esac
392 }
395 post_install_linux() {
396 # Handle multiarch installation
397 case "$SLITAZ_ARCH" in
398 arm)
399 echo "Kernel : /boot/linux-$VERSION-slitaz-$ARCH"
400 echo "Modules: /lib/modules/$VERSION-slitaz"
401 return 0 ;;
402 esac
404 # GRUB stuff.
405 if [ -f "$1/boot/grub/menu.lst" ]; then
406 # Current root device
407 root_dev="/dev/$(lsblk | grep '/$'| grep -o '[a-z]d[a-z][0-9]*')"
408 grub_part="$(( $(echo $root_dev | grep -o '[0-9]*$')-1 ))"
409 # Use device.map to find grub device number
410 grub_dev="$(grep $(echo $root_dev | grep -o '^/dev/.d.' ) \
411 "$1/boot/grub/device.map" | cut -f1 | sed "s/)$/.$grub_part)/g")"
413 # Add and clean Kernel entries in case of upgrade for installed system.
414 if ! grep -q vmlinuz-$VERSION-slitaz "$1/boot/grub/menu.lst"; then
416 # Clean the old entry
417 # TODO: old vmlinuz file is removed but the entry is still there.
418 # So grub error:15 when selected: http://bugs.slitaz.org/?id=74
420 # Add the new entry
421 cat >> "$1/boot/grub/menu.lst" <<EOT
423 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
424 $grub_dev
425 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev quiet
426 EOT
427 # Make it the default entry
428 last_entry=$(( $(grep -c '^title' "$1/boot/grub/menu.lst")-1 ))
429 sed -e "s/^default.*/default $last_entry/g" -i "$1/boot/grub/menu.lst"
430 fi
432 # Display information message.
433 [ -z "$quiet" ] && cat <<EOT
435 ----
436 GRUB is installed, these three lines must be in your /boot/grub/menu.lst:
438 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
439 $grub_dev
440 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
441 ----
442 EOT
443 fi
444 :
445 }
447 pre_remove_linux_module_headers() {
448 if [ -e "$1/usr/src/linux" ]; then
449 rm -rf "$1/usr/src/linux"
450 fi
451 }
453 # Added soft link to make it easier to point to kernel folder
454 post_install_linux_module_headers() {
455 KVERSION="$VERSION-slitaz"
456 [ -L "$1/usr/src/linux" ] && rm -f "$1/usr/src/linux"
457 ln -sf /usr/src/linux-$KVERSION "$1/usr/src/linux"
458 ln -sf /usr/src/linux-$KVERSION "$1/lib/modules/$KVERSION/build"
459 }
461 post_install_linux_zram() {
462 chroot "$1/" depmod -a $VERSION-slitaz &&
463 RAM=$(grep MemTotal /proc/meminfo | tr -dc 0-9) &&
464 echo "SIZE_KB="$(($RAM/2)) > "$1/etc/compcache.conf"
465 [ -n "$quiet" ] || cat <<EOT
467 You can add compressed swap according /etc/compcache.conf configuration with:
468 # /etc/init.d/compcache start
469 Or add compcache to the RUN_DAEMONS list of /etc/rcS.conf.
470 EOT
471 }