Commit ee80ae0e authored by Seblu's avatar Seblu
Browse files

Add linux-stable kernels

parent 92faeb75
Loading
Loading
Loading
Loading

linux-stable/PKGBUILD

0 → 100644
+98 −0
Original line number Diff line number Diff line
# Maintainer: Sébastien Luttringer <seblu@aur.archlinux.org>
# Customized version of linux for seblu computers


pkgname=linux-stable
pkgver=3.2.55
pkgrel=1
arch=('x86_64')
license=('GPL2')
url='http://www.kernel.org'
options=('!strip')
makedepends=('kmod' 'bc' 'git')
source=("git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git#tag=v$pkgver"
        "config.$CARCH.$pkgver")
md5sums=('SKIP' 'SKIP')

shopt -s nullglob

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

	# loading default config
  # use make localmodconfig to check .config is correct
  msg2 'Copying config'
  install "$srcdir/config.$CARCH.$pkgver" .config

	# force suffixe in config (must be the right!)
	msg2 'Setting kernel suffix'
	sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${pkgname#linux*}\"|g" .config

  # 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
}

build() {
  cd $pkgname

  # define current build version
  echo "$(($pkgrel - 1 )) " > .version

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

  # Compiling sources
  msg2 'Compiling'
  make bzImage modules
}

package() {
  cd $pkgname
  # get real compiled kernel version
  kernrel=$(make kernelrelease)
  pkgdesc="The Linux Kernel, version $kernrel"
  pkgname="linux-$kernrel"
  provides=("linux=$pkgver" "linux-headers=$pkgver")
  depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio')
  install='install'

  msg2 "Packing kernel version: $kernrel"

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

  # 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
  install -D -m644 arch/x86/boot/bzImage "$pkgdir/usr/lib/kernel/vmlinuz-$kernrel"

  # remove build and source links
  rm -f "$pkgdir/usr/lib/modules/$kernrel"/{source,build}

  # remove the firmware
  rm -rf "$pkgdir/usr/lib/firmware"

  # check rights
  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'
  find "$pkgdir" -name '*.ko' -exec gzip -9 {} \;
}

# vim:set ts=2 sw=2 ft=sh et:
+5001 −0

File added.

Preview size limit exceeded, changes collapsed.

linux-stable/install

0 → 100644
+41 −0
Original line number Diff line number Diff line
# vim:set ts=2 sw=2 ft=sh et:

# arg 1:  the new package version
post_install () {
  if type -P kernel-install >/dev/null; then
    version=${1%-*}
    version=${version/_/-}-stable
    echo "==> Calling kernel-install add $version ..."
    kernel-install add "$version" "/usr/lib/kernel/vmlinuz-$version"
  fi
}

# arg 1:  the new package version
# arg 2:  the old package version
pre_upgrade() {
  pre_remove "$2"
}

# arg 1:  the new package version
# arg 2:  the old package version
post_upgrade() {
  post_install "$1"
}

# arg 1:  the old package version
pre_remove() {
  if type -P kernel-install >/dev/null; then
    version=${1%-*}
    version=${version/_/-}-stable
    echo "==> kernel-install remove $version"
    kernel-install remove "$version"
  fi
}

# arg 1:  the old package version
post_remove() {
  version=${1%-*}
  version=${version/_/-}-stable
  echo "==> Cleaning remaining kernel $version modules"
  [[ -n $version ]] && rm -rvf /usr/lib/modules/"$version"
}