wok view linux/receipt @ rev 20317

the current version (4.4) of the banking app is 7 years old :-( new version: 5.1.8
author Erkan Yilmaz <erkan@slitaz.org>
date Sun May 20 11:05:25 2018 +0000 (2018-05-20)
parents 71b689feb45c
children 564f7f9745bd
line source
1 # SliTaz package receipt.
3 PACKAGE="linux"
4 VERSION="3.16.55"
5 CATEGORY="base-system"
6 SHORT_DESC="The Linux kernel and modules."
7 MAINTAINER="devel@slitaz.org"
8 LICENSE="GPL2"
9 TARBALL="$PACKAGE-$VERSION.tar.xz"
10 WEB_SITE="http://www.kernel.org/"
11 WGET_URL="https://cdn.kernel.org/pub/linux/kernel/v${VERSION%%.*}.x/$TARBALL"
12 HOST_ARCH="i486 arm x86_64"
14 DEPENDS="kmod"
15 BUILD_DEPENDS="perl git xz lzma patch kmod uclibc-cross-compiler-x86_64 bc \
16 sysfsutils-dev libtool glib-dev libwrap libwrap-dev udev-dev"
18 #
19 # The Linux receipt handle cross compilation. For x86_64 we actually use
20 # the uclibc-cross-compiler-x86_64 and for ARM we use a real cross env.
21 # Please discuss any change and keep it simple, dont play with VERSION
22 # string or Kernel SUBLEVEL because depmod and Pankso dont like that!
23 #
24 # The receipt also handle some cook options for faster build:
25 # --nox64 : Skip the x86_64 cross compilation
26 # --nonomods : Skip bzImage without modules build
27 #
29 # Aufs enable chroot
30 AUFS_NOT_RAMFS="uclibc-cross-compiler-x86_64 is not compatible with aufs+tmpfs 8("
32 # Handle multiarch compilation. Less bdeps when cross-compiling for ARM
33 case "$ARCH" in
34 arm) BUILD_DEPENDS="xz" ;;
35 x86_64) BUILD_DEPENDS="xz" ;;
36 esac
38 # Handle multiarch installation. ARM use Busybox modutils, so avoid any
39 # deps on kmod. SLITAZ_ARCH can have also custom post_install commands
40 if [ -f $root/etc/slitaz/slitaz.conf ]; then
41 . $root/etc/slitaz/slitaz.conf
42 case "$SLITAZ_ARCH" in
43 arm) DEPENDS="" ;;
44 esac
45 fi
47 install_module_headers()
48 {
49 local path
50 path=usr/src/linux-$KVERSION
51 mkdir -p $1/lib/modules/$KVERSION
52 ln -sf /$path $1/lib/modules/$KVERSION/build
53 install -D -m644 $src/Makefile \
54 $1/$path/Makefile
55 install -D -m644 $src/kernel/Makefile \
56 $1/$path/kernel/Makefile
57 install -D -m644 $src/.config \
58 $1/$path/.config
59 mkdir -p $1/$path/include
61 cp -a $src/include/* $1/$path/include/
62 rm -f $1/$path/include/Kbuild
64 # copy arch includes for external modules
65 mkdir -p $1/$path/arch/x86
66 cp -a $src/arch/x86/include $1/$path/arch/x86/
68 # copy files necessary for later builds, like nvidia and vmware
69 cp -a $src/Module.symvers $1/$path/Module.symvers
70 cp -a $src/scripts $1/$path
71 # fix permissions on scripts dir
72 chmod og-w -R $1/$path/scripts
73 mkdir -p $1/$path/.tmp_versions
75 mkdir -p $1/$path/arch/x86/kernel
76 cp -a $src/arch/x86/Makefile $1/$path/arch/x86/
77 cp -a $src/arch/x86/Makefile_32.cpu $1/$path/arch/x86/
78 cp -a $src/arch/x86/kernel/asm-offsets.s $1/$path/arch/x86/kernel/
80 # add headers for lirc package
81 mkdir -p $1/$path/drivers/media
82 ( cd $src/drivers/media ; find i2c -name '*.h' | cpio -o -H newc ) | \
83 ( cd $1/$path/drivers/media ; cpio -idmu )
85 # add docbook makefile
86 install -D -m644 $src/Documentation/DocBook/Makefile \
87 $1/$path/Documentation/DocBook/Makefile
89 # add dm headers
90 mkdir -p $1/$path/drivers/md
91 cp -a $src/drivers/md/*.h $1/$path/drivers/md
93 # add inotify.h
94 mkdir -p $1/$path/include/linux
95 cp -a $src/include/linux/inotify.h $1/$path/include/linux/
97 # add wireless headers
98 mkdir -p $1/$path/net/mac80211/
99 cp -a $src/net/mac80211/*.h $1/$path/net/mac80211/
101 # add dvb headers for external modules
102 # in reference to:
103 # http://bugs.archlinux.org/task/9912
104 mkdir -p $1/$path/drivers/media/dvb-core
105 cp -a $src/drivers/media/dvb-core/*.h $1/$path/drivers/media/dvb-core/
107 # add dvb headers for external modules
108 # in reference to:
109 # http://bugs.archlinux.org/task/11194
110 if [ -d $src/include/config/dvb/ ]; then
111 mkdir -p $1/$path/include/config/dvb/
112 cp $src/include/config/dvb/*.h $1/$path/include/config/dvb/
113 fi
115 # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
116 # in reference to:
117 # http://bugs.archlinux.org/task/13146
118 mkdir -p $1/$path/drivers/media/dvb-frontends/
119 cp -a $src/drivers/media/dvb-frontends/lgdt330x.h $1/$path/drivers/media/dvb-frontends/
120 cp -a $src/drivers/media/i2c/msp3400-driver.h $1/$path/drivers/media/dvb-frontends/
122 # add dvb headers
123 # in reference to:
124 # http://bugs.archlinux.org/task/20402
125 mkdir -p $1/$path/drivers/media/usb/dvb-usb
126 cp -a $src/drivers/media/usb/dvb-usb/*.h $1/$path/drivers/media/usb/dvb-usb/
127 mkdir -p $1/$path/drivers/media/dvb-frontends
128 cp -a $src/drivers/media/dvb-frontends/*.h $1/$path/drivers/media/dvb-frontends/
129 mkdir -p $1/$path/drivers/media/tuners
130 cp -a $src/drivers/media/tuners/*.h $1/$path/drivers/media/tuners/
132 # add xfs and shmem for aufs building
133 mkdir -p $1/$path/fs/xfs
134 mkdir -p $1/$path/mm
135 cp -a $src/fs/xfs/xfs_sb.h $1/$path/fs/xfs/xfs_sb.h
136 cp -a $src/fs/*.h $1/$path/fs/
138 # copy in Kconfig files
139 for i in $(find . -name "Kconfig*"); do
140 mkdir -p $1/$path/$(echo $i | sed 's|/Kconfig.*||')
141 cp -a $src/$i $1/$path/$i
142 done
144 chown -R root.root $1/$path
145 find $1/$path -type d -exec chmod 755 {} \;
146 # remove unneeded architectures
147 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}
148 }
150 # Rules to configure and make the package.
151 compile_rules()
152 {
153 if [ -f "/usr/share/boot/initrd" ]; then
154 cp /usr/share/boot/initrd initrd.cpio
155 fi
157 # Handle cross compilation
158 case "$ARCH" in
159 arm)
160 echo "Compiling: $ARCH Kernel"
161 make mrproper
162 patch -Np1 < $stuff/$ARCH/linux-arm.patch || exit 1
163 cp -f $stuff/$ARCH/linux-arm.config .config
164 yes '' | make ARCH=$ARCH oldconfig
165 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- bzImage &&
166 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- modules &&
167 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- \
168 INSTALL_MOD_PATH=$DESTDIR modules_install &&
169 mkdir -p $DESTDIR/boot &&
170 cp -a arch/arm/boot/zImage \
171 $DESTDIR/boot/linux-$VERSION-slitaz-$ARCH
172 #$stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
173 return 0 ;;
174 x86_64)
175 echo "TODO: Maybe use default ? But cross compile in x86_64 chroot"
176 echo "so we can remove the 64 build by uclibc-cross-compiler-x86_64"
177 return 0 ;;
178 esac
180 # Check for Aufs and get source/patches if needed
181 echo "Checking for Aufs packages..."
182 AUFSVER=$(grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g')
183 AUFSDIR="$WOK/aufs/source/aufs-${AUFSVER}"
184 if [ ! -d "$AUFSDIR" ]; then
185 [ ! -f "$SRC/aufs-${AUFSVER}.tar.bz2" ] && cook aufs --getsrc
186 mkdir -p $WOK/aufs/source/
187 echo "Extracting: aufs-${AUFSVER}.tar.bz2"
188 tar xjf $SRC/aufs-${AUFSVER}.tar.bz2 -C $WOK/aufs/source/
189 fi
191 echo "cook:linux" > $command
193 echo "Copying Aufs files and patches..."
194 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
196 # Use fixed patchs from stuff
197 cp -a $AUFSDIR/aufs3-*.patch $stuff
199 # SliTaz db stuff
200 [ -d $WOK/$PACKAGE/source/slitaz ] && rm -rf $WOK/$PACKAGE/source/slitaz
201 mkdir -p $WOK/$PACKAGE/source/slitaz
202 echo "$WGET_URL" > $WOK/$PACKAGE/source/slitaz/url
203 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/source/slitaz
204 cp $stuff/bootloader.sh $WOK/$PACKAGE/source/slitaz
206 # Apply patches
207 echo "Applying patches..."
208 while read patch_file; do
209 echo "$patch_file" >> $WOK/$PACKAGE/source/slitaz/patches
210 cp $stuff/$patch_file $WOK/$PACKAGE/source/slitaz
211 if [ -f done.$patch_file ]; then
212 echo "Skipping $patch_file" && continue
213 fi
214 echo "Apply $patch_file"
215 patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || return 1
216 touch done.$patch_file
217 done <<EOT
218 $PACKAGE-diff.u
219 $PACKAGE-freeinitrd.u
220 $PACKAGE-subroot.u
221 $PACKAGE-romfs.u
222 $PACKAGE-tcp_stealth.u
223 aufs3-base.patch
224 aufs3-standalone.patch
225 aufs3-loopback.patch
226 aufs3-mmap.patch
227 EOT
229 # Mrproper and lguest
230 echo "Make kernel proper and then build lguest..."
231 make mrproper
232 cd tools/lguest
233 make lguest || return 1
235 echo "Build usbip..."
236 cd $src/drivers/staging/usbip/userspace
237 ./autogen.sh
238 ./configure CFLAGS="$CFLAGS -Wno-error=uninitialized" \
239 --with-usbids-dir=/usr/share/misc \
240 --mandir=/usr/share/man $CONFIGURE_ARGS &&
241 make && make DESTDIR=$DESTDIR/usbip install || return 1
243 cd $src
245 #
246 # Arch x86_64: TODO have a real cross environment
247 #
248 if [ ! "$nox64" ]; then
249 echo "Compiling: x86_64 Kernel"
251 # Build bzImage64 without modules first
252 if [ ! "$nonomods" ]; then
253 [ -d $DESTDIR/linux64 ] || mkdir -p $DESTDIR/linux64 ||
254 return 1
255 cp -f $stuff/$PACKAGE-slitaz.config64 .config
256 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
257 echo -e "\n* Configure bzImage64 without modules...\n"
258 yes '' | make ARCH=x86_64 oldconfig
259 echo -e "\n* Building bzImage64 without modules...\n"
260 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || exit 1
261 mv arch/x86/boot/bzImage $DESTDIR/linux64
262 mv System.map System.map-without-modules64
263 mv vmlinux vmlinux-without-modules64
264 mv .config config-without-modules64
265 fi
267 # Build bzImage64 with modules
268 cp -f $stuff/$PACKAGE-slitaz.config64 .config
269 echo -e "\n* Configure bzImage64 with modules...\n"
270 yes '' | make ARCH=x86_64 oldconfig
271 echo -e "\n* Building bzImage64 with modules...\n"
272 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage &&
273 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- modules &&
274 make ARCH=x86_64 INSTALL_MOD_PATH=$DESTDIR/linux64 modules_install &&
275 make ARCH=x86_64 INSTALL_HDR_PATH=$DESTDIR/linux64/usr headers_install &&
276 ln .config $WOK/$PACKAGE/source/slitaz/config64
277 [ -s arch/x86/boot/bzImage ] || return 1
278 mkdir -p $DESTDIR/linux64/boot 2> /dev/null
279 mv arch/x86/boot/bzImage $DESTDIR/linux64/boot/vmlinuz-$VERSION-slitaz64
280 KVERSION=$VERSION-slitaz64
281 install_module_headers $DESTDIR/linux64
282 ln System.map System.map-modules64
283 ln vmlinux vmlinux-modules64
284 ln Module.symvers Module.symvers-modules64
285 cp .config config-modules64
286 else
287 echo "* Skipping: x86_64 Kernel..."
288 fi
290 #
291 # Linux Arch i386 - GCC arch i486
292 #
293 echo "Compiling: i386 Kernel..."
295 # Build bzImage without modules first
296 if [ ! "$nonomods" ]; then
297 cp -f $stuff/$PACKAGE-slitaz.config .config
298 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
299 echo -e "\n* Configure bzImage without modules...\n"
300 yes '' | make ARCH=i386 oldconfig
301 echo -e "\n* Building bzImage without modules...\n"
302 make ARCH=i386 -j 4 bzImage || exit 1
303 [ -d $DESTDIR ] || mkdir -p $DESTDIR
304 mv arch/x86/boot/bzImage $DESTDIR
305 mv System.map System.map-without-modules
306 mv vmlinux vmlinux-without-modules
307 mv .config config-without-modules
308 fi
310 # Build bzImage with modules
311 cp -f $stuff/$PACKAGE-slitaz.config .config
312 echo -e "\n* Configure bzImage with modules...\n"
313 yes '' | make ARCH=i386 oldconfig
314 ln .config $WOK/$PACKAGE/source/slitaz/config
315 echo -e "\n* Building bzImage with modules...\n"
316 make ARCH=i386 -j 4 bzImage &&
317 make ARCH=i386 -j 4 modules &&
318 make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR modules_install &&
319 make ARCH=i386 INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
320 [ -s arch/x86/boot/bzImage ] || return 1
321 mkdir -p $DESTDIR/boot 2> /dev/null
322 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
323 KVERSION=$VERSION-slitaz
324 install_module_headers $DESTDIR
326 # Compress all modules.
327 if [ -d "$DESTDIR/lib/modules/$VERSION-slitaz" ]; then
328 $stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
329 else
330 return 1
331 fi
332 if [ -d "$DESTDIR/linux64/lib/modules/$VERSION-slitaz64" ]; then
333 $stuff/gztazmod.sh $DESTDIR/linux64/lib/modules/$VERSION-slitaz64
334 fi
335 ln System.map System.map-modules
336 ln vmlinux vmlinux-modules
337 ln Module.symvers Module.symvers-modules
338 cp .config config-modules
339 }
341 # Rules to gen a SliTaz package suitable for Tazpkg.
342 genpkg_rules()
343 {
344 case "$ARCH" in
345 arm)
346 echo "Packing: ARM Kernel"
347 cp -a $install/* $fs
348 rm -f $fs/lib/modules/*/build $fs/lib/modules/*/source
349 return 0 ;;
350 x86_64)
351 echo "TODO: use default or custom x86_64 packing"
352 return 0 ;;
353 esac
355 export PACKAGE VERSION
356 local path
357 cp -a $install/boot $fs
359 # Compress all modules.
360 path=$fs/lib/modules/$VERSION-slitaz/kernel
361 mkdir -p $path
363 # Get the base modules
364 export src install
365 mkdir -p $WOK/$PACKAGE/source/tmp
366 # Warning stuff/list_modules.sh must find the generated modules.list
367 $stuff/list_modules.sh \
368 $(cat $stuff/modules.list) > $WOK/$PACKAGE/source/tmp/modules.list
369 while read module; do
370 dir=$(dirname $module)
371 [ -d $path/$dir ] || mkdir -p $path/$dir
372 cp -a $install/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
373 done < $WOK/$PACKAGE/source/tmp/modules.list
375 # Remove unresolved links
376 rm -f $fs/lib/modules/$VERSION-slitaz/build
377 rm -f $fs/lib/modules/$VERSION-slitaz/source
379 # We only need module.{order,builtin} because other map files are
380 # generated by depmod in post_install
381 cp -a $install/lib/modules/$VERSION-slitaz/modules.order \
382 $install/lib/modules/$VERSION-slitaz/modules.builtin \
383 $fs/lib/modules/$VERSION-slitaz
385 # Pack all packages with a kernel module
386 sed -i "/^$PACKAGE\$/d" $CACHE/broken 2>/dev/null || true
387 for i in $(cd $WOK; grep -l '^WANTED="linux"' */receipt); do
388 [ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1
389 cook ${i%/receipt}
390 done
392 # Check any module in kernel .config that's not added to a linux-* pkgs
393 # and remove aufs patches: we dont need them in HG wok.
394 $stuff/check_modules.sh
396 # Keep fixed patches !
397 #rm -f $stuff/aufs3-*
398 }
400 # Pre and post install commands for Tazpkg.
401 post_install()
402 {
403 chroot "$root/" depmod -a $VERSION-slitaz
405 # Handle multiarch installation
406 case "$SLITAZ_ARCH" in
407 arm)
408 echo "Kernel : /boot/linux-$VERSION-slitaz-$ARCH"
409 echo "Modules: /lib/modules/$VERSION-slitaz"
410 return 0 ;;
411 esac
413 # GRUB stuff.
414 if [ -f "$1/boot/grub/menu.lst" ]; then
415 # Current root device
416 root_dev="/dev/$(lsblk | grep '/$'| grep -o '[a-z]d[a-z][0-9]*')"
417 grub_part="$(( $(echo $root_dev | grep -o '[0-9]*$')-1 ))"
418 # Use device.map to find grub device number
419 grub_dev="$(grep $(echo $root_dev | grep -o '^/dev/.d.' ) \
420 "$1/boot/grub/device.map" | cut -f1 | sed "s/)$/.$grub_part)/g")"
422 # Add and clean kernel entries in case of upgrade for installed system.
423 if ! grep -q vmlinuz-$VERSION-slitaz "$1/boot/grub/menu.lst"; then
425 # Clean the old entry
426 # TODO: old vmlinuz file is removed but the entry is still there.
427 # So grub error:15 when selected: http://bugs.slitaz.org/?id=74
429 # Add the new entry
430 cat >> "$1/boot/grub/menu.lst" << EOT
432 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
433 $grub_dev
434 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev quiet
435 EOT
436 # Make it the default entry
437 last_entry=$(( $(grep -c '^title' "$1/boot/grub/menu.lst")-1 ))
438 sed -e "s/^default.*/default $last_entry/g" -i "$1/boot/grub/menu.lst"
439 fi
441 # Display information message.
442 cat <<EOT
444 ----
445 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
447 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
448 $grub_dev
449 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
450 ----
451 EOT
452 fi
453 true
454 }