# $Id: PKGBUILD 223919 2014-10-06 14:51:49Z tpowa $
# Maintainer: Joakim Hernberg <jbh@alchemy.lu>
# Contributor: Ray Rashif <schiv@archlinux.org>
# Contributor: timbosa <tinny_tim@dodo.com.au>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: Thomas Baechler <thomas@archlinux.org>
#pkgbase=linux # Build stock -ARCH kernel
pkgbase=linux-rt-lts # Build kernel with a different name
_srcname=linux-3.18
_pkgver=3.18.29
_rtpatchver=rt30
pkgver=${_pkgver}_${_rtpatchver}
pkgrel=1
arch=('i686' 'x86_64')
url="http://www.kernel.org/"
license=('GPL2')
makedepends=('xmlto' 'docbook-xsl' 'kmod' 'inetutils' 'bc')
options=('!strip')
source=("https://www.kernel.org/pub/linux/kernel/v3.x/${_srcname}.tar."{xz,sign}
"https://www.kernel.org/pub/linux/kernel/v3.x/patch-${_pkgver}."{xz,sign}
#"https://www.kernel.org/pub/linux/kernel/projects/rt/3.18/older/patch-${_pkgver}-${_rtpatchver}.patch."{xz,sign}
"https://www.kernel.org/pub/linux/kernel/projects/rt/3.18/patch-${_pkgver}-${_rtpatchver}.patch."{xz,sign}
# the main kernel config files
'config' 'config.x86_64'
# standard config files for mkinitcpio ramdisk
"${pkgbase}.preset"
'change-default-console-loglevel.patch'
'fix-race-in-PRT-wait-for-completion-simple-wait-code_Nvidia-RT.patch')
sha256sums=('becc413cc9e6d7f5cc52a3ce66d65c3725bc1d1cc1001f4ce6c32b69eb188cbd'
'SKIP'
'c406a8488d8d4d9e11934479b188126bce5dc41477be19a1bb389fd4a94ecb53'
'SKIP'
'd75ff961fc5ea4d2d338db1fe9ab31baf32eb6bf1851d1c1932259ccfd4cc616'
'SKIP'
'3c876bd83489e56e62629fc09ce85391bef5ef94cb2feab7751841c221c000c6'
'49202f4733bd9de254083a85d0a17390f78e68fc6e4bea9e91bfce7e8167349e'
'a8886f2c9896f81f59cf0413b3e380cda2fbdc667eb9ce8dfcb0fceb6d92279f'
'1256b241cd477b265a3c2d64bdc19ffe3c9bbcee82ea3994c590c2c76e767d99'
'7a42d16108eb9a8eacadef3603527fa1beab857cc4db3bd228858488fb1f3fda')
validpgpkeys=('ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
'647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
'64254695FFF0AA4466CC19E67B96E8162A8CF5D1' # Sebastian Andrzej Siewior
'5ED9A48FC54C0A22D1D0804CEBC26CDB5A56DE73' # Steven Rostedt
)
_kernelname=${pkgbase#linux}
prepare() {
cd "${srcdir}/${_srcname}"
# add upstream patch
patch -p1 -i "${srcdir}/patch-${_pkgver}"
# add realtime patch
msg "applying patch-${_pkgver}-${_rtpatchver}.patch"
patch -p1 -i "${srcdir}/patch-${_pkgver}-${_rtpatchver}.patch"
# add latest fixes from stable queue, if needed
# http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
# set DEFAULT_CONSOLE_LOGLEVEL to 4 (same value as the 'quiet' kernel param)
# remove this when a Kconfig knob is made available by upstream
# (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227)
patch -p1 -i "${srcdir}/change-default-console-loglevel.patch"
# A patch to fix a problem that ought to be fixed in the NVIDIA source code.
# Stops X from hanging on certain NVIDIA cards
msg "fix-race-in-PRT-wait-for-completion-simple-wait-code_Nvidia-RT.patch"
patch -p1 -i "${srcdir}/fix-race-in-PRT-wait-for-completion-simple-wait-code_Nvidia-RT.patch"
msg "All patches have successfully been applied"
if [ "${CARCH}" = "x86_64" ]; then
cat "${srcdir}/config.x86_64" > ./.config
else
cat "${srcdir}/config" > ./.config
fi
if [ "${_kernelname}" != "" ]; then
sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"-${pkgrel}${_kernelname}\"|g" ./.config
sed -i "s|CONFIG_LOCALVERSION_AUTO=.*|CONFIG_LOCALVERSION_AUTO=n|" ./.config
fi
# set extraversion to pkgrel
# sed -ri "s|^(EXTRAVERSION =).*|\1 -${pkgrel}|" Makefile
# don't run depmod on 'make install'. We'll do this ourselves in packaging
sed -i '2iexit 0' scripts/depmod.sh
# get kernel version
make prepare
# load configuration
# Configure the kernel. Replace the line below with one of your choice.
#make menuconfig # CLI menu for configuration
#make nconfig # new CLI menu for configuration
#make xconfig # X-based configuration
#make oldconfig # using old config from previous kernel version
# ... or manually edit .config
# rewrite configuration
yes "" | make config >/dev/null
}
build() {
cd "${srcdir}/${_srcname}"
make ${MAKEFLAGS} LOCALVERSION= bzImage modules
}
_package() {
pkgdesc="The ${pkgbase/linux/Linux} kernel and modules"
[ "${pkgbase}" = "linux" ] && groups=('base')
depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=0.7')
optdepends=('crda: to set the correct wireless channels of your country')
provides=("kernel26${_kernelname}=${_pkgver}")
conflicts=("kernel26${_kernelname}")
replaces=("kernel26${_kernelname}")
backup=("etc/mkinitcpio.d/${pkgbase}.preset")
install="${pkgbase}.install"
cd "${srcdir}/${_srcname}"
KARCH=x86
# get kernel version
_kernver="$(make LOCALVERSION= kernelrelease)"
_basekernel=${_kernver%%-*}
_basekernel=${_basekernel%.*}
mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot}
make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}" modules_install
cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmli