1 # $Id: PKGBUILD 130991 2011-07-09 12:23:51Z thomas $
2 # Maintainer: Tobias Powalowski <tpowa@archlinux.org>
3 # Maintainer: Thomas Baechler <thomas@archlinux.org>
4 # Contributor: Tom Wizetek <tom@wizetek.com>
6 pkgname=('kernel26-pae' 'kernel26-pae-headers')
7 _kernelname=${pkgname#kernel26}
9 pkgver=${_basekernel}.3
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-$_basekernel.tar.bz2
18 ftp://ftp.archlinux.org/other/kernel26/${_patchname}.bz2
19 # the main kernel config files
21 # standard config files for mkinitcpio ramdisk
23 md5sums=('1aab7a741abe08d42e8eccf20de61e05'
24 'b23d7def30e57242cfe088f4d8ca8baa'
25 '840314f0e66e79a37dab896d937017b1'
26 '8640846f681d6f2b3f4c4043d7974cfb')
29 cd ${srcdir}/linux-$_basekernel
31 # See http://projects.archlinux.org/linux-2.6-ARCH.git/
32 patch -Np1 -i ${srcdir}/${_patchname}
34 if [ "$CARCH" = "x86_64" ]; then
35 cat ../config.x86_64 >./.config
37 cat ../config >./.config
39 if [ "${_kernelname}" != "" ]; then
40 sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
45 # Configure the kernel. Replace the line below with one of your choice.
46 #make menuconfig # CLI menu for configuration
47 #make nconfig # new CLI menu for configuration
48 #make xconfig # X-based configuration
49 #make oldconfig # using old config from previous kernel version
50 # ... or manually edit .config
53 # this is useful to configure the kernel
59 make ${MAKEFLAGS} bzImage modules
62 package_kernel26-pae() {
63 pkgdesc="The Linux Kernel and modules with PAE support (HIGHMEM64G)"
64 backup=(etc/mkinitcpio.d/${pkgname}.preset)
65 depends=('coreutils' 'linux-firmware' 'module-init-tools>=3.12-2' 'mkinitcpio>=0.6.8-2')
66 # pwc, ieee80211 and hostap-driver26 modules are included in kernel26 now
67 # nforce package support was abandoned by nvidia, kernel modules should cover everything now.
68 # kernel24 support is dropped since glibc24
69 replaces=('kernel24' 'kernel24-scsi' 'kernel26-scsi'
70 'alsa-driver' 'ieee80211' 'hostap-driver26'
71 'pwc' 'nforce' 'squashfs' 'unionfs' 'ivtv'
72 'zd1211' 'kvm-modules' 'iwlwifi' 'rt2x00-cvs'
73 'gspcav1' 'atl2' 'wlan-ng26' 'rt2500' 'nouveau-drm')
74 install=kernel26.install
75 optdepends=('crda: to set the correct wireless channels of your country')
78 cd ${srcdir}/linux-$_basekernel
80 _kernver="$(make kernelrelease)"
81 mkdir -p ${pkgdir}/{lib/modules,lib/firmware,boot}
82 make INSTALL_MOD_PATH=${pkgdir} modules_install
83 cp System.map ${pkgdir}/boot/System.map26${_kernelname}
84 cp arch/$KARCH/boot/bzImage ${pkgdir}/boot/vmlinuz26${_kernelname}
86 install -m644 -D vmlinux ${pkgdir}/usr/src/linux-${_kernver}/vmlinux
88 # install fallback mkinitcpio.conf file and preset file for kernel
89 install -m644 -D ${srcdir}/kernel26.preset ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset
90 # set correct depmod command for install
92 -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
93 -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
94 -i $startdir/kernel26.install
96 -e "s|source .*|source /etc/mkinitcpio.d/kernel26${_kernelname}.kver|g" \
97 -e "s|default_image=.*|default_image=\"/boot/${pkgname}.img\"|g" \
98 -e "s|fallback_image=.*|fallback_image=\"/boot/${pkgname}-fallback.img\"|g" \
99 -i ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset
101 echo -e "# DO NOT EDIT THIS FILE\nALL_kver='${_kernver}'" > ${pkgdir}/etc/mkinitcpio.d/${pkgname}.kver
102 # remove build and source links
103 rm -f ${pkgdir}/lib/modules/${_kernver}/{source,build}
104 # remove the firmware
105 rm -rf ${pkgdir}/lib/firmware
106 # gzip -9 all modules to safe 100MB of space
107 find "$pkgdir" -name '*.ko' -exec gzip -9 {} \;
110 package_kernel26-pae-headers() {
111 pkgdesc="Header files and scripts for building modules for kernel26-pae"
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-$_basekernel
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}
219 package_kernel26-pae-docs() {
220 pkgdesc="Kernel hackers manual - HTML documentation that comes with the Linux kernel."
222 cd ${srcdir}/linux-$_basekernel
223 mkdir -p $pkgdir/usr/src/linux-$_kernver
224 mv Documentation $pkgdir/usr/src/linux-$_kernver
225 find $pkgdir -type f -exec chmod 444 {} \;
226 find $pkgdir -type d -exec chmod 755 {} \;
227 # remove a file already in kernel26 package
228 rm -f $pkgdir/usr/src/linux-$_kernver/Documentation/DocBook/Makefile
231 # workaround for AUR split package upload
233 pkgdesc="The Linux Kernel and modules with PAE support (HIGHMEM64G)"