updated on Thu Jan 12 04:00:44 UTC 2012
[aur-mirror.git] / linux-pae / PKGBUILD
blobd902de5d5af1030cb8c79d2f634d3db61b36151b
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.1
10 pkgver=${_basekernel}.8
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.1.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-fix-incorrect-error-message.patch')
25 md5sums=('edbdc798f23ae0f8045c82f6fa22c536'
26          '503acb7689ec96446f5774d6c86c1207'
27          '0dd90df28a7de890cad6d76c9a79e662'
28          'c734be95555d4662cbe91fb9daa8679a'
29          '9d3c56a4b999c8bfbd4018089a62f662'
30          '263725f20c0b9eb9c353040792d644e5'
31          'a50c9076012cb2dda49952dc6ec3e9c1')
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   # Some chips detect a ghost TV output
43   # mailing list discussion: http://lists.freedesktop.org/archives/intel-gfx/2011-April/010371.html
44   # Arch Linux bug report: FS#19234
45   #
46   # It is unclear why this patch wasn't merged upstream, it was accepted,
47   # then dropped because the reasoning was unclear. However, it is clearly
48   # needed.
49   patch -Np1 -i "${srcdir}/i915-fix-ghost-tv-output.patch"
51   # In 3.1.1, a DRM_DEBUG message is falsely declared as DRM_ERROR. This
52   # worries users, as this message is displayed even at loglevel 4. Fix
53   # this.
54   patch -Np1 -i "${srcdir}/i915-fix-incorrect-error-message.patch"
56   # set DEFAULT_CONSOLE_LOGLEVEL to 4 (same value as the 'quiet' kernel param)
57   # remove this when a Kconfig knob is made available by upstream
58   # (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227)
59   patch -Np1 -i "${srcdir}/change-default-console-loglevel.patch"
61   if [ "${CARCH}" = "x86_64" ]; then
62     cat "${srcdir}/config.x86_64" > ./.config
63   else
64     cat "${srcdir}/config" > ./.config
65   fi
67   if [ "${_kernelname}" != "" ]; then
68     sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
69   fi
71   # set extraversion to pkgrel
72   sed -ri "s|^(EXTRAVERSION =).*|\1 -${pkgrel}|" Makefile
74   # get kernel version
75   make prepare
77   # load configuration
78   # Configure the kernel. Replace the line below with one of your choice.
79   #make menuconfig # CLI menu for configuration
80   #make nconfig # new CLI menu for configuration
81   #make xconfig # X-based configuration
82   #make oldconfig # using old config from previous kernel version
83   # ... or manually edit .config
85   ####################
86   # stop here
87   # this is useful to configure the kernel
88   #msg "Stopping build"
89   #return 1
90   ####################
92   yes "" | make config
94   # build!
95   make ${MAKEFLAGS} bzImage modules
98 package_linux-pae() {
99   pkgdesc="The Linux Kernel and modules with PAE support (HIGHMEM64G)"
100   depends=('coreutils' 'linux-firmware' 'module-init-tools>=3.16' 'mkinitcpio>=0.7')
101   optdepends=('crda: to set the correct wireless channels of your country')
102   provides=('kernel26-pae')
103   conflicts=('kernel26-pae')
104   replaces=('kernel26-pae')
105   backup=("etc/mkinitcpio.d/${pkgname}.preset")
106   install=${pkgname}.install
108   cd "${srcdir}/linux-${_basekernel}"
110   KARCH=x86
112   # get kernel version
113   _kernver="$(make kernelrelease)"
115   mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot}
116   make INSTALL_MOD_PATH="${pkgdir}" modules_install
117   cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgname}"
119   # add vmlinux
120   install -D -m644 vmlinux "${pkgdir}/usr/src/linux-${_kernver}/vmlinux"
122   # install fallback mkinitcpio.conf file and preset file for kernel
123   install -D -m644 "${srcdir}/${pkgname}.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset"
125   # set correct depmod command for install
126   sed \
127     -e  "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
128     -e  "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
129     -i "${startdir}/${pkgname}.install"
130   sed \
131     -e "s|ALL_kver=.*|ALL_kver=\"/boot/vmlinuz-${pkgname}\"|g" \
132     -e "s|default_image=.*|default_image=\"/boot/initramfs-${pkgname}.img\"|g" \
133     -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs-${pkgname}-fallback.img\"|g" \
134     -i "${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset"
136   # remove build and source links
137   rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build}
138   # remove the firmware
139   rm -rf "${pkgdir}/lib/firmware"
140   # gzip -9 all modules to save 100MB of space
141   find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \;
142   # make room for external modules
143   ln -s "../extramodules-${_basekernel}${_kernelname:--ARCH}" "${pkgdir}/lib/modules/${_kernver}/extramodules"
144   # add real version for building modules and running depmod from post_install/upgrade
145   mkdir -p "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--ARCH}"
146   echo "${_kernver}" > "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--ARCH}/version"
149 package_linux-pae-headers() {
150   pkgdesc="Header files and scripts for building modules for linux-pae kernel"
151   provides=('kernel26-pae-headers')
152   conflicts=('kernel26-pae-headers')
153   replaces=('kernel26-pae-headers')
155   mkdir -p "${pkgdir}/lib/modules/${_kernver}"
157   cd "${pkgdir}/lib/modules/${_kernver}"
158   ln -sf ../../../usr/src/linux-${_kernver} build
160   cd "${srcdir}/linux-${_basekernel}"
161   install -D -m644 Makefile \
162     "${pkgdir}/usr/src/linux-${_kernver}/Makefile"
163   install -D -m644 kernel/Makefile \
164     "${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile"
165   install -D -m644 .config \
166     "${pkgdir}/usr/src/linux-${_kernver}/.config"
168   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include"
170   for i in acpi asm-generic config crypto drm generated linux math-emu \
171     media net pcmcia scsi sound trace video xen; do
172     cp -a include/${i} "${pkgdir}/usr/src/linux-${_kernver}/include/"
173   done
175   # copy arch includes for external modules
176   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/x86"
177   cp -a arch/x86/include "${pkgdir}/usr/src/linux-${_kernver}/arch/x86/"
179   # copy files necessary for later builds, like nvidia and vmware
180   cp Module.symvers "${pkgdir}/usr/src/linux-${_kernver}"
181   cp -a scripts "${pkgdir}/usr/src/linux-${_kernver}"
183   # fix permissions on scripts dir
184   chmod og-w -R "${pkgdir}/usr/src/linux-${_kernver}/scripts"
185   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions"
187   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel"
189   cp arch/${KARCH}/Makefile "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
191   if [ "${CARCH}" = "i686" ]; then
192     cp arch/${KARCH}/Makefile_32.cpu "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
193   fi
195   cp arch/${KARCH}/kernel/asm-offsets.s "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel/"
197   # add headers for lirc package
198   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video"
200   cp drivers/media/video/*.h  "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/"
202   for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102; do
203     mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
204     cp -a drivers/media/video/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
205   done
207   # add docbook makefile
208   install -D -m644 Documentation/DocBook/Makefile \
209     "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
211   # add dm headers
212   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
213   cp drivers/md/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
215   # add inotify.h
216   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/linux"
217   cp include/linux/inotify.h "${pkgdir}/usr/src/linux-${_kernver}/include/linux/"
219   # add wireless headers
220   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
221   cp net/mac80211/*.h "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
223   # add dvb headers for external modules
224   # in reference to:
225   # http://bugs.archlinux.org/task/9912
226   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core"
227   cp drivers/media/dvb/dvb-core/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/"
228   # and...
229   # http://bugs.archlinux.org/task/11194
230   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
231   cp include/config/dvb/*.h "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
233   # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
234   # in reference to:
235   # http://bugs.archlinux.org/task/13146
236   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
237   cp drivers/media/dvb/frontends/lgdt330x.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
238   cp drivers/media/video/msp3400-driver.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
240   # add dvb headers
241   # in reference to:
242   # http://bugs.archlinux.org/task/20402
243   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb"
244   cp drivers/media/dvb/dvb-usb/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/"
245   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends"
246   cp drivers/media/dvb/frontends/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
247   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners"
248   cp drivers/media/common/tuners/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners/"
250   # add xfs and shmem for aufs building
251   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs"
252   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/mm"
253   cp fs/xfs/xfs_sb.h "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h"
255   # copy in Kconfig files
256   for i in `find . -name "Kconfig*"`; do
257     mkdir -p "${pkgdir}"/usr/src/linux-${_kernver}/`echo ${i} | sed 's|/Kconfig.*||'`
258     cp ${i} "${pkgdir}/usr/src/linux-${_kernver}/${i}"
259   done
261   chown -R root.root "${pkgdir}/usr/src/linux-${_kernver}"
262   find "${pkgdir}/usr/src/linux-${_kernver}" -type d -exec chmod 755 {} \;
264   # strip scripts directory
265   find "${pkgdir}/usr/src/linux-${_kernver}/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
266     case "$(file -bi "${binary}")" in
267       *application/x-sharedlib*) # Libraries (.so)
268         /usr/bin/strip ${STRIP_SHARED} "${binary}";;
269       *application/x-archive*) # Libraries (.a)
270         /usr/bin/strip ${STRIP_STATIC} "${binary}";;
271       *application/x-executable*) # Binaries
272         /usr/bin/strip ${STRIP_BINARIES} "${binary}";;
273     esac
274   done
276   # remove unneeded architectures
277   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}
280 #package_linux-pae-docs() {
281 #  pkgdesc="Kernel hackers manual - HTML documentation that comes with the Linux kernel."
282 #  provides=('kernel26-pae-docs')
283 #  conflicts=('kernel26-pae-docs')
284 #  replaces=('kernel26-pae-docs')
286 #  cd "${srcdir}/linux-${_basekernel}"
288 #  mkdir -p "${pkgdir}/usr/src/linux-${_kernver}"
289 #  cp -al Documentation "${pkgdir}/usr/src/linux-${_kernver}"
290 #  find "${pkgdir}" -type f -exec chmod 444 {} \;
291 #  find "${pkgdir}" -type d -exec chmod 755 {} \;
293 #  # remove a file already in linux package
294 #  rm -f "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
297 # workaround for uploading split packages to AUR
298 pkgname=linux-pae
299 pkgdesc="The Linux kernel and modules with PAE support (HIGHMEM64G)"