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