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