1 # $Id: PKGBUILD 126742 2011-06-07 06:23:28Z tpowa $
2 # Maintainer: Tobias Powalowski <tpowa@archlinux.org>
3 # Maintainer: Thomas Baechler <thomas@archlinux.org>
4 pkgbase="kernel26-debug-utrace"
5 pkgname=kernel26-debug-utrace # Build kernel with a different name
6 _kernelname=${pkgname#kernel26}
8 pkgver=${_basekernel}.3
10 makedepends=('xmlto' 'docbook-xsl')
11 _patchname="patch-${pkgver}-${pkgrel}-ARCH"
12 #_patchname="patch-${pkgver}-1-ARCH"
15 url="http://www.kernel.org"
17 source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$pkgver.tar.bz2
18 # the main kernel config files
20 # standard config files for mkinitcpio ramdisk
24 md5sums=('5afede829846587e798f2631c2ece84f'
25 'd1c5850571b1fe22a2892e2821e724b7'
26 '41145f8bdcc598f52ee081d756348193'
27 '47c3fab844859c5805e391b98926e05c'
28 '8c08acdb5a5d6ce826a3ce6af0faab62')
31 cd ${srcdir}/linux-$pkgver
33 echo "patching in utrace"
34 patch -p1 < ../big-utrace2.patch
36 if [ "$CARCH" = "x86_64" ]; then
37 cat ../config.x86_64 >./.config
39 cat ../config >./.config
41 if [ "${_kernelname}" != "" ]; then
42 sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
48 # Configure the kernel. Replace the line below with one of your choice.
49 #make menuconfig # CLI menu for configuration
50 #make nconfig # new CLI menu for configuration
51 #make xconfig # X-based configuration
52 #make oldconfig # using old config from previous kernel version
53 # ... or manually edit .config
56 # this is useful to configure the kernel
62 make ${MAKEFLAGS} bzImage modules
66 pkgdesc="The Linux Kernel, modules and headers with debug enabled for systemtap"
68 backup=(etc/mkinitcpio.d/${pkgname}.preset)
69 depends=('coreutils' 'linux-firmware' 'module-init-tools>=3.12-2' 'mkinitcpio>=0.6.8-2')
70 # pwc, ieee80211 and hostap-driver26 modules are included in kernel26 now
71 # nforce package support was abandoned by nvidia, kernel modules should cover everything now.
72 # kernel24 support is dropped since glibc24
73 replaces=('kernel24' 'kernel24-scsi' 'kernel26-scsi'
74 'alsa-driver' 'ieee80211' 'hostap-driver26'
75 'pwc' 'nforce' 'squashfs' 'unionfs' 'ivtv'
76 'zd1211' 'kvm-modules' 'iwlwifi' 'rt2x00-cvs'
77 'gspcav1' 'atl2' 'wlan-ng26' 'rt2500' 'nouveau-drm')
78 install=kernel26.install
79 optdepends=('crda: to set the correct wireless channels of your country')
82 cd ${srcdir}/linux-$pkgver
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}
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
96 -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
97 -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
98 -i $startdir/kernel26.install
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 the firmware
107 rm -rf ${pkgdir}/lib/firmware
108 # gzip -9 all modules to safe 100MB of space
109 find "$pkgdir" -name '*.ko' -exec gzip -9 {} \;
111 # Add the headers package
112 mkdir -p ${pkgdir}/lib/modules/${_kernver}
113 cd ${pkgdir}/lib/modules/${_kernver}
114 ln -sf ../../../usr/src/linux-${_kernver} build
115 cd ${srcdir}/linux-$pkgver
116 install -D -m644 Makefile \
117 ${pkgdir}/usr/src/linux-${_kernver}/Makefile
118 install -D -m644 kernel/Makefile \
119 ${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile
120 install -D -m644 .config \
121 ${pkgdir}/usr/src/linux-${_kernver}/.config
122 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include
124 for i in acpi asm-generic config crypto drm generated linux math-emu \
125 media net pcmcia scsi sound trace video xen; do
126 cp -a include/$i ${pkgdir}/usr/src/linux-${_kernver}/include/
129 # copy arch includes for external modules
130 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/x86
131 cp -a arch/x86/include ${pkgdir}/usr/src/linux-${_kernver}/arch/x86/
133 # copy files necessary for later builds, like nvidia and vmware
134 cp Module.symvers ${pkgdir}/usr/src/linux-${_kernver}
135 cp -a scripts ${pkgdir}/usr/src/linux-${_kernver}
136 # fix permissions on scripts dir
137 chmod og-w -R ${pkgdir}/usr/src/linux-${_kernver}/scripts
138 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions
140 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/kernel
142 cp arch/$KARCH/Makefile ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/
143 if [ "$CARCH" = "i686" ]; then
144 cp arch/$KARCH/Makefile_32.cpu ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/
146 cp arch/$KARCH/kernel/asm-offsets.s ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/kernel/
148 # add headers for lirc package
149 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video
150 cp drivers/media/video/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/
151 for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102; do
152 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/$i
153 cp -a drivers/media/video/$i/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/$i
155 # add docbook makefile
156 install -D -m644 Documentation/DocBook/Makefile \
157 ${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile
159 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/md
160 cp drivers/md/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/md
162 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include/linux
163 cp include/linux/inotify.h ${pkgdir}/usr/src/linux-${_kernver}/include/linux/
164 # add wireless headers
165 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/
166 cp net/mac80211/*.h ${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/
167 # add dvb headers for external modules
169 # http://bugs.archlinux.org/task/9912
170 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core
171 cp drivers/media/dvb/dvb-core/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/
172 # add dvb headers for external modules
174 # http://bugs.archlinux.org/task/11194
175 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/
176 cp include/config/dvb/*.h ${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/
177 # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
179 # http://bugs.archlinux.org/task/13146
180 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
181 cp drivers/media/dvb/frontends/lgdt330x.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
182 cp drivers/media/video/msp3400-driver.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
185 # http://bugs.archlinux.org/task/20402
186 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb
187 cp drivers/media/dvb/dvb-usb/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/
188 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends
189 cp drivers/media/dvb/frontends/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
190 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners
191 cp drivers/media/common/tuners/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners/
192 # add xfs and shmem for aufs building
193 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/fs/xfs
194 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/mm
195 cp fs/xfs/xfs_sb.h ${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h
196 # copy in Kconfig files
197 for i in `find . -name "Kconfig*"`; do
198 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/`echo $i | sed 's|/Kconfig.*||'`
199 cp $i ${pkgdir}/usr/src/linux-${_kernver}/$i
202 chown -R root.root ${pkgdir}/usr/src/linux-${_kernver}
203 find ${pkgdir}/usr/src/linux-${_kernver} -type d -exec chmod 755 {} \;
204 # strip scripts directory
205 find ${pkgdir}/usr/src/linux-${_kernver}/scripts -type f -perm -u+w 2>/dev/null | while read binary ; do
206 case "$(file -bi "$binary")" in
207 *application/x-sharedlib*) # Libraries (.so)
208 /usr/bin/strip $STRIP_SHARED "$binary";;
209 *application/x-archive*) # Libraries (.a)
210 /usr/bin/strip $STRIP_STATIC "$binary";;
211 *application/x-executable*) # Binaries
212 /usr/bin/strip $STRIP_BINARIES "$binary";;
215 # remove unneeded architectures
216 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}