[arch-commits] Commit in linux-lts/trunk (PKGBUILD linux-lts.install linux-lts.preset)

Jan Steffens heftig at archlinux.org
Wed Aug 8 16:50:12 UTC 2012


    Date: Wednesday, August 8, 2012 @ 12:50:11
  Author: heftig
Revision: 165004

simplify custom kernels FS#30863, fix grub2 pkgname

Modified:
  linux-lts/trunk/PKGBUILD
  linux-lts/trunk/linux-lts.install
  linux-lts/trunk/linux-lts.preset

-------------------+
 PKGBUILD          |   98 +++++++++++++++++++++++++++++++---------------------
 linux-lts.install |    2 -
 linux-lts.preset  |    2 -
 3 files changed, 61 insertions(+), 41 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2012-08-08 16:01:32 UTC (rev 165003)
+++ PKGBUILD	2012-08-08 16:50:11 UTC (rev 165004)
@@ -2,24 +2,22 @@
 # Maintainer: Tobias Powalowski <tpowa at archlinux.org>
 # Maintainer: Thomas Baechler <thomas at archlinux.org>
 
-pkgbase=linux-lts
-pkgname=('linux-lts' 'linux-lts-headers') # Build stock -ARCH kernel
-# pkgname=linux-custom       # Build kernel with a different name
-_kernelname=${pkgname#linux}
-_basekernel=3.0
-pkgver=${_basekernel}.39
+pkgbase=linux-lts           # Build stock -lts kernel
+#pkgbase=linux-custom       # Build kernel with a different name
+_srcname=linux-3.0
+pkgver=3.0.39
 pkgrel=1
 arch=('i686' 'x86_64')
 url="http://www.kernel.org/"
 license=('GPL2')
 makedepends=('xmlto' 'docbook-xsl')
 options=('!strip')
-source=("http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.0.tar.xz"
+source=("http://www.kernel.org/pub/linux/kernel/v3.x/${_srcname}.tar.xz"
         "http://www.kernel.org/pub/linux/kernel/v3.x/patch-${pkgver}.xz"
         # the main kernel config files
         'config' 'config.x86_64'
         # standard config files for mkinitcpio ramdisk
-        "${pkgname}.preset"
+        'linux-lts.preset'
         'change-default-console-loglevel.patch'
         'i915-fix-ghost-tv-output.patch'
         'ext4-options.patch')
@@ -32,8 +30,10 @@
          '263725f20c0b9eb9c353040792d644e5'
          'c8299cf750a84e12d60b372c8ca7e1e8')
 
+_kernelname=${pkgbase#linux}
+
 build() {
-  cd "${srcdir}/linux-${_basekernel}"
+  cd "${srcdir}/${_srcname}"
 
   # add upstream patch
   patch -p1 -i "${srcdir}/patch-${pkgver}"
@@ -67,6 +67,7 @@
 
   if [ "${_kernelname}" != "" ]; then
     sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
+    sed -i "s|CONFIG_LOCALVERSION_AUTO=.*|CONFIG_LOCALVERSION_AUTO=n|" ./.config
   fi
 
   # set extraversion to pkgrel
@@ -86,56 +87,66 @@
   #make oldconfig # using old config from previous kernel version
   # ... or manually edit .config
 
+  # rewrite configuration
+  yes "" | make config >/dev/null
+
+  # save configuration for later reuse
+  if [ "${CARCH}" = "x86_64" ]; then
+    cat .config > "${startdir}/config.x86_64.last"
+  else
+    cat .config > "${startdir}/config.last"
+  fi
+
   ####################
   # stop here
   # this is useful to configure the kernel
-  #msg "Stopping build"
-  #return 1
+  #msg "Stopping build"; return 1
   ####################
 
-  yes "" | make config
-
   # build!
-  make ${MAKEFLAGS} bzImage modules
+  make ${MAKEFLAGS} LOCALVERSION= bzImage modules
 }
 
-package_linux-lts() {
-  pkgdesc="The Linux Kernel and modules - stable longtime supported kernel package suitable for servers"
+_package() {
+  pkgdesc="The ${pkgbase} kernel and modules - stable longtime supported kernel package suitable for servers"
   depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=0.7')
   optdepends=('crda: to set the correct wireless channels of your country')
-  provides=('kernel26-lts')
-  conflicts=('kernel26-lts')
-  replaces=('kernel26-lts' 'nouveau-drm-lts')
-  backup=("etc/mkinitcpio.d/${pkgname}.preset")
-  install=${pkgname}.install
+  provides=("kernel26${_kernelname}=${pkgver}")
+  conflicts=("kernel26${_kernelname}")
+  replaces=("kernel26${_kernelname}" "nouveau-drm${_kernelname}")
+  backup=("etc/mkinitcpio.d/${pkgbase}.preset")
+  install=linux-lts.install
 
-  cd "${srcdir}/linux-${_basekernel}"
+  cd "${srcdir}/${_srcname}"
 
   KARCH=x86
 
   # get kernel version
-  _kernver="$(make kernelrelease)"
+  _kernver="$(make LOCALVERSION= kernelrelease)"
+  _basekernel=${_kernver%%-*}
+  _basekernel=${_basekernel%.*}
 
   mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot}
-  make INSTALL_MOD_PATH="${pkgdir}" modules_install
-  cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgname}"
+  make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}" modules_install
+  cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}"
 
   # add vmlinux
   install -D -m644 vmlinux "${pkgdir}/usr/src/linux-${_kernver}/vmlinux"
 
   # install fallback mkinitcpio.conf file and preset file for kernel
-  install -D -m644 "${srcdir}/${pkgname}.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset"
+  install -D -m644 "${srcdir}/linux-lts.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
 
   # set correct depmod command for install
   sed \
-    -e  "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
-    -e  "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
-    -i "${startdir}/${pkgname}.install"
+    -e  "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/" \
+    -e  "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/" \
+    -i "${startdir}/linux-lts.install"
   sed \
-    -e "s|ALL_kver=.*|ALL_kver=\"/boot/vmlinuz-${pkgname}\"|g" \
-    -e "s|default_image=.*|default_image=\"/boot/initramfs-${pkgname}.img\"|g" \
-    -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs-${pkgname}-fallback.img\"|g" \
-    -i "${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset"
+    -e "1s|'linux.*'|'${pkgbase}'|" \
+    -e "s|ALL_kver=.*|ALL_kver=\"/boot/vmlinuz-${pkgbase}\"|" \
+    -e "s|default_image=.*|default_image=\"/boot/initramfs-${pkgbase}.img\"|" \
+    -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs-${pkgbase}-fallback.img\"|" \
+    -i "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
 
   # remove build and source links
   rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build}
@@ -156,18 +167,18 @@
   depmod -b "$pkgdir" -F System.map "$_kernver"
 }
 
-package_linux-lts-headers() {
-  pkgdesc="Header files and scripts for building modules for linux longtime supported kernel"
-  provides=('kernel26-lts-headers')
-  conflicts=('kernel26-lts-headers')
-  replaces=('kernel26-lts-headers')
+_package-headers() {
+  pkgdesc="Header files and scripts for building modules for ${pkgbase} kernel"
+  provides=("kernel26${_kernelname}-headers=${pkgver}")
+  conflicts=("kernel26${_kernelname}-headers")
+  replaces=("kernel26${_kernelname}-headers")
 
   install -dm755 "${pkgdir}/usr/lib/modules/${_kernver}"
 
   cd "${pkgdir}/usr/lib/modules/${_kernver}"
   ln -sf ../../../src/linux-${_kernver} build
 
-  cd "${srcdir}/linux-${_basekernel}"
+  cd "${srcdir}/${_srcname}"
   install -D -m644 Makefile \
     "${pkgdir}/usr/src/linux-${_kernver}/Makefile"
   install -D -m644 kernel/Makefile \
@@ -286,3 +297,12 @@
   # remove unneeded architectures
   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,score,sh,sh64,sparc,sparc64,tile,um,unicore32,v850,xtensa}
 }
+
+pkgname=("${pkgbase}" "${pkgbase}-headers")
+for _p in ${pkgname[@]}; do
+  eval "package_${_p}() {
+    _package${_p#${pkgbase}}
+  }"
+done
+
+# vim:set ts=8 sts=2 sw=2 et:

Modified: linux-lts.install
===================================================================
--- linux-lts.install	2012-08-08 16:01:32 UTC (rev 165003)
+++ linux-lts.install	2012-08-08 16:50:11 UTC (rev 165004)
@@ -31,7 +31,7 @@
 post_upgrade() {
   pacman -Q grub &>/dev/null
   hasgrub=$?
-  pacman -Q grub2 &>/dev/null
+  pacman -Q grub2-common &>/dev/null
   hasgrub2=$?
   pacman -Q lilo &>/dev/null
   haslilo=$?

Modified: linux-lts.preset
===================================================================
--- linux-lts.preset	2012-08-08 16:01:32 UTC (rev 165003)
+++ linux-lts.preset	2012-08-08 16:50:11 UTC (rev 165004)
@@ -1,4 +1,4 @@
-# mkinitcpio preset file for the 'linux' package
+# mkinitcpio preset file for the 'linux-lts' package
 
 ALL_config="/etc/mkinitcpio.conf"
 ALL_kver="/boot/vmlinuz-linux-lts"




More information about the arch-commits mailing list