1 # Contributor: Lex Rivera aka x-demon <aur@x-demon.org>
2 # Maintainer: Lex Rivera aka x-demon <aur@x-demon.org>
10 pkgdesc="The Linux Kernel and modules with stable ZEN patch (non-git)"
11 arch=('i686' 'x86_64')
13 url="http://zen-kernel.org"
14 provides=(kernel26=${pkgver})
15 backup=('etc/mkinitcpio.d/${pkgname}.preset' 'etc/mkinitcpio.d/${pkgname}-fallback.conf' 'etc/mkinitcpio-zen.conf')
16 depends=('coreutils' 'linux-firmware' 'module-init-tools' 'mkinitcpio')
17 makedepends=('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.install
26 ### User defined variables ####
28 _keep_source_code="0" #
31 ###############################
33 source=(http://www.kernel.org/pub/linux/kernel/v2.6/linux-${_basever}.tar.bz2
35 http://downloads.zen-kernel.org/${_basever}/${_basever}-zen${_zenver}.patch.lzma
36 #ftp://ftp.archlinux.org/other/kernel26/patch-${pkgver}-${_archver}-ARCH.bz2
41 mkinitcpio-${pkgname}.conf)
43 md5sums=('091abeb4684ce03d1d936851618687b6'
44 '5660693904a433e6329f06187e7d21cc'
45 '60a61d5a5dc1f11bb23c031db06c60ba'
46 '4a496d5ee8025f123a4be6d3184cf2b9'
47 '0ab28c6ef83545539d7282fd1e249d00'
48 'deeade3bcf70f4a13beeca6c3287c7ca')
53 cd ${srcdir}/linux-${_basever} || return 1
56 if [ "$_zen_patch" == "1" ]; then
57 echo "Applying ${_basever}-zen${_zenver}.patch"
58 lzma -df ${srcdir}/${_basever}-zen${_zenver}.patch.lzma
59 cd ${srcdir}/linux-${_basever} || return 1
60 patch -Np1 -i ${srcdir}/${_basever}-zen${_zenver}.patch || return 1
63 # Applying ZEN drm-next patch
64 if [ "$_arch_patch" == "1" ]; then
65 echo "Applying patch-${pkgver}-${_archver}-ARCH"
66 cd ${srcdir}/linux-${_basever} || return 1
67 patch -Np1 -i ${srcdir}/patch-${pkgver}-${_archver}-ARCH || return 1
71 sed -i 's|^EXTRAVERSION = .*$|EXTRAVERSION =|g' Makefile
73 # load configuration for i686 or x86_64
74 if [ "$CARCH" = "x86_64" ]; then
75 cat ../config.x86_64 > ./.config
77 cat ../config > ./.config
82 _kernver="$(make kernelrelease)"
85 if [ "$_menuconfig" = "1" ]; then
90 # fuck CONFIG_LOCALVERSION_AUTO!
91 sed -i 's|CONFIG_LOCALVERSION_AUTO=.*|CONFIG_LOCALVERSION_AUTO=n|' .config
93 if [ "$_keep_source_code" = "1" ]; then
94 echo -n "Copying source code..."
95 # Keep the source code
96 cd ${startdir} || return 1
97 mkdir -p ${pkgdir}/usr/src || return 1
98 cp -a ${srcdir}/linux-${_basever} ${pkgdir}/usr/src/linux-${_kernver} || return 1
100 #Add a link from the modules directory
101 mkdir -p ${pkgdir}/lib/modules/${_kernver} || return 1
102 cd ${pkgdir}/lib/modules/${_kernver} || return 1
104 ln -s ../../../usr/src/linux-${_kernver} source || return 1
108 cd ${srcdir}/linux-${_basever}
110 make bzImage modules || return 1
111 mkdir -p ${pkgdir}/{lib/modules,boot}
112 make INSTALL_MOD_PATH=${pkgdir} modules_install || return 1
113 install -D -m644 System.map ${pkgdir}/boot/System.map26-zen
114 install -D -m644 arch/${KARCH}/boot/bzImage ${pkgdir}/boot/vmlinuz26-zen
115 install -D -m644 Makefile ${pkgdir}/usr/src/linux-${_kernver}/Makefile
116 install -D -m644 kernel/Makefile ${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile
117 install -D -m644 .config ${pkgdir}/usr/src/linux-${_kernver}/.config
118 install -D -m644 .config ${pkgdir}/boot/kconfig26-zen
119 install -D -m644 vmlinux ${pkgdir}/usr/src/linux-${_kernver}/vmlinux
121 #install teh headers!
123 mkdir -p ${pkgdir}/lib/modules/${_kernver}
124 cd ${pkgdir}/lib/modules/${_kernver}
126 ln -sf ../../../usr/src/linux-${_kernver} build
127 cd ${srcdir}/linux-$_basever
128 install -D -m644 Makefile \
129 ${pkgdir}/usr/src/linux-${_kernver}/Makefile
130 install -D -m644 kernel/Makefile \
131 ${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile
132 install -D -m644 .config \
133 ${pkgdir}/usr/src/linux-${_kernver}/.config
134 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include
136 for i in acpi asm-generic config generated linux math-emu media net pcmcia scsi sound trace video; do
137 cp -a include/$i ${pkgdir}/usr/src/linux-${_kernver}/include/
140 # copy arch includes for external modules
141 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/x86
142 cp -a arch/x86/include ${pkgdir}/usr/src/linux-${_kernver}/arch/x86/
144 # copy files necessary for later builds, like nvidia and vmware
145 cp Module.symvers ${pkgdir}/usr/src/linux-${_kernver}
146 cp -a scripts ${pkgdir}/usr/src/linux-${_kernver}
147 # fix permissions on scripts dir
148 chmod og-w -R ${pkgdir}/usr/src/linux-${_kernver}/scripts
149 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions
151 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/kernel
153 cp arch/$KARCH/Makefile ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/
154 if [ "$CARCH" = "i686" ]; then
155 cp arch/$KARCH/Makefile_32.cpu ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/
157 cp arch/$KARCH/kernel/asm-offsets.s ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/kernel/
159 # add headers for lirc package
160 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video
161 cp drivers/media/video/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/
162 for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102 usbvideo zc0301; do
163 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/$i
164 cp -a drivers/media/video/$i/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/$i
166 # add docbook makefile
167 install -D -m644 Documentation/DocBook/Makefile \
168 ${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile
170 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/md
171 cp drivers/md/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/md
173 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include/linux
174 cp include/linux/inotify.h ${pkgdir}/usr/src/linux-${_kernver}/include/linux/
175 # add wireless headers
176 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/
177 cp net/mac80211/*.h ${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/
178 # add dvb headers for external modules
180 # http://bugs.archlinux.org/task/9912
181 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core
182 cp drivers/media/dvb/dvb-core/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/
183 # add dvb headers for external modules
185 # http://bugs.archlinux.org/task/11194
186 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/
187 cp include/config/dvb/*.h ${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/
188 # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
190 # http://bugs.archlinux.org/task/13146
191 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
192 cp drivers/media/dvb/frontends/lgdt330x.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
193 cp drivers/media/video/msp3400-driver.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
194 # add xfs and shmem for aufs building
195 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/fs/xfs
196 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/mm
197 cp fs/xfs/xfs_sb.h ${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h
198 # add headers vor virtualbox
200 # http://bugs.archlinux.org/task/14568
201 cp -a include/drm $pkgdir/usr/src/linux-${_kernver}/include/
202 # add headers for broadcom wl
204 # http://bugs.archlinux.org/task/14568
205 cp -a include/trace $pkgdir/usr/src/linux-${_kernver}/include/
206 # copy in Kconfig files
207 for i in `find . -name "Kconfig*"`; do
208 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/`echo $i | sed 's|/Kconfig.*||'`
209 cp $i ${pkgdir}/usr/src/linux-${_kernver}/$i
212 chown -R root.root ${pkgdir}/usr/src/linux-${_kernver}
213 find ${pkgdir}/usr/src/linux-${_kernver} -type d -exec chmod 755 {} \;
214 # remove unneeded architectures
215 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}
217 # install fallback mkinitcpio-kernel26-zen.conf file and preset file for kernel
218 install -m644 -D ${srcdir}/${pkgname}.preset ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset || return 1
219 install -m644 -D ${srcdir}/mkinitcpio-${pkgname}.conf ${pkgdir}/etc/mkinitcpio-zen.conf || return 1
221 # set correct depmod command for install
223 -e "s/KERNEL_NAME=.*/KERNEL_NAME=${pkgname}/g" \
224 -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
225 -i ${startdir}/${pkgname}.install
227 -e "s|source .*|source /etc/mkinitcpio.d/${pkgname}.kver|g" \
228 -e "s|default_image=.*|default_image=\"/boot/${pkgname}.img\"|g" \
229 -e "s|fallback_image=.*|fallback_image=\"/boot/${pkgname}-fallback.img\"|g" \
230 -i ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset
232 echo -e "# DO NOT EDIT THIS FILE\nALL_kver='${_kernver}'" > ${pkgdir}/etc/mkinitcpio.d/${pkgname}.kver
234 if [ "$_keep_source_code" = "0" ]; then
235 # remove unneeded architectures
236 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}
239 # Delete firmware directory
240 rm -rf ${pkgdir}/lib/firmware