1 # Contributor: graysky <graysky AT archlinux dot us>
2 # Contributor: Tobias Powalowski <tpowa@archlinux.org>
3 # Contributor: Thomas Baechler <thomas@archlinux.org>
5 pkgbase=kernel26-lts-ck
6 pkgname=('kernel26-lts-ck')
7 true && pkgname=('kernel26-lts-ck' 'kernel26-lts-ck-headers')
9 pkgver=${_basekernel}.14
11 _kernelname=${pkgname#kernel26}
13 _ckpatchname="${_basekernel}.12-ck${_ckpatchversion}-broken-out"
14 _ckupdate="2.6.35.13-sched-bfs-404.patch"
15 _fixed="mm-kswapd_inherit_prio-1.patch"
16 arch=('i686' 'x86_64')
18 url="http://www.kernel.org"
19 source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$_basekernel.tar.bz2
20 ftp://ftp.kernel.org/pub/linux/kernel/v2.6/longterm/v2.6.35/patch-$pkgver.bz2
21 config config.x86_64 # the main kernel config files
22 ${pkgname}.preset # standard config files for mkinitcpio ramdisk
24 http://ck.kolivas.org/patches/bfs/2.6.35/${_ckupdate}
25 ${_fixed}) # fixed by Hador
29 ### Make ck1 patchset with updated bfs v0.404 # 20-Apr-2011
30 # Thanks for Hador for fixing mm-kswapd_inherit_prio-1 to work!
32 cat "$srcdir"/${_ckupdate} sched-add-above-background-load-function.patch mm-zero_swappiness.patch \
33 mm-enable_swaptoken_only_when_swap_full.patch mm-drop_swap_cache_aggressively.patch "$srcdir"/${_fixed} \
34 mm-background_scan.patch mm-idleprio_prio-1.patch mm-lru_cache_add_lru_tail.patch kconfig-expose_vmsplit_option.patch \
35 hz-default_1000.patch hz-no_default_250.patch hz-raise_max.patch preempt-desktop-tune.patch cpufreq-bfs_tweaks.patch \
36 ck1-version.patch > "$srcdir"/unified.patch
38 cd "$srcdir"/linux-$_basekernel
39 if [ "$_basekernel" != "$pkgver" ]; then
40 # add latest kernel stable patch
41 msg "Patching base source $_basekernel to $pkgver"
42 patch -Np1 -i "$srcdir"/patch-$pkgver
45 # Fix double name in EXTRAVERSION
46 sed -i -re "s/^(.EXTRAVERSION).*$/\1 = /" "$srcdir"/unified.patch
48 # patch with new unified patch
49 msg "Patching source with ck1 + bfs v0.404"
50 patch -Np1 -i "$srcdir"/unified.patch
52 # clean tree and get config
53 msg "Running make mrproper to clean source tree"
56 if [ "$CARCH" = "x86_64" ]; then
57 cat ../config.x86_64 >./.config
59 cat ../config >./.config
61 if [ "${_kernelname}" != "" ]; then
62 sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
64 # remove the extraversion from Makefile
65 # this ensures our kernel version is always 2.6.XX-lts-ck
66 # this way, minor kernel updates will not break external modules
67 sed -i 's|^EXTRAVERSION = .*$|EXTRAVERSION = |g' Makefile
72 # Configure the kernel. Replace the line below with one of your choice.
73 #make menuconfig # CLI menu for configuration
74 #make nconfig # new CLI menu for configuration
75 #make xconfig # X-based configuration
76 #make oldconfig # using old config from previous kernel version
77 # ... or manually edit .config
80 # this is useful to configure the kernel
86 make ${MAKEFLAGS} bzImage modules
89 package_kernel26-lts-ck() {
90 pkgdesc="Longtime supported kernel package suitable for servers patched with backported Brain Fuck Scheduler v0.401."
91 backup=(etc/mkinitcpio.d/${pkgname}.preset)
92 depends=('coreutils' 'linux-firmware>=2.6.34' 'module-init-tools>=3.12-2' 'mkinitcpio>=0.6.8-2')
93 provides=("kernel26-lts-ck=${pkgver}")
94 install=${pkgname}.install
95 optdepends=('crda: to set the correct wireless channels of your country'
96 'nvidia-lts-ck: nVidia drivers for kernel26-lts-ck')
98 cd "$srcdir"/linux-$_basekernel
100 _kernver="$(make kernelrelease)"
101 mkdir -p "$pkgdir"/{lib/modules,lib/firmware,boot}
102 msg "Running make modules_install"
103 make INSTALL_MOD_PATH="$pkgdir" modules_install
104 cp System.map "$pkgdir"/boot/System.map26${_kernelname}
105 cp arch/$KARCH/boot/bzImage "$pkgdir"/boot/vmlinuz26${_kernelname}
107 install -m644 -D vmlinux "$pkgdir"/usr/src/linux-${_kernver}/vmlinux
109 # install fallback mkinitcpio.conf file and preset file for kernel
110 install -m644 -D "$srcdir"/${pkgname}.preset "$pkgdir"/etc/mkinitcpio.d/${pkgname}.preset
111 # set correct depmod command for install
113 -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
114 -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
115 -i $startdir/${pkgname}.install
117 -e "s|source .*|source /etc/mkinitcpio.d/kernel26${_kernelname}.kver|g" \
118 -e "s|default_image=.*|default_image=\"/boot/${pkgname}.img\"|g" \
119 -e "s|fallback_image=.*|fallback_image=\"/boot/${pkgname}-fallback.img\"|g" \
120 -i "$pkgdir"/etc/mkinitcpio.d/${pkgname}.preset
122 echo -e "# DO NOT EDIT THIS FILE\nALL_kver='${_kernver}'" > "$pkgdir"/etc/mkinitcpio.d/${pkgname}.kver
123 # remove build and source links
124 rm -f "$pkgdir"/lib/modules/${_kernver}/{source,build}
125 # remove the firmware
126 rm -rf "$pkgdir"/lib/firmware
128 # gzip -9 all modules to save 100MB of space
129 find "$pkgdir" -name '*.ko' -exec gzip -9 {} \;
132 package_kernel26-lts-ck-headers() {
133 pkgdesc="Header files and scripts for building modules for kernel26-lts-ck."
134 provides=("kernel26-lts-ck-headers=${pkgver}")
135 mkdir -p "$pkgdir"/lib/modules/${_kernver}
136 cd "$pkgdir"/lib/modules/${_kernver}
137 ln -sf ../../../usr/src/linux-${_kernver} build
138 cd "$srcdir"/linux-$_basekernel
139 install -D -m644 Makefile \
140 "$pkgdir"/usr/src/linux-${_kernver}/Makefile
141 install -D -m644 kernel/Makefile \
142 "$pkgdir"/usr/src/linux-${_kernver}/kernel/Makefile
143 install -D -m644 .config \
144 "$pkgdir"/usr/src/linux-${_kernver}/.config
145 mkdir -p "$pkgdir"/usr/src/linux-${_kernver}/include
147 for i in acpi asm-generic config generated linux math-emu media net pcmcia scsi sound trace video xen; do
148 cp -a include/$i "$pkgdir"/usr/src/linux-${_kernver}/include/
151 # copy arch includes for external modules
152 mkdir -p "$pkgdir"/usr/src/linux-${_kernver}/arch/x86
153 cp -a arch/x86/include "$pkgdir"/usr/src/linux-${_kernver}/arch/x86/
155 # copy files necessary for later builds, like nvidia and vmware
156 cp Module.symvers "$pkgdir"/usr/src/linux-${_kernver}
157 cp -a scripts "$pkgdir"/usr/src/linux-${_kernver}
158 # fix permissions on scripts dir
159 chmod og-w -R "$pkgdir"/usr/src/linux-${_kernver}/scripts
160 mkdir -p "$pkgdir"/usr/src/linux-${_kernver}/.tmp_versions
162 mkdir -p "$pkgdir"/usr/src/linux-${_kernver}/arch/$KARCH/kernel
164 cp arch/$KARCH/Makefile "$pkgdir"/usr/src/linux-${_kernver}/arch/$KARCH/
165 if [ "$CARCH" = "i686" ]; then
166 cp arch/$KARCH/Makefile_32.cpu "$pkgdir"/usr/src/linux-${_kernver}/arch/$KARCH/
168 cp arch/$KARCH/kernel/asm-offsets.s "$pkgdir"/usr/src/linux-${_kernver}/arch/$KARCH/kernel/
170 # add headers for lirc package
171 mkdir -p "$pkgdir"/usr/src/linux-${_kernver}/drivers/media/video
172 cp drivers/media/video/*.h "$pkgdir"/usr/src/linux-${_kernver}/drivers/media/video/
173 for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102 usbvideo; do
174 mkdir -p "$pkgdir"/usr/src/linux-${_kernver}/drivers/media/video/$i
175 cp -a drivers/media/video/$i/*.h "$pkgdir"/usr/src/linux-${_kernver}/drivers/media/video/$i
177 # add docbook makefile
178 install -D -m644 Documentation/DocBook/Makefile \
179 "$pkgdir"/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile
181 mkdir -p "$pkgdir"/usr/src/linux-${_kernver}/drivers/md
182 cp drivers/md/*.h "$pkgdir"/usr/src/linux-${_kernver}/drivers/md
184 mkdir -p "$pkgdir"/usr/src/linux-${_kernver}/include/linux
185 cp include/linux/inotify.h "$pkgdir"/usr/src/linux-${_kernver}/include/linux/
186 # add wireless headers
187 mkdir -p "$pkgdir"/usr/src/linux-${_kernver}/net/mac80211/
188 cp net/mac80211/*.h "$pkgdir"/usr/src/linux-${_kernver}/net/mac80211/
189 # add dvb headers for external modules
191 # http://bugs.archlinux.org/task/9912
192 mkdir -p "$pkgdir"/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core
193 cp drivers/media/dvb/dvb-core/*.h "$pkgdir"/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/
194 # add dvb headers for external modules
196 # http://bugs.archlinux.org/task/11194
197 mkdir -p "$pkgdir"/usr/src/linux-${_kernver}/include/config/dvb/
198 [[ -e include/config/dvb/ ]] && cp include/config/dvb/*.h "$pkgdir"/usr/src/linux-${_kernver}/include/config/dvb/
199 # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
201 # http://bugs.archlinux.org/task/13146
202 mkdir -p "$pkgdir"/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
203 cp drivers/media/dvb/frontends/lgdt330x.h "$pkgdir"/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
204 cp drivers/media/video/msp3400-driver.h "$pkgdir"/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
207 # http://bugs.archlinux.org/task/20402
208 mkdir -p "$pkgdir"/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb
209 cp drivers/media/dvb/dvb-usb/*.h "$pkgdir"/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/
210 mkdir -p "$pkgdir"/usr/src/linux-${_kernver}/drivers/media/dvb/frontends
211 cp drivers/media/dvb/frontends/*.h "$pkgdir"/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
212 mkdir -p "$pkgdir"/usr/src/linux-${_kernver}/drivers/media/common/tuners
213 cp drivers/media/common/tuners/*.h "$pkgdir"/usr/src/linux-${_kernver}/drivers/media/common/tuners/
214 # add xfs and shmem for aufs building
215 mkdir -p "$pkgdir"/usr/src/linux-${_kernver}/fs/xfs
216 mkdir -p "$pkgdir"/usr/src/linux-${_kernver}/mm
217 cp fs/xfs/xfs_sb.h "$pkgdir"/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h
218 # add headers for virtualbox
220 # http://bugs.archlinux.org/task/14568
221 cp -a include/drm $pkgdir/usr/src/linux-${_kernver}/include/
223 # add headers for broadcom wl
225 # http://bugs.archlinux.org/task/14568
226 cp -a include/trace $pkgdir/usr/src/linux-${_kernver}/include/
227 # add headers for crypto modules
229 # http://bugs.archlinux.org/task/22081
230 cp -a include/crypto $pkgdir/usr/src/linux-${_kernver}/include/
232 # copy in Kconfig files
233 for i in `find . -name "Kconfig*"`; do
234 mkdir -p "$pkgdir"/usr/src/linux-${_kernver}/`echo $i | sed 's|/Kconfig.*||'`
235 cp $i "$pkgdir"/usr/src/linux-${_kernver}/$i
238 chown -R root.root "$pkgdir"/usr/src/linux-${_kernver}
239 find "$pkgdir"/usr/src/linux-${_kernver} -type d -exec chmod 755 {} \;
240 # strip scripts directory
241 find "$pkgdir"/usr/src/linux-${_kernver}/scripts -type f -perm -u+w 2>/dev/null | while read binary ; do
242 case "$(file -bi "$binary")" in
243 *application/x-sharedlib*) # Libraries (.so)
244 /usr/bin/strip $STRIP_SHARED "$binary";;
245 *application/x-archive*) # Libraries (.a)
246 /usr/bin/strip $STRIP_STATIC "$binary";;
247 *application/x-executable*) # Binaries
248 /usr/bin/strip $STRIP_BINARIES "$binary";;
251 # remove unneeded architectures
252 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}
254 # Global pkgdesc and depends are here so that they will be picked up by AUR
255 pkgdesc="Longtime supported kernel package suitable for servers patched with backported Brain Fuck Scheduler v0.404."
256 sha256sums=('18b2e2c336032e366c942622b77302cb05fc034fb19018f086a4ebc9ed41bfcf'
257 '57c820dfb7a587c01a90d6317c9d7e2ae1471b923970ad305c384dbb1d67b182'
258 '0137856303974334d4fd94202b778bd231abddfcb84d33c649345f07aaf4a864'
259 '7d28ec354062e91f572ec6003f5c2728ea91bf39e99eb200e3c43c96b130afed'
260 '7ff760dca07545df7430b498447f053ee081555f37d2e8825bd2d62632d25947'
261 '00a28d8ac9a4e73f87aa0c583bca8898ada2cdbaf0867c3255d4ddf3d6e91862'
262 'a7512630adc4e3b8ca34ce960911d1ccc12d65c07b880185e91aea34eded583a'
263 '10c76cad6bc6b4a862e89e64505ad52a062831380fde143132a44936fccbfeac')