1 # Contributor: Lex Rivera aka x-demon <aur@x-demon.org>
2 # Maintainer: Lex Rivera aka x-demon <aur@x-demon.org>
4 pkgname=kernel26-zen-next
10 pkgdesc="The Linux Kernel and modules with stable ZEN patch and next ver kernel (non-git)"
11 arch=('i686' 'x86_64')
13 url="http://www.kernel.org"
14 provides=(kernel26=${_basever})
15 backup=('etc/mkinitcpio.d/${pkgname}.preset' 'etc/mkinitcpio-zen-next.conf')
16 depends=('coreutils' 'kernel26-firmware>=2.6.31' 'module-init-tools' 'mkinitcpio>=0.5.20')
17 makedepend=('xz-utils')
18 optdepends=('crda: to set the correct wireless channels of your country')
19 replaces=('kernel24' 'kernel24-scsi' 'kernel26-scsi'
20 'alsa-driver' 'ieee80211' 'hostap-driver26'
21 'pwc' 'nforce' 'squashfs' 'unionfs' 'ivtv'
22 'zd1211' 'kvm-modules' 'iwlwifi' 'rt2x00-cvs'
23 'gspcav1' 'atl2' 'wlan-ng26' 'rt2500')
24 install=kernel26-zen-next.install
26 md5sums=('905772bbff927ce20c87d86a66d01a71'
27 '0dd87975c5e5db54efde3278c6de7143'
28 'e646c5ee6f0fccf9682e5a22e045048f'
29 '502044af2a0cf81d086d503c76dd35d6'
30 'c129dd7b0e9b1e7b4168f34010a31db7'
31 '15a3c890c3a986620b6117681beb916b')
33 ### User defined variables ###
35 _keep_source_code="0" #
37 ##############################
39 source=(http://www.kernel.org/pub/linux/kernel/v2.6/testing/linux-${_realver}.tar.bz2
41 http://downloads.zen-kernel.org/${_basever}/${_realver}-zen${_zenver}.patch.lzma
46 mkinitcpio-${pkgname}.conf)
52 cd ${srcdir}/linux-${_realver} || return 1
55 if [ "$_zen_patch" == "1" ]; then
56 lzma -df ${srcdir}/${_realver}-zen${_zenver}.patch.lzma
57 echo "Applying ${_realver}-zen${_zenver}.patch"
58 #for i in $(ls ${srcdir}/${_realver}-zen${_zenver}.patch); do
59 cd ${srcdir}/linux-${_realver} || return 1
60 patch -Np1 -i ${srcdir}/${_realver}-zen${_zenver}.patch || return 1
65 sed -i 's|^EXTRAVERSION = .*$|EXTRAVERSION =|g' Makefile
67 # load configuration for i686 or x86_64
68 if [ "$CARCH" = "x86_64" ]; then
69 cat ../config.x86_64 > ./.config
71 cat ../config > ./.config
76 _kernver="$(make kernelrelease)"
79 if [ "$_menuconfig" = "1" ]; then
84 # fuck CONFIG_LOCALVERSION_AUTO!
85 sed -i 's|CONFIG_LOCALVERSION_AUTO=.*|CONFIG_LOCALVERSION_AUTO=n|' .config
87 if [ "$_keep_source_code" = "1" ]; then
88 echo -n "Copying source code..."
89 # Keep the source code
90 cd ${startdir} || return 1
91 mkdir -p ${pkgdir}/usr/src || return 1
92 cp -a ${srcdir}/linux-${_realver} ${pkgdir}/usr/src/linux-${_kernver} || return 1
94 #Add a link from the modules directory
95 mkdir -p ${pkgdir}/lib/modules/${_kernver} || return 1
96 cd ${pkgdir}/lib/modules/${_kernver} || return 1
98 ln -s ../../../usr/src/linux-${_kernver} source || return 1
102 cd ${srcdir}/linux-${_realver}
104 make bzImage modules || return 1
105 mkdir -p ${pkgdir}/{lib/modules,boot}
106 make INSTALL_MOD_PATH=${pkgdir} modules_install || return 1
107 install -D -m644 System.map ${pkgdir}/boot/System.map26-zen-next
108 install -D -m644 arch/${KARCH}/boot/bzImage ${pkgdir}/boot/vmlinuz26-zen-next
109 install -D -m644 Makefile ${pkgdir}/usr/src/linux-${_kernver}/Makefile
110 install -D -m644 kernel/Makefile ${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile
111 install -D -m644 .config ${pkgdir}/usr/src/linux-${_kernver}/.config
112 install -D -m644 .config ${pkgdir}/boot/kconfig26-zen-next
113 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include
115 for i in acpi asm-{generic,${KARCH}} config linux math-emu media net pcmcia scsi sound trace video; do
116 cp -a include/$i ${pkgdir}/usr/src/linux-${_kernver}/include/
119 # copy arch includes for external modules
120 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}
121 cp -a arch/${KARCH}/include ${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/
123 # copy files ssary for later builds, like nvidia and vmware
124 cp Module.symvers ${pkgdir}/usr/src/linux-${_kernver}
125 cp -a scripts ${pkgdir}/usr/src/linux-${_kernver}
127 # fix permissions on scripts dir
128 chmod og-w -R ${pkgdir}/usr/src/linux-${_kernver}/scripts
130 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel
132 cp arch/${KARCH}/Makefile ${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/
133 if [ "${CARCH}" = "i686" ]; then
134 cp arch/${KARCH}/Makefile_32.cpu ${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/
136 cp arch/${KARCH}/kernel/asm-offsets.s ${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel/
138 # add headers for lirc package
139 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video
140 cp drivers/media/video/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/
141 for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102 usbvideo zc0301; do
142 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/$i
143 cp -a drivers/media/video/$i/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/$i
146 # add docbook makefile
147 install -D -m644 Documentation/DocBook/Makefile \
148 ${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile
151 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/md
152 cp drivers/md/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/md
155 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include/linux
156 cp include/linux/inotify.h ${pkgdir}/usr/src/linux-${_kernver}/include/linux/
158 # add wireless headers
159 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/
160 cp net/mac80211/*.h ${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/
162 # add dvb headers for external modules
164 # http://bugs.archlinux.org/task/9912
165 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core
166 cp drivers/media/dvb/dvb-core/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/
168 # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
170 # http://bugs.archlinux.org/task/13146
171 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
172 cp drivers/media/dvb/frontends/lgdt330x.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
173 cp drivers/media/video/msp3400-driver.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
175 # add xfs and shmem for aufs building
176 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/fs/xfs
177 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/mm
178 cp fs/xfs/xfs_sb.h ${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h
180 # add headers vor virtualbox
182 # http://bugs.archlinux.org/task/14568
183 cp -a include/drm ${pkgdir}/usr/src/linux-${_kernver}/include/
185 # add headers for broadcom wl
187 # http://bugs.archlinux.org/task/14568
188 cp -a include/trace ${pkgdir}/usr/src/linux-${_kernver}/include/
191 cp vmlinux ${pkgdir}/usr/src/linux-${_kernver}
193 # copy in Kconfig files
194 for i in `find . -name "Kconfig*"`; do
195 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/`echo $i | sed 's|/Kconfig.*||'`
196 cp $i ${pkgdir}/usr/src/linux-${_kernver}/$i
199 cd ${pkgdir}/usr/src/linux-${_kernver}/include && ln -s asm-${KARCH} asm
201 # add header for aufs2-util
202 cp -a ${srcdir}/linux-${_realver}/include/asm-generic/bitsperlong.h ${pkgdir}/usr/src/linux-${_kernver}/include/asm/
204 chown -R root.root ${pkgdir}/usr/src/linux-${_kernver}
205 find ${pkgdir}/usr/src/linux-${_kernver} -type d -exec chmod 755 {} \;
206 cd ${pkgdir}/lib/modules/${_kernver} && (rm -f source build; ln -sf ../../../usr/src/linux-${_kernver} build)
208 # install fallback mkinitcpio-kernel26-zen.conf file and preset file for kernel
209 install -m644 -D ${srcdir}/${pkgname}.preset ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset || return 1
210 install -m644 -D ${srcdir}/mkinitcpio-${pkgname}.conf ${pkgdir}/etc/mkinitcpio-zen-next.conf || return 1
212 # set correct depmod command for install
214 -e "s/KERNEL_NAME=.*/KERNEL_NAME=${pkgname}/g" \
215 -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
216 -i ${startdir}/${pkgname}.install
218 -e "s|source .*|source /etc/mkinitcpio.d/${pkgname}.kver|g" \
219 -e "s|default_image=.*|default_image=\"/boot/${pkgname}.img\"|g" \
220 -e "s|fallback_image=.*|fallback_image=\"/boot/${pkgname}-fallback.img\"|g" \
221 -i ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset
223 echo -e "# DO NOT EDIT THIS FILE\nALL_kver='${_kernver}'" > ${pkgdir}/etc/mkinitcpio.d/${pkgname}.kver
225 if [ "$_keep_source_code" = "0" ]; then
226 # remove unneeded architectures
227 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}
230 # Delete firmware directory
231 rm -rf ${pkgdir}/lib/firmware