updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / kernel26-yi / PKGBUILD
blob014de23aaf12707776f738d6d712269b11d00c8b
1 # Maintainer: andrewthomas
2 # Originally-uploaded-by: Tobias Powalowski <tpowa@archlinux.org>
3 # Contributor: Thomas Baechler <thomas@archlinux.org>
4 # Contributor: ying <Jinoto Systems>
5 pkgbase="kernel26-yi"
6 pkgname=('kernel26-yi')
7 _kernelname=${pkgname#kernel26}
8 _basekernel=2.6.39
9 pkgver=${_basekernel}.3
10 pkgrel=1
11 # required by AUR
12 # comment the following line to build a single package containing the kernel and the headers
13 (( 1 )) && pkgname=("kernel26-yi" "kernel26-yi-headers")
14 makedepends=('xmlto' 'docbook-xsl')
16 _patchname="patch-${pkgver}-${pkgrel}-ARCH"
17 #_patchname="patch-${pkgver}-1-ARCH"
18 arch=(i686 x86_64)
19 license=('GPL2')
20 url="http://www.kernel.org"
21 options=(!strip)
22 source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$_basekernel.tar.bz2
23         ftp://ftp.archlinux.org/other/kernel26/${_patchname}.bz2
24         # the main kernel config files
25         config config.x86_64
26         # standard config files for mkinitcpio ramdisk
27         kernel26.preset
28         kernel26.install
29         37_trace-add-trace-events-for-open-exec-an.patch)
31 md5sums=('1aab7a741abe08d42e8eccf20de61e05'
32          'b23d7def30e57242cfe088f4d8ca8baa'
33          'c116522e27f7b8855a4760fe8df38c6d'
34          '9daa1eed9ca8a70035c151768ab9aaaa'
35          '91b92186af2ab1989ce77ef5c54e797d'
36          'a6aa90cc551108f27bfffad391fd5efa'
37          'aee436f61f52d6a39a87389b4344c74e')
39 build() {
40   cd ${srcdir}
41   cp -r linux-$_basekernel linux-$_basekernel-build
42   cd linux-$_basekernel-build
43   # Add -ARCH patches
44   # See http://projects.archlinux.org/linux-2.6-ARCH.git/
45   patch -Np1 -i ${srcdir}/${_patchname}
46   patch -Np1 -i ${srcdir}/37_trace-add-trace-events-for-open-exec-an.patch      
47   if [ "$CARCH" = "x86_64" ]; then
48     cat ../config.x86_64 >./.config
49   else
50     cat ../config >./.config
51   fi
52   if [ "${_kernelname}" != "" ]; then
53     sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
54   fi
55   # get kernel version  
56   make prepare
57   # load configuration
58   # Configure the kernel. Replace the line below with one of your choice.
59   #make menuconfig # CLI menu for configuration
60   #make nconfig # new CLI menu for configuration
61   #make xconfig # X-based configuration
62   #make oldconfig # using old config from previous kernel version
63   # ... or manually edit .config
64   ####################
65   # stop here
66   # this is useful to configure the kernel
67   #msg "Stopping build"
68   #return 1
69   ####################
70   yes "" | make config
71   # build!
72   make ${MAKEFLAGS} bzImage modules
75 package_kernel26-yi() {
76   pkgdesc="Arch Kernel and modules patched with support for ureadahead."
77   backup=(etc/mkinitcpio.d/${pkgname}.preset)
78   depends=('coreutils' 'linux-firmware' 'module-init-tools>=3.12-2' 'mkinitcpio>=0.6.8-2')
79   install=kernel26.install
80   optdepends=('crda: to set the correct wireless channels of your country')
81   KARCH=x86
82   cd ${srcdir}/linux-$_basekernel-build
83   # get kernel version
84   _kernver="$(make kernelrelease)"
85   mkdir -p ${pkgdir}/{lib/modules,lib/firmware,boot}
86   make INSTALL_MOD_PATH=${pkgdir} modules_install
87   cp System.map ${pkgdir}/boot/System.map26${_kernelname}
88   cp arch/$KARCH/boot/bzImage ${pkgdir}/boot/vmlinuz26${_kernelname}
89   #  # add vmlinux
90   install -m644 -D vmlinux ${pkgdir}/usr/src/linux-${_kernver}/vmlinux
92   # install fallback mkinitcpio.conf file and preset file for kernel
93   install -m644 -D ${srcdir}/kernel26.preset ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset
94   # set correct depmod command for install
95   sed \
96     -e  "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
97     -e  "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
98     -i $startdir/kernel26.install
99   sed \
100     -e "s|source .*|source /etc/mkinitcpio.d/kernel26${_kernelname}.kver|g" \
101     -e "s|default_image=.*|default_image=\"/boot/${pkgname}.img\"|g" \
102     -e "s|fallback_image=.*|fallback_image=\"/boot/${pkgname}-fallback.img\"|g" \
103     -i ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset
105   echo -e "# DO NOT EDIT THIS FILE\nALL_kver='${_kernver}'" > ${pkgdir}/etc/mkinitcpio.d/${pkgname}.kver
106   # remove build and source links
107   rm -f ${pkgdir}/lib/modules/${_kernver}/{source,build}
108   # remove the firmware
109   rm -rf ${pkgdir}/lib/firmware
110   # gzip -9 all modules to safe 100MB of space
111   find "$pkgdir" -name '*.ko' -exec gzip -9 {} \;
114 package_kernel26-yi-headers() {
115   pkgdesc="Arch Kernel and modules patched with support for ureadahead."
116   mkdir -p ${pkgdir}/lib/modules/${_kernver}
117   cd ${pkgdir}/lib/modules/${_kernver}
118   ln -sf ../../../usr/src/linux-${_kernver} build
119   cd ${srcdir}/linux-$_basekernel-build
120   install -D -m644 Makefile \
121     ${pkgdir}/usr/src/linux-${_kernver}/Makefile
122   install -D -m644 kernel/Makefile \
123     ${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile
124   install -D -m644 .config \
125     ${pkgdir}/usr/src/linux-${_kernver}/.config
126   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include
128   for i in acpi asm-generic config generated linux math-emu media net pcmcia scsi sound trace video xen; do
129     cp -a include/$i ${pkgdir}/usr/src/linux-${_kernver}/include/
130   done
132   # copy arch includes for external modules
133   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/x86
134   cp -a arch/x86/include ${pkgdir}/usr/src/linux-${_kernver}/arch/x86/
136   # copy files necessary for later builds, like nvidia and vmware
137   cp Module.symvers ${pkgdir}/usr/src/linux-${_kernver}
138   cp -a scripts ${pkgdir}/usr/src/linux-${_kernver}
139   # fix permissions on scripts dir
140   chmod og-w -R ${pkgdir}/usr/src/linux-${_kernver}/scripts
141   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions
143   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/kernel
145   cp arch/$KARCH/Makefile ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/
146   if [ "$CARCH" = "i686" ]; then
147     cp arch/$KARCH/Makefile_32.cpu ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/
148   fi
149   cp arch/$KARCH/kernel/asm-offsets.s ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/kernel/
151   # add headers for lirc package
152   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video
153   cp drivers/media/video/*.h  ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/
154   for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102; do
155    mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/$i
156    cp -a drivers/media/video/$i/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/$i
157   done
158   # add docbook makefile
159   install -D -m644 Documentation/DocBook/Makefile \
160     ${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile
161   # add dm headers
162   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/md
163   cp drivers/md/*.h  ${pkgdir}/usr/src/linux-${_kernver}/drivers/md
164   # add inotify.h
165   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include/linux
166   cp include/linux/inotify.h ${pkgdir}/usr/src/linux-${_kernver}/include/linux/
167   # add wireless headers
168   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/
169   cp net/mac80211/*.h ${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/
170   # add dvb headers for external modules
171   # in reference to:
172   # http://bugs.archlinux.org/task/9912
173   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core
174   cp drivers/media/dvb/dvb-core/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/
175   # add dvb headers for external modules
176   # in reference to:
177   # http://bugs.archlinux.org/task/11194
178   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/
179   cp include/config/dvb/*.h ${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/
180   # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
181   # in reference to:
182   # http://bugs.archlinux.org/task/13146
183   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
184   cp drivers/media/dvb/frontends/lgdt330x.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
185   cp drivers/media/video/msp3400-driver.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
186   # add dvb headers  
187   # in reference to:
188   # http://bugs.archlinux.org/task/20402
189   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb
190   cp drivers/media/dvb/dvb-usb/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/
191   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends
192   cp drivers/media/dvb/frontends/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
193   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners
194   cp drivers/media/common/tuners/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners/
195   # add xfs and shmem for aufs building
196   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/fs/xfs
197   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/mm
198   cp fs/xfs/xfs_sb.h ${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h
199   # add headers vor virtualbox
200   # in reference to:
201   # http://bugs.archlinux.org/task/14568
202   cp -a include/drm $pkgdir/usr/src/linux-${_kernver}/include/
203   # add headers for broadcom wl
204   # in reference to:
205   # http://bugs.archlinux.org/task/14568
206   cp -a include/trace $pkgdir/usr/src/linux-${_kernver}/include/
207   # add headers for crypto modules
208   # in reference to:
209   # http://bugs.archlinux.org/task/22081
210   cp -a include/crypto $pkgdir/usr/src/linux-${_kernver}/include/
211   # copy in Kconfig files
212   for i in `find . -name "Kconfig*"`; do 
213     mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/`echo $i | sed 's|/Kconfig.*||'`
214     cp $i ${pkgdir}/usr/src/linux-${_kernver}/$i
215   done
217   chown -R root.root ${pkgdir}/usr/src/linux-${_kernver}
218   find ${pkgdir}/usr/src/linux-${_kernver} -type d -exec chmod 755 {} \;
219   # remove unneeded architectures
220   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}
221   # clean up build directory
222   cd ${srcdir}
223   rm -rf linux-$_basekernel-build