updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / linux-pae / PKGBUILD
blobe11b8d3d1a30fe0036a518e0ef8139f457f2b360
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 pkgbase=linux-pae
7 pkgname=('linux-pae' 'linux-pae-headers')
8 _kernelname=${pkgname#linux}
9 _basekernel=3.2
10 pkgver=${_basekernel}.1
11 pkgrel=1
12 arch=('i686')
13 url="http://www.kernel.org/"
14 license=('GPL2')
15 options=('!strip')
16 source=("http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.2.tar.xz"
17         "http://www.kernel.org/pub/linux/kernel/v3.x/patch-${pkgver}.xz"
18         # the main kernel config files
19         'config'
20         # standard config files for mkinitcpio ramdisk
21         "${pkgname}.preset"
22         'change-default-console-loglevel.patch'
23         'i915-fix-ghost-tv-output.patch'
24         'i915-gpu-finish.patch')
25 md5sums=('364066fa18767ec0ae5f4e4abcf9dc51'
26          '62ac6ac9b870162f693ecf5e8606423a'
27          '4472f386c90ee516ec9e54f994e62e24'
28          'c734be95555d4662cbe91fb9daa8679a'
29          '9d3c56a4b999c8bfbd4018089a62f662'
30          '263725f20c0b9eb9c353040792d644e5'
31          '4cd79aa147825837dc8bc9f6b736c0a0')
33 build() {
34   cd "${srcdir}/linux-${_basekernel}"
36   # add upstream patch
37   patch -p1 -i "${srcdir}/patch-${pkgver}"
39   # add latest fixes from stable queue, if needed
40   # http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
42   # fix FS#27883
43   # drm/i915: Only clear the GPU domains upon a successful finish
44   patch -Np1 -i "${srcdir}/i915-gpu-finish.patch"
46   # Some chips detect a ghost TV output
47   # mailing list discussion: http://lists.freedesktop.org/archives/intel-gfx/2011-April/010371.html
48   # Arch Linux bug report: FS#19234
49   #
50   # It is unclear why this patch wasn't merged upstream, it was accepted,
51   # then dropped because the reasoning was unclear. However, it is clearly
52   # needed.
53   patch -Np1 -i "${srcdir}/i915-fix-ghost-tv-output.patch"
55   # set DEFAULT_CONSOLE_LOGLEVEL to 4 (same value as the 'quiet' kernel param)
56   # remove this when a Kconfig knob is made available by upstream
57   # (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227)
58   patch -Np1 -i "${srcdir}/change-default-console-loglevel.patch"
60   if [ "${CARCH}" = "x86_64" ]; then
61     cat "${srcdir}/config.x86_64" > ./.config
62   else
63     cat "${srcdir}/config" > ./.config
64   fi
66   if [ "${_kernelname}" != "" ]; then
67     sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
68   fi
70   # set extraversion to pkgrel
71   sed -ri "s|^(EXTRAVERSION =).*|\1 -${pkgrel}|" Makefile
73   # get kernel version
74   make prepare
76   # load configuration
77   # Configure the kernel. Replace the line below with one of your choice.
78   #make menuconfig # CLI menu for configuration
79   #make nconfig # new CLI menu for configuration
80   #make xconfig # X-based configuration
81   #make oldconfig # using old config from previous kernel version
82   # ... or manually edit .config
84   ####################
85   # stop here
86   # this is useful to configure the kernel
87   #msg "Stopping build"
88   #return 1
89   ####################
91   yes "" | make config
93   # build!
94   make ${MAKEFLAGS} bzImage modules
97 package_linux-pae() {
98   pkgdesc="The Linux Kernel and modules with PAE support (HIGHMEM64G)"
99   depends=('coreutils' 'linux-firmware' 'module-init-tools>=3.16' 'mkinitcpio>=0.7')
100   optdepends=('crda: to set the correct wireless channels of your country')
101   provides=('kernel26-pae')
102   conflicts=('kernel26-pae')
103   replaces=('kernel26-pae')
104   backup=("etc/mkinitcpio.d/${pkgname}.preset")
105   install=${pkgname}.install
107   cd "${srcdir}/linux-${_basekernel}"
109   KARCH=x86
111   # get kernel version
112   _kernver="$(make kernelrelease)"
114   mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot}
115   make INSTALL_MOD_PATH="${pkgdir}" modules_install
116   cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgname}"
118   # add vmlinux
119   install -D -m644 vmlinux "${pkgdir}/usr/src/linux-${_kernver}/vmlinux"
121   # install fallback mkinitcpio.conf file and preset file for kernel
122   install -D -m644 "${srcdir}/${pkgname}.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset"
124   # set correct depmod command for install
125   sed \
126     -e  "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
127     -e  "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
128     -i "${startdir}/${pkgname}.install"
129   sed \
130     -e "s|ALL_kver=.*|ALL_kver=\"/boot/vmlinuz-${pkgname}\"|g" \
131     -e "s|default_image=.*|default_image=\"/boot/initramfs-${pkgname}.img\"|g" \
132     -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs-${pkgname}-fallback.img\"|g" \
133     -i "${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset"
135   # remove build and source links
136   rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build}
137   # remove the firmware
138   rm -rf "${pkgdir}/lib/firmware"
139   # gzip -9 all modules to save 100MB of space
140   find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \;
141   # make room for external modules
142   ln -s "../extramodules-${_basekernel}${_kernelname:--ARCH}" "${pkgdir}/lib/modules/${_kernver}/extramodules"
143   # add real version for building modules and running depmod from post_install/upgrade
144   mkdir -p "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--ARCH}"
145   echo "${_kernver}" > "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--ARCH}/version"
148 package_linux-pae-headers() {
149   pkgdesc="Header files and scripts for building modules for linux-pae kernel"
150   provides=('kernel26-pae-headers')
151   conflicts=('kernel26-pae-headers')
152   replaces=('kernel26-pae-headers')
154   mkdir -p "${pkgdir}/lib/modules/${_kernver}"
156   cd "${pkgdir}/lib/modules/${_kernver}"
157   ln -sf ../../../usr/src/linux-${_kernver} build
159   cd "${srcdir}/linux-${_basekernel}"
160   install -D -m644 Makefile \
161     "${pkgdir}/usr/src/linux-${_kernver}/Makefile"
162   install -D -m644 kernel/Makefile \
163     "${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile"
164   install -D -m644 .config \
165     "${pkgdir}/usr/src/linux-${_kernver}/.config"
167   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include"
169   for i in acpi asm-generic config crypto drm generated linux math-emu \
170     media net pcmcia scsi sound trace video xen; do
171     cp -a include/${i} "${pkgdir}/usr/src/linux-${_kernver}/include/"
172   done
174   # copy arch includes for external modules
175   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/x86"
176   cp -a arch/x86/include "${pkgdir}/usr/src/linux-${_kernver}/arch/x86/"
178   # copy files necessary for later builds, like nvidia and vmware
179   cp Module.symvers "${pkgdir}/usr/src/linux-${_kernver}"
180   cp -a scripts "${pkgdir}/usr/src/linux-${_kernver}"
182   # fix permissions on scripts dir
183   chmod og-w -R "${pkgdir}/usr/src/linux-${_kernver}/scripts"
184   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions"
186   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel"
188   cp arch/${KARCH}/Makefile "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
190   if [ "${CARCH}" = "i686" ]; then
191     cp arch/${KARCH}/Makefile_32.cpu "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
192   fi
194   cp arch/${KARCH}/kernel/asm-offsets.s "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel/"
196   # add headers for lirc package
197   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video"
199   cp drivers/media/video/*.h  "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/"
201   for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102; do
202     mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
203     cp -a drivers/media/video/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
204   done
206   # add docbook makefile
207   install -D -m644 Documentation/DocBook/Makefile \
208     "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
210   # add dm headers
211   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
212   cp drivers/md/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
214   # add inotify.h
215   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/linux"
216   cp include/linux/inotify.h "${pkgdir}/usr/src/linux-${_kernver}/include/linux/"
218   # add wireless headers
219   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
220   cp net/mac80211/*.h "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
222   # add dvb headers for external modules
223   # in reference to:
224   # http://bugs.archlinux.org/task/9912
225   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core"
226   cp drivers/media/dvb/dvb-core/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/"
227   # and...
228   # http://bugs.archlinux.org/task/11194
229   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
230   cp include/config/dvb/*.h "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
232   # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
233   # in reference to:
234   # http://bugs.archlinux.org/task/13146
235   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
236   cp drivers/media/dvb/frontends/lgdt330x.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
237   cp drivers/media/video/msp3400-driver.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
239   # add dvb headers
240   # in reference to:
241   # http://bugs.archlinux.org/task/20402
242   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb"
243   cp drivers/media/dvb/dvb-usb/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/"
244   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends"
245   cp drivers/media/dvb/frontends/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
246   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners"
247   cp drivers/media/common/tuners/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners/"
249   # add xfs and shmem for aufs building
250   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs"
251   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/mm"
252   cp fs/xfs/xfs_sb.h "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h"
254   # copy in Kconfig files
255   for i in `find . -name "Kconfig*"`; do
256     mkdir -p "${pkgdir}"/usr/src/linux-${_kernver}/`echo ${i} | sed 's|/Kconfig.*||'`
257     cp ${i} "${pkgdir}/usr/src/linux-${_kernver}/${i}"
258   done
260   chown -R root.root "${pkgdir}/usr/src/linux-${_kernver}"
261   find "${pkgdir}/usr/src/linux-${_kernver}" -type d -exec chmod 755 {} \;
263   # strip scripts directory
264   find "${pkgdir}/usr/src/linux-${_kernver}/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
265     case "$(file -bi "${binary}")" in
266       *application/x-sharedlib*) # Libraries (.so)
267         /usr/bin/strip ${STRIP_SHARED} "${binary}";;
268       *application/x-archive*) # Libraries (.a)
269         /usr/bin/strip ${STRIP_STATIC} "${binary}";;
270       *application/x-executable*) # Binaries
271         /usr/bin/strip ${STRIP_BINARIES} "${binary}";;
272     esac
273   done
275   # remove unneeded architectures
276   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}
279 #package_linux-pae-docs() {
280 #  pkgdesc="Kernel hackers manual - HTML documentation that comes with the Linux kernel."
281 #  provides=('kernel26-pae-docs')
282 #  conflicts=('kernel26-pae-docs')
283 #  replaces=('kernel26-pae-docs')
285 #  cd "${srcdir}/linux-${_basekernel}"
287 #  mkdir -p "${pkgdir}/usr/src/linux-${_kernver}"
288 #  cp -al Documentation "${pkgdir}/usr/src/linux-${_kernver}"
289 #  find "${pkgdir}" -type f -exec chmod 444 {} \;
290 #  find "${pkgdir}" -type d -exec chmod 755 {} \;
292 #  # remove a file already in linux package
293 #  rm -f "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
296 # workaround for uploading split packages to AUR
297 pkgname=linux-pae
298 pkgdesc="The Linux kernel and modules with PAE support (HIGHMEM64G)"