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>
7 pkgname=('linux-pae' 'linux-pae-headers')
8 _kernelname=${pkgname#linux}
10 pkgver=${_basekernel}.1
13 url="http://www.kernel.org/"
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
20 # standard config files for mkinitcpio ramdisk
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')
34 cd "${srcdir}/linux-${_basekernel}"
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
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
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
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
63 cat "${srcdir}/config" > ./.config
66 if [ "${_kernelname}" != "" ]; then
67 sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
70 # set extraversion to pkgrel
71 sed -ri "s|^(EXTRAVERSION =).*|\1 -${pkgrel}|" Makefile
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
86 # this is useful to configure the kernel
94 make ${MAKEFLAGS} bzImage modules
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}"
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}"
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
126 -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
127 -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
128 -i "${startdir}/${pkgname}.install"
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/"
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}/"
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}"
206 # add docbook makefile
207 install -D -m644 Documentation/DocBook/Makefile \
208 "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
211 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
212 cp drivers/md/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
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
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/"
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
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/"
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}"
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}";;
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
298 pkgdesc="The Linux kernel and modules with PAE support (HIGHMEM64G)"