1 # Original kernel maintainers:
2 # Tobias Powalowski <tpowa@archlinux.org>
3 # Thomas Baechler <thomas@archlinux.org>
5 # henning mueller <henning@orgizm.net>
8 _kernelname=${pkgname#linux}
14 url="http://www.kernel.org/"
18 pkgdesc="The Linux Kernel and modules with PaX patches"
20 depends=('paxctl' 'coreutils' 'linux-firmware' 'module-init-tools>=3.16' 'mkinitcpio>=0.7')
21 optdepends=('crda: to set the correct wireless channels of your country')
22 provides=('kernel26-pax')
23 conflicts=('kernel26-pax')
24 replaces=('kernel26-pax')
25 backup=("etc/mkinitcpio.d/${pkgname}.preset")
26 install=$pkgname.install
29 [ ! -z $MENUCONFIG ] && _menuconfig=1
32 ftp://ftp.kernel.org/pub/linux/kernel/v3.0/linux-$pkgver.tar.bz2
33 http://grsecurity.net/test/pax-linux-$pkgver-$_paxver.patch
34 change-default-console-loglevel.patch
35 i915-fix-ghost-tv-output.patch
40 $pkgname-fix-permissions
43 7ceb61f87c097fc17509844b71268935
44 b9abf5eabb8f502d3b82910798e80bfa
45 9d3c56a4b999c8bfbd4018089a62f662
46 342071f852564e1ad03b79271a90b1a5
47 523dc8857f80520a833e30542708b5ae
48 f1397e95d7f6e9f4180b8b16bbc49d52
49 c792439f6f6c0dcedd1c71af63673d30
50 5d29c2995ffa1ac918dd6b269ec09ecc
51 85bb4c7bf39ee39265546b21d6170bc9
55 cd $srcdir/linux-$pkgver
57 # Some chips detect a ghost TV output
58 # mailing list discussion: http://lists.freedesktop.org/archives/intel-gfx/2011-April/010371.html
59 # Arch Linux bug report: FS#19234
61 # It is unclear why this patch wasn't merged upstream, it was accepted,
62 # then dropped because the reasoning was unclear. However, it is clearly
64 patch -Np1 -i "${srcdir}/i915-fix-ghost-tv-output.patch"
66 # set DEFAULT_CONSOLE_LOGLEVEL to 4 (same value as the 'quiet' kernel param)
67 # remove this when a Kconfig knob is made available by upstream
68 # (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227)
69 patch -Np1 -i "${srcdir}/change-default-console-loglevel.patch"
72 patch -Np1 -i $srcdir/pax-linux-$pkgver-$_paxver.patch
74 if [ "${CARCH}" = "x86_64" ]; then
75 cat "${srcdir}/config.x86_64" > ./.config
77 cat "${srcdir}/config" > ./.config
80 if [ "${_kernelname}" != "" ]; then
81 sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
84 # remove the sublevel from Makefile
85 # this ensures our kernel version is always 3.X-ARCH
86 # this way, minor kernel updates will not break external modules
87 # we need to change this soon, see FS#16702
88 sed -ri 's|^(SUBLEVEL =).*|\1|' Makefile
91 [ "$_menuconfig" = "0" ] && {
96 # Configure the kernel. Replace the line below with one of your choice.
97 [ "$_menuconfig" = "1" ] && {
98 make menuconfig # CLI menu for configuration
99 #make nconfig # new CLI menu for configuration
100 #make xconfig # X-based configuration
101 #make oldconfig # using old config from previous kernel version
102 # ... or manually edit .config
107 # this is useful to configure the kernel
108 [ "$_menuconfig" = "1" ] && {
117 make ${MAKEFLAGS} bzImage modules
121 cd $srcdir/linux-$pkgver
126 _kernver="$(make kernelrelease)"
128 mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot}
129 make INSTALL_MOD_PATH="${pkgdir}" modules_install
130 cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgname}"
133 install -D -m644 vmlinux "${pkgdir}/usr/src/linux-${_kernver}/vmlinux"
135 # install fallback mkinitcpio.conf file and preset file for kernel
136 install -D -m644 "${srcdir}/${pkgname}.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset"
138 # set correct depmod command for install
140 -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
141 -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
142 -i "${startdir}/${pkgname}.install"
144 -e "s|ALL_kver=.*|ALL_kver=\"/boot/vmlinuz-${pkgname}\"|g" \
145 -e "s|default_image=.*|default_image=\"/boot/initramfs-${pkgname}.img\"|g" \
146 -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs-${pkgname}-fallback.img\"|g" \
147 -i "${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset"
149 # remove build and source links
150 rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build}
151 # remove the firmware
152 rm -rf "${pkgdir}/lib/firmware"
153 # gzip -9 all modules to safe 100MB of space
154 find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \;
155 # make room for external modules
156 ln -s "../extramodules-${_basekernel}${_kernelname:--ARCH}" "${pkgdir}/lib/modules/${_kernver}/extramodules"
157 # add real version for building modules and running depmod from post_install/upgrade
158 mkdir -p "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--ARCH}"
159 echo "${_kernver}" > "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--ARCH}/version"
161 install -D -m755 $srcdir/$pkgname-fix-permissions \
162 $pkgdir/usr/bin/$pkgname-fix-permissions