updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / kernel26rt / PKGBUILD
blob1e5fd9b99e6318c71a6b5048aaf4ad30d56b276e
1 # Maintainer: Ray Rashif <schiv@archlinux.org>
2 # Contributor: timbosa <tinny_tim@dodo.com.au>
3 # Contributor: Tobias Powalowski <tpowa@archlinux.org>
4 # Contributor: Thomas Baechler <thomas@archlinux.org>
6 pkgname=kernel26rt
7 _kernelname=${pkgname#kernel26}
8 _basekernel=2.6.33
9 _realkernel=2.6.33 # for rc builds, else same as _basekernel
10 _kernelpatch=.9 # leave blank if no upstream patch
11 _rtpatch=-rt31
12 pkgver=2.6.33.9_rt31
13 pkgrel=1
15 # If sources are rc, old rc, old rt, rc & old rt, old rc & old rt:
16 # rc, rc-old, rt-old, rc-rt-old, all-old or blank for default
17 _source=
19 # -- nothing to change below this line -- #
21 pkgdesc="The Linux Kernel and modules - with realtime preemption"
22 arch=('i686' 'x86_64')
23 license=('GPL2')
24 url="http://rt.wiki.kernel.org"
25 backup=(etc/mkinitcpio.d/$pkgname.preset)
26 depends=('coreutils' 'linux-firmware' 'module-init-tools' 'mkinitcpio')
27 optdepends=('crda: to set the correct wireless channels of your country')
28 provides=('kernel26rt-headers')
29 install=$pkgname.install
30 changelog=$pkgname.changelog
32 [ "$_source" = "rc" ] && _rc=testing/
33 [ "$_source" = "rc-old" ] && _rc=testing/v$_realkernel/
34 [ "$_source" = "rt-old" ] && _rt=older/
35 [ "$_source" = "rc-rt-old" ] && _rc=testing/ && _rt=older/
36 [ "$_source" = "all-old" ] && _rc=testing/v$_realkernel/ && _rt=older/
37 #[ -n "$_kernelpatch" ] && _kernpatchurl="ftp://ftp.kernel.org/pub/linux/kernel/v2.6/${_rc}patch-$_realkernel$_kernelpatch.bz2"
38 [ -n "$_kernelpatch" ] && _kernpatchurl="http://www.kernel.org/pub/linux/kernel/v2.6/longterm/v$_basekernel/${_rc}patch-$_realkernel$_kernelpatch.bz2"
40 options=(!strip)
41 source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$_realkernel.tar.bz2
42         $_kernpatchurl
43         ftp://ftp.kernel.org/pub/linux/kernel/projects/rt/${_rt}patch-$_realkernel$_kernelpatch$_rtpatch.bz2
44         config
45         config.x86_64
46         $pkgname.preset
47         logo_linux_clut224.ppm
48         aufs2-base.patch
49         aufs2-standalone.patch)
51 build() {
52   cd "$srcdir/linux-$_realkernel"
54   # Add upstream patch
55   if [ -n "$_kernelpatch" ]; then
56     patch -Np1 -i ../patch-$_realkernel$_kernelpatch
57   fi
59   # Add support for AUFS2
60   patch -Np1 -i ../aufs2-base.patch
61   patch -Np1 -i ../aufs2-standalone.patch
63   # Add realtime patch
64   patch -Np1 -i ../patch-$_realkernel$_kernelpatch$_rtpatch
66   # Fix breakage in https://bugzilla.kernel.org/show_bug.cgi?id=29432
67   sed -i "s/^\tstruct page \*page;$//1" drivers/net/igbvf/igbvf.h;
69   # Add our custom logo
70   cp ../logo_linux_clut224.ppm drivers/video/logo/
72   # Set up configuration
73   if [ "$CARCH" = "x86_64" ]; then
74     cat ../config.x86_64 > ./.config
75   else
76     cat ../config > ./.config
77   fi
79   if [ -f "$startdir/config.save" ]; then
80     msg "Using previously autosaved config"
81     cat "$startdir/config.save" > ./.config
82   fi
84   sed -i "s|EXTRAVERSION =.*|EXTRAVERSION =|g" Makefile
85   sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"-$_kernelname\"|g" ./.config
87   # load configuration
88   _kernver=$_basekernel-$_kernelname
89   yes "" | make config
90   make menuconfig && cat ./.config > "$startdir/config.save"
91   #make xconfig
92   #make gconfig
93   #make oldconfig
95   # build!
96   make bzImage modules
99 package() {
100   cd "$srcdir/linux-$_realkernel"
102   KARCH=x86
103   _kernver=$_basekernel-$_kernelname
105   mkdir -p "$pkgdir"/{lib/modules,boot}
106   make INSTALL_MOD_PATH="$pkgdir" modules_install
107   cp System.map "$pkgdir/boot/System.map26$_kernelname"
108   cp arch/$KARCH/boot/bzImage "$pkgdir/boot/vmlinuz26$_kernelname"
110   # add vmlinux
111   install -m644 -D vmlinux "$pkgdir/usr/src/linux-$_kernver/vmlinux"
113   # install fallback mkinitcpio.conf file and preset file for kernel
114   install -m644 -D "$srcdir/$pkgname.preset" "$pkgdir/etc/mkinitcpio.d/$pkgname.preset"
116   # set correct depmod command for install
117   sed \
118     -e  "s/KERNEL_NAME=.*/KERNEL_NAME=$_kernelname/g" \
119     -e  "s/KERNEL_VERSION=.*/KERNEL_VERSION=$_kernver/g" \
120     -i "$startdir/$install"
121   sed \
122     -e "s|source .*|source /etc/mkinitcpio.d/kernel26$_kernelname.kver|g" \
123     -e "s|default_image=.*|default_image=\"/boot/$pkgname.img\"|g" \
124     -e "s|fallback_image=.*|fallback_image=\"/boot/$pkgname-fallback.img\"|g" \
125     -i "$pkgdir/etc/mkinitcpio.d/$pkgname.preset"
127   echo -e "# DO NOT EDIT THIS FILE\nALL_kver='$_kernver'" > "$pkgdir/etc/mkinitcpio.d/$pkgname.kver"
129   # remove build and source links
130   rm -f "$pkgdir"/lib/modules/$_kernver/{source,build}
132   # remove the firmware
133   rm -rf "$pkgdir/lib/firmware"
135   # -- package the headers --#
137   mkdir -p "$pkgdir/lib/modules/$_kernver"
138   cd "$pkgdir/lib/modules/$_kernver"
139   ln -sf ../../../usr/src/linux-$_kernver build
140   cd "$srcdir/linux-$_realkernel"
141   install -D -m644 Makefile \
142     "$pkgdir/usr/src/linux-$_kernver/Makefile"
143   install -D -m644 kernel/Makefile \
144     "$pkgdir/usr/src/linux-$_kernver/kernel/Makefile"
145   install -D -m644 .config \
146     "$pkgdir/usr/src/linux-$_kernver/.config"
147   mkdir -p "$pkgdir/usr/src/linux-$_kernver/include"
149   for i in acpi asm-generic config generated linux math-emu media net pcmcia scsi sound trace video; do
150     cp -a include/$i "$pkgdir/usr/src/linux-$_kernver/include/"
151   done
153   # copy arch includes for external modules
154   mkdir -p "$pkgdir/usr/src/linux-$_kernver/arch/x86"
155   cp -a arch/x86/include "$pkgdir/usr/src/linux-$_kernver/arch/x86/"
157   # copy files necessary for later builds, like nvidia and vmware
158   cp Module.symvers "$pkgdir/usr/src/linux-$_kernver"
159   cp -a scripts "$pkgdir/usr/src/linux-$_kernver"
161   # fix permissions on scripts dir
162   chmod og-w -R "$pkgdir/usr/src/linux-$_kernver/scripts"
163   mkdir -p "$pkgdir/usr/src/linux-$_kernver/.tmp_versions"
165   mkdir -p "$pkgdir/usr/src/linux-$_kernver/arch/$KARCH/kernel"
167   cp arch/$KARCH/Makefile "$pkgdir/usr/src/linux-$_kernver/arch/$KARCH/"
169   if [ "$CARCH" = "i686" ]; then
170     cp arch/$KARCH/Makefile_32.cpu "$pkgdir/usr/src/linux-$_kernver/arch/$KARCH/"
171   fi
173   cp arch/$KARCH/kernel/asm-offsets.s "$pkgdir/usr/src/linux-$_kernver/arch/$KARCH/kernel/"
175   # add headers for lirc package
176   mkdir -p "$pkgdir/usr/src/linux-$_kernver/drivers/media/video"
177   cp drivers/media/video/*.h  "$pkgdir/usr/src/linux-$_kernver/drivers/media/video/"
179   for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102 usbvideo zc0301; do
180     mkdir -p "$pkgdir/usr/src/linux-$_kernver/drivers/media/video/$i"
181     cp -a drivers/media/video/$i/*.h "$pkgdir/usr/src/linux-$_kernver/drivers/media/video/$i"
182   done
184   # add docbook makefile
185   install -D -m644 Documentation/DocBook/Makefile \
186     "$pkgdir/usr/src/linux-$_kernver/Documentation/DocBook/Makefile"
188   # add dm headers
189   mkdir -p "$pkgdir/usr/src/linux-$_kernver/drivers/md"
190   cp drivers/md/*.h "$pkgdir/usr/src/linux-$_kernver/drivers/md"
192   # add inotify.h
193   mkdir -p "$pkgdir/usr/src/linux-$_kernver/include/linux"
194   cp include/linux/inotify.h "$pkgdir/usr/src/linux-$_kernver/include/linux/"
196   # add wireless headers
197   mkdir -p "$pkgdir/usr/src/linux-$_kernver/net/mac80211/"
198   cp net/mac80211/*.h "$pkgdir/usr/src/linux-$_kernver/net/mac80211/"
200   # add dvb headers for external modules
201   # in reference to:
202   # http://bugs.archlinux.org/task/9912
203   mkdir -p "$pkgdir/usr/src/linux-$_kernver/drivers/media/dvb/dvb-core"
204   cp drivers/media/dvb/dvb-core/*.h "$pkgdir/usr/src/linux-$_kernver/drivers/media/dvb/dvb-core/"
206   # add dvb headers for external modules
207   # in reference to:
208   # http://bugs.archlinux.org/task/11194
209   mkdir -p "$pkgdir/usr/src/linux-$_kernver/include/config/dvb/"
210   cp include/config/dvb/*.h "$pkgdir/usr/src/linux-$_kernver/include/config/dvb/"
212   # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
213   # in reference to:
214   # http://bugs.archlinux.org/task/13146
215   mkdir -p "$pkgdir/usr/src/linux-$_kernver/drivers/media/dvb/frontends/"
216   cp drivers/media/dvb/frontends/lgdt330x.h "$pkgdir/usr/src/linux-$_kernver/drivers/media/dvb/frontends/"
217   cp drivers/media/video/msp3400-driver.h "$pkgdir/usr/src/linux-$_kernver/drivers/media/dvb/frontends/"
219   # add xfs and shmem for aufs building
220   mkdir -p "$pkgdir/usr/src/linux-$_kernver/fs/xfs"
221   mkdir -p "$pkgdir/usr/src/linux-$_kernver/mm"
222   cp fs/xfs/xfs_sb.h "$pkgdir/usr/src/linux-$_kernver/fs/xfs/xfs_sb.h"
224   # add headers vor virtualbox
225   # in reference to:
226   # http://bugs.archlinux.org/task/14568
227   cp -a include/drm "$pkgdir/usr/src/linux-$_kernver/include/"
229   # add headers for broadcom wl
230   # in reference to:
231   # http://bugs.archlinux.org/task/14568
232   cp -a include/trace "$pkgdir/usr/src/linux-$_kernver/include/"
234   # copy in Kconfig files
235   for i in `find . -name "Kconfig*"`; do
236     mkdir -p "$pkgdir"/usr/src/linux-$_kernver/`echo $i | sed 's|/Kconfig.*||'`
237     cp $i "$pkgdir/usr/src/linux-$_kernver/$i"
238   done
240   chown -R root.root "$pkgdir/usr/src/linux-$_kernver"
241   find "$pkgdir/usr/src/linux-$_kernver" -type d -exec chmod 755 {} \;
243   # remove unneeded architectures
244   rm -rf "$pkgdir/usr/src/linux-$_kernver/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}"
247 # vim:set ts=2 sw=2 et:
248 md5sums=('c3883760b18d50e8d78819c54d579b00'
249          'f6801744832f9cc7c7993fa2265e86c3'
250          '110380e5eeb2fbc019c7232037dc522c'
251          '18da80ac1d41cba0f74cace471862bba'
252          'bcfba8783fd7d0db1261de2f002ad717'
253          'a0921a7e563e7ae2d14c3a0603fa16ad'
254          '6a5a1925501fe20fafd04fdb3cb4f6ed'
255          'edb62063ec2a61fc82cc00b89920f729'
256          'e924c5a340f2731c245e6bff8002be13')