wok-next view linux/receipt @ rev 19715

Fix building: pciutils, pcmanfm-legacy, arj
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat May 13 17:25:31 2017 +0300 (2017-05-13)
parents 5534f89ab5ad
children b53ebb2699ba
line source
1 # SliTaz package receipt.
3 PACKAGE="linux"
4 VERSION="4.9.4"
5 KBASEVER="4.9"
6 CATEGORY="base-system"
7 SHORT_DESC="The Linux Kernel and modules"
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 DEPENDS="kmod"
17 BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch kmod bc"
18 SPLIT="lguest linux-acpi linux-agp linux-aoe linux-appletalk linux-arcnet \
19 linux-autofs linux-bluetooth linux-bridge linux-btrfs linux-cifs linux-coda \
20 linux-cpufreq linux-cramfs linux-crypto linux-cryptoloop linux-dialup \
21 linux-dlm linux-drm linux-ecryptfs linux-efi linux-ethernet linux-exofs \
22 linux-firewire linux-firmware linux-gfs2 linux-hfs linux-hfsplus linux-hid \
23 linux-hwmon linux-ide linux-input-misc linux-input-tablet \
24 linux-input-touchscreen linux-ipv6 linux-irda linux-isdn linux-jfs \
25 linux-joystick linux-kvm linux-logfs linux-md linux-media linux-memstick \
26 linux-minix linux-mmc linux-module-headers linux-mwave linux-nbd linux-ncpfs \
27 linux-netfilter linux-nfc linux-nfs linux-nfsd linux-ocfs2 linux-orangefs \
28 linux-radio linux-reiserfs linux-romfs linux-sched linux-scsi linux-sound \
29 linux-source linux-speakup linux-squashfs linux-staging linux-toshiba \
30 linux-usb-gadget linux-usb-misc linux-usbdsl linux-usbip linux-uwb linux-video \
31 linux-wan linux-watchdog linux-wimax linux-wireless linux-without-modules \
32 linux-zram"
33 SIBLINGS="linux-api-headers linux-dev linux-man"
35 if [ "$KBASEVER" != "${VERSION%.0}" ]; then
36 PATCH="$(dirname $WGET_URL)/patch-$VERSION.xz"
37 EXTRA_SOURCE_FILES="$(basename $PATCH)"
38 fi
40 #
41 # The Linux receipt handle cross compilation. For x86_64 we actually use
42 # the uclibc-cross-compiler-x86_64 and for ARM we use a real cross env.
43 # Please discuss any change and keep it simple, don't play with VERSION
44 # string or Kernel SUBLEVEL because depmod and Pankso don't like that!
45 #
46 # The receipt also handle some cook options for faster build:
47 # --nonomods : Skip bzImage without modules build
48 #
50 # Handle multiarch compilation. Less bdeps when cross-compiling for ARM
51 case "$ARCH" in
52 arm) BUILD_DEPENDS="xz" ;;
53 x86_64) BUILD_DEPENDS="xz" ;;
54 esac
56 # Handle multiarch installation. ARM use Busybox modutils, so avoid any
57 # deps on kmod. SLITAZ_ARCH can have also custom post_install commands
58 if [ -f $root/etc/slitaz/slitaz.conf ]; then
59 . $root/etc/slitaz/slitaz.conf
60 case "$SLITAZ_ARCH" in
61 arm) DEPENDS="" ;;
62 esac
63 fi
65 # Rules to configure and make the package.
66 compile_rules()
67 {
68 # Update sources to the $VERSION using base sources ($KBASEVER) and patch
69 if [ "$KBASEVER" != "${VERSION%.0}" ]; then
70 [ -s $SRC/$(basename $PATCH) ] || wget $PATCH -O $SRC/$(basename $PATCH)
71 # don't patch twice for `cook $PACKAGE --continue`
72 if [ ! -f "done.patch-$VERSION" ]; then
73 xzcat $SRC/$(basename $PATCH) | patch -Np1
74 touch done.patch-$VERSION
75 fi
76 fi
78 #
79 if [ -f "/usr/share/boot/initrd" ]; then
80 cp /usr/share/boot/initrd initrd.cpio
81 fi
83 # Handle cross compilation
84 case "$ARCH" in
85 arm)
86 echo "Compiling: $ARCH Kernel"
87 make mrproper
88 patch -Np1 < $stuff/$ARCH/linux-arm.patch || exit 1
89 cp -f $stuff/$ARCH/linux-arm.config .config
90 yes '' | make ARCH=$ARCH oldconfig
91 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- bzImage &&
92 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- modules &&
93 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- \
94 INSTALL_MOD_PATH=$DESTDIR modules_install &&
95 mkdir -p $DESTDIR/boot &&
96 cp -a arch/arm/boot/zImage \
97 $DESTDIR/boot/linux-$VERSION-slitaz-$ARCH
98 #$stuff/tools/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
99 return 0 ;;
100 x86_64)
101 echo "TODO: Maybe use default? But cross compile in x86_64 chroot"
102 echo "so we can remove the 64 build by uclibc-cross-compiler-x86_64"
103 return 0 ;;
104 esac
106 # Get and apply Aufs patches
107 . $stuff/tools/aufs-patches
109 echo "cook:linux" > $command
111 # Apply misc patches
112 echo "Applying patches..."
113 while read patch_file; do
114 if [ -f done.$patch_file ]; then
115 echo "Skipping $patch_file"; continue
116 fi
117 echo -e "\nApply $patch_file"
118 patch -p1 -i $stuff/patches/$patch_file || return 1
119 touch done.$patch_file
120 done < $stuff/patches/patch.order
122 # Mrproper and lguest
123 echo "Making kernel proper and then build lguest..."
124 make mrproper
125 cd tools/lguest
126 make lguest || return 1
127 cd $src
129 #
130 # Linux Arch i386 - GCC arch i486
131 #
132 echo "Making x86 Kernel..."
134 # Build bzImage without modules first
135 if [ -z "$nonomods" ]; then
136 cp -f $stuff/$PACKAGE-slitaz.config .config
137 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
138 # We can't keep every driver in staging???
139 sed -i \
140 -e 's/^CONFIG_RTL8192/#&/' \
141 -e 's/^CONFIG_R8187SE/#&/' \
142 -e 's/^CONFIG_RT2870/#&/' .config
144 title 'Configure bzImage without modules...'
145 yes '' | make ARCH=i386 oldconfig
147 title 'Building bzImage without modules...'
148 make ARCH=i386 -j 4 bzImage || exit 1
150 mkdir -p $DESTDIR
151 mv arch/x86/boot/bzImage $DESTDIR
152 mv System.map System.map-without-modules
153 fi
155 # Build bzImage with modules
156 cp -f $stuff/$PACKAGE-slitaz.config .config
158 title 'Configure bzImage with modules...'
159 yes '' | make ARCH=i386 oldconfig
162 title 'Building bzImage with modules...'
163 make ARCH=i386 -j 4 bzImage &&
164 make ARCH=i386 -j 4 modules &&
165 make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR modules_install &&
166 make ARCH=i386 INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
168 [ -s arch/x86/boot/bzImage ] || return 1
169 mkdir -p $DESTDIR/boot
170 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
172 $stuff/tools/install_module_headers.sh $DESTDIR $src $VERSION-slitaz
174 ln System.map System.map-modules
175 ln Module.symvers Module.symvers-modules
176 }
178 # Rules to gen a SliTaz package suitable for Tazpkg.
179 genpkg_rules()
180 {
181 case "$ARCH" in
182 arm)
183 echo "Packing: ARM Kernel"
184 cp -a $install/* $fs
185 rm -f $fs/lib/modules/*/build $fs/lib/modules/*/source
186 return 0 ;;
187 x86_64)
188 echo "TODO: use default or custom x86_64 packing"
189 return 0 ;;
190 esac
192 # Copy the Kernel
193 cp -a $install/boot $fs
195 # Copy base modules
196 . $stuff/tools/copy_modules.sh
198 # We only need module.{order,builtin} because other map files are
199 # generated by depmod in post_install
200 cook_copy_files modules.order modules.builtin
201 rm -rf $fs/usr
203 # Pack all packages with a Kernel modules
204 [ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1
205 for i in $SPLIT; do
206 cook $i
207 done
209 # Checking for Linux Kernel modules that don't belong to any of the packages
210 $stuff/tools/check_modules.sh
211 }
213 # Pre and post install commands for Tazpkg.
214 post_install()
215 {
216 # Handle multiarch installation
217 case "$SLITAZ_ARCH" in
218 arm)
219 echo "Kernel : /boot/linux-$VERSION-slitaz-$ARCH"
220 echo "Modules: /lib/modules/$VERSION-slitaz"
221 return 0 ;;
222 esac
224 # GRUB stuff.
225 if [ -f "$1/boot/grub/menu.lst" ]; then
226 # Current root device
227 root_dev="/dev/$(lsblk | grep '/$'| grep -o '[a-z]d[a-z][0-9]*')"
228 grub_part="$(( $(echo $root_dev | grep -o '[0-9]*$')-1 ))"
229 # Use device.map to find grub device number
230 grub_dev="$(grep $(echo $root_dev | grep -o '^/dev/.d.' ) \
231 "$1/boot/grub/device.map" | cut -f1 | sed "s/)$/.$grub_part)/g")"
233 # Add and clean Kernel entries in case of upgrade for installed system.
234 if ! grep -q vmlinuz-$VERSION-slitaz "$1/boot/grub/menu.lst"; then
236 # Clean the old entry
237 # TODO: old vmlinuz file is removed but the entry is still there.
238 # So grub error:15 when selected: http://bugs.slitaz.org/?id=74
240 # Add the new entry
241 cat >> "$1/boot/grub/menu.lst" <<EOT
243 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
244 $grub_dev
245 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev quiet
246 EOT
247 # Make it the default entry
248 last_entry=$(( $(grep -c '^title' "$1/boot/grub/menu.lst")-1 ))
249 sed -e "s/^default.*/default $last_entry/g" -i "$1/boot/grub/menu.lst"
250 fi
252 # Display information message.
253 [ -z "$quiet" ] && cat <<EOT
255 ----
256 GRUB is installed, these three lines must be in your /boot/grub/menu.lst:
258 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
259 $grub_dev
260 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
261 ----
262 EOT
263 fi
264 :
265 }