Skip to content
PKGBUILD 2.75 KiB
Newer Older
# Maintainer: Sébastien Luttringer <seblu@aur.archlinux.org>
# Customized version of linux for seblu computers


Seblu's avatar
Seblu committed
pkgname=linux-seblu
pkgver=3.14
pkgrel=1
Seblu's avatar
up  
Seblu committed
arch=('x86_64')
license=('GPL2')
url='http://www.kernel.org'
options=('!strip')
Seblu's avatar
Seblu committed
makedepends=('kmod' 'bc' 'git')
Seblu's avatar
Seblu committed
source=("git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git#tag=v$pkgver"
        "config.$CARCH.$pkgver")
Seblu's avatar
Seblu committed
md5sums=('SKIP' 'SKIP')
Seblu's avatar
Seblu committed
shopt -s nullglob
Seblu's avatar
up  
Seblu committed

Seblu's avatar
Seblu committed
prepare() {
Seblu's avatar
Seblu committed
  # apply patches
Seblu's avatar
Seblu committed
  cd linux
Seblu's avatar
Seblu committed
  for _f in "$srcdir"/*.patch; do
    [[ -r "$_f" ]] || continue
    msg2 "Applying patch: ${_f##*/}"
Seblu's avatar
Seblu committed
    patch -N -p1 -i "$_f"
Seblu's avatar
Seblu committed
  done

	# loading default config
  # use make localmodconfig to check .config is correct
  msg2 'Copying config'
Seblu's avatar
Seblu committed
  install "$srcdir/config.$CARCH.$pkgver" .config
	# force suffixe in config (must be the right!)
	msg2 'Setting kernel suffix'
Seblu's avatar
Seblu committed
	sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${pkgname#linux*}\"|g" .config
Seblu's avatar
Seblu committed

  # remove git informations
  # these info will be used by make kernelrelease and produce wrong information
  # because ownership has fakely be changed by fakeroot during packaging.
  rm -rf .git
Seblu's avatar
Seblu committed
}

build() {
Seblu's avatar
Seblu committed
  cd linux

  # define current build version
Seblu's avatar
Seblu committed
  echo "$(($pkgrel - 1 )) " > .version

  # Preapre compilation
Seblu's avatar
Seblu committed
  msg2 'Preparing compilation'
Seblu's avatar
Seblu committed
  yes '' | make config &>/dev/null
  make prepare &>/dev/null

  # Compiling sources
  msg2 'Compiling'
Seblu's avatar
Seblu committed
  make bzImage modules
Seblu's avatar
Seblu committed
  cd linux
  # get real compiled kernel version
Seblu's avatar
Seblu committed
  kernrel=$(make kernelrelease)
  pkgdesc="The Linux Kernel, version $kernrel"
  pkgname="linux-$kernrel"
Seblu's avatar
Seblu committed
  pkgver=$(make kernelversion|tr '-' '_')
Seblu's avatar
Seblu committed
  provides=("linux=$pkgver" "linux-headers=$pkgver")
  conflicts=("linux-seblu-$pkgver")
Seblu's avatar
Seblu committed
  depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio')
  install='install'

Seblu's avatar
Seblu committed
  msg2 "Packing kernel release: $kernrel"
  msg2 "Packing kernel version: $pkgver"
Seblu's avatar
Seblu committed

  # installing modules
Seblu's avatar
up  
Seblu committed
  # disable DEPMOD because it fail due to poor hack in scripts/depmod.sh
  # and it's done by kernel-install in .install
Seblu's avatar
Seblu committed
  make INSTALL_MOD_PATH="$pkgdir/usr" DEPMOD=/bin/true modules_install
Seblu's avatar
up  
Seblu committed

Seblu's avatar
Seblu committed
  # install headers
  make INSTALL_HDR_PATH="$pkgdir/usr/src/linux-$kernrel" headers_install
  ln -sf ../../../src/linux-$kernrel "$pkgdir/usr/lib/modules/$kernrel/build"

  # install kernel and map
Seblu's avatar
Seblu committed
  install -D -m644 arch/x86/boot/bzImage "$pkgdir/usr/lib/kernel/vmlinuz-$kernrel"

  # remove build and source links
Seblu's avatar
Seblu committed
  rm -f "$pkgdir/usr/lib/modules/$kernrel"/{source,build}
Seblu's avatar
Seblu committed
  # remove the firmware
Seblu's avatar
up  
Seblu committed
  rm -rf "$pkgdir/usr/lib/firmware"
Seblu's avatar
Seblu committed

  # check rights
Seblu's avatar
Seblu committed
  chown -R root.root "$pkgdir/usr/src/linux-$kernrel"
  chmod -R u=rwX,go=rX "$pkgdir/usr/src/linux-$kernrel"

  # gzip -9 all modules to safe 100MB of space
  msg2 'Gzip modules harder'
Seblu's avatar
Seblu committed
  find "$pkgdir" -name '*.ko' -exec gzip -9 {} \;
}

# vim:set ts=2 sw=2 ft=sh et: