1 # Maintainer: Markus Opitz <mastero23 at gmail dot com>
2 # Based on package kernel26 by
3 # Tobias Powalowski <tpowa@archlinux.org> and
4 # Thomas Baechler <thomas@archlinux.org>
6 pkgname='kernel26-lttng'
7 _kernelname=${pkgname#kernel26}
9 _lttng=dev-snapshot-distro-20110511
10 pkgver=${_basekernel}.1
13 _patchname="patch-${pkgver}-${pkgrel}-ARCH"
14 #_patchname="patch-${pkgver}-1-ARCH"
17 url="http://www.kernel.org"
19 source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$_basekernel.tar.bz2
20 ftp://ftp.archlinux.org/other/kernel26/${_patchname}.bz2
21 # the main kernel config files
23 # standard config files for mkinitcpio ramdisk
25 http://lttng.org/files/lttng/patch-${_basekernel}-rc5-lttng-${_lttng}.tar.bz2)
26 md5sums=('1aab7a741abe08d42e8eccf20de61e05'
27 '195dc2d9a79d497d81c0ae187cb679fb'
28 'a855fd251af3332261536a9e7be32ec3'
29 'ad2e8cd08c41c3b09936fcfa269c3166'
30 '25584700a0a679542929c4bed31433b6'
31 '7e082d1285a67a2c4b818275444c7450')
34 cd ${srcdir}/linux-$_basekernel
36 cp -r ${srcdir}/patch-${_basekernel}-rc5-lttng-${_lttng} patches
40 # See http://projects.archlinux.org/linux-2.6-ARCH.git/
41 patch -Np1 -i ${srcdir}/${_patchname}
43 if [ "$CARCH" = "x86_64" ]; then
44 cat ../config.x86_64 >./.config
46 cat ../config >./.config
48 if [ "${_kernelname}" != "" ]; then
49 sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
56 # Configure the kernel. Replace the line below with one of your choice.
57 #make menuconfig # CLI menu for configuration
58 #make nconfig # new CLI menu for configuration
59 #make xconfig # X-based configuration
60 #make oldconfig # using old config from previous kernel version
61 # ... or manually edit .config
64 # this is useful to configure the kernel
70 make ${MAKEFLAGS} bzImage modules
73 package_kernel26-lttng() {
74 pkgdesc="Linux Kernel with LTTng patches"
76 backup=(etc/mkinitcpio.d/${pkgname}.preset)
77 depends=('coreutils' 'linux-firmware' 'module-init-tools>=3.12-2' 'mkinitcpio>=0.6.8-2')
78 # pwc, ieee80211 and hostap-driver26 modules are included in kernel26 now
79 # nforce package support was abandoned by nvidia, kernel modules should cover everything now.
80 # kernel24 support is dropped since glibc24
81 replaces=('kernel24' 'kernel24-scsi' 'kernel26-scsi'
82 'alsa-driver' 'ieee80211' 'hostap-driver26'
83 'pwc' 'nforce' 'squashfs' 'unionfs' 'ivtv'
84 'zd1211' 'kvm-modules' 'iwlwifi' 'rt2x00-cvs'
85 'gspcav1' 'atl2' 'wlan-ng26' 'rt2500' 'nouveau-drm')
86 install=kernel26.install
87 optdepends=('crda: to set the correct wireless channels of your country')
90 cd ${srcdir}/linux-$_basekernel
92 _kernver="$(make kernelrelease)"
93 mkdir -p ${pkgdir}/{lib/modules,lib/firmware,boot}
94 make INSTALL_MOD_PATH=${pkgdir} modules_install
95 cp System.map ${pkgdir}/boot/System.map26${_kernelname}
96 cp arch/$KARCH/boot/bzImage ${pkgdir}/boot/vmlinuz26${_kernelname}
98 install -m644 -D vmlinux ${pkgdir}/usr/src/linux-${_kernver}/vmlinux
100 # install fallback mkinitcpio.conf file and preset file for kernel
101 install -m644 -D ${srcdir}/kernel26.preset ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset
102 # set correct depmod command for install
104 -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
105 -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
106 -i $startdir/kernel26.install
108 -e "s|source .*|source /etc/mkinitcpio.d/kernel26${_kernelname}.kver|g" \
109 -e "s|default_image=.*|default_image=\"/boot/${pkgname}.img\"|g" \
110 -e "s|fallback_image=.*|fallback_image=\"/boot/${pkgname}-fallback.img\"|g" \
111 -i ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset
113 echo -e "# DO NOT EDIT THIS FILE\nALL_kver='${_kernver}'" > ${pkgdir}/etc/mkinitcpio.d/${pkgname}.kver
114 # remove build and source links
115 rm -f ${pkgdir}/lib/modules/${_kernver}/{source,build}
116 # remove the firmware
117 rm -rf ${pkgdir}/lib/firmware
118 # gzip -9 all modules to safe 100MB of space
119 find "$pkgdir" -name '*.ko' -exec gzip -9 {} \;
123 mkdir -p ${pkgdir}/lib/modules/${_kernver}
124 cd ${pkgdir}/lib/modules/${_kernver}
125 ln -sf ../../../usr/src/linux-${_kernver} build
126 cd ${srcdir}/linux-$_basekernel
127 install -D -m644 Makefile \
128 ${pkgdir}/usr/src/linux-${_kernver}/Makefile
129 install -D -m644 kernel/Makefile \
130 ${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile
131 install -D -m644 .config \
132 ${pkgdir}/usr/src/linux-${_kernver}/.config
133 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include
135 for i in acpi asm-generic config crypto drm generated linux math-emu \
136 media net pcmcia scsi sound trace video xen; 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; 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/
196 # http://bugs.archlinux.org/task/20402
197 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb
198 cp drivers/media/dvb/dvb-usb/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/
199 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends
200 cp drivers/media/dvb/frontends/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
201 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners
202 cp drivers/media/common/tuners/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners/
203 # add xfs and shmem for aufs building
204 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/fs/xfs
205 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/mm
206 cp fs/xfs/xfs_sb.h ${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h
207 # copy in Kconfig files
208 for i in `find . -name "Kconfig*"`; do
209 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/`echo $i | sed 's|/Kconfig.*||'`
210 cp $i ${pkgdir}/usr/src/linux-${_kernver}/$i
213 chown -R root.root ${pkgdir}/usr/src/linux-${_kernver}
214 find ${pkgdir}/usr/src/linux-${_kernver} -type d -exec chmod 755 {} \;
215 # strip scripts directory
216 find ${pkgdir}/usr/src/linux-${_kernver}/scripts -type f -perm -u+w 2>/dev/null | while read binary ; do
217 case "$(file -bi "$binary")" in
218 *application/x-sharedlib*) # Libraries (.so)
219 /usr/bin/strip $STRIP_SHARED "$binary";;
220 *application/x-archive*) # Libraries (.a)
221 /usr/bin/strip $STRIP_STATIC "$binary";;
222 *application/x-executable*) # Binaries
223 /usr/bin/strip $STRIP_BINARIES "$binary";;
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}