diff -Naur core/PKGBUILD mod/PKGBUILD --- core/PKGBUILD 2008-12-07 00:05:22.000000000 -0500 +++ mod/PKGBUILD 2008-12-07 15:59:44.000000000 -0500 @@ -1,9 +1,12 @@ # $Id: PKGBUILD 19603 2008-11-28 10:51:49Z tpowa $ # Maintainer: Tobias Powalowski # Maintainer: Thomas Baechler -pkgname=kernel26 +# pkgname=kernel26 # Build stock -ARCH kernel +# pkgname=kernel26-nb # Build kernel with a different name +pkgname=kernel26-eee +_kernelname=${pkgname:8} _basekernel=2.6.27 -pkgver=2.6.27.7 +pkgver=${_basekernel}.7 pkgrel=1 _patchname="patch-${pkgver}-${pkgrel}-ARCH" pkgdesc="The Linux Kernel and modules" @@ -37,16 +40,43 @@ build() { KARCH=x86 + # Change kernel name in kernel26.preset and kernel26.install + sed \ + -e "s/ALL_kver='.*/ALL_kver='${_basekernel}${_kernelname}'/g" \ + -i $startdir/kernel26.preset + if [ "${_kernelname}" == "" ]; then + sed \ + -e "s/KERNEL_NAME=.*/KERNEL_NAME=/g" \ + -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_basekernel}/g" \ + -i $startdir/kernel26.install + else + sed \ + -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \ + -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_basekernel}${_kernelname}/g" \ + -i $startdir/kernel26.install + fi + cd ${srcdir}/linux-$_basekernel + # Don't repatch if already patched. One can then use "makepkg -e" + if [[ ! -e _arch_patched ]]; then # Add -ARCH patches # See http://projects.archlinux.org/git/?p=linux-2.6-ARCH.git;a=summary patch -Np1 -i ${srcdir}/${_patchname} || return 1 + touch _arch_patched + else + msg "Already patched, skipping." + fi + msg "Patches done, continuating with compilation..." if [ "$CARCH" = "x86_64" ]; then cat ../config.x86_64 >./.config else cat ../config >./.config fi + # Change kernel name in config file + if [ "${_kernelname}" != "" ]; then + sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config + fi # build the full kernel version to use in pathnames . ./.config ### next line is only needed for rc kernels @@ -64,8 +94,9 @@ make bzImage modules || return 1 mkdir -p ${pkgdir}/{lib/modules,boot} make INSTALL_MOD_PATH=${pkgdir} modules_install || return 1 - cp System.map ${pkgdir}/boot/System.map26 - cp arch/$KARCH/boot/bzImage ${pkgdir}/boot/vmlinuz26 + cp System.map ${pkgdir}/boot/System.map26${_kernelname} + cp arch/$KARCH/boot/bzImage ${pkgdir}/boot/vmlinuz26${_kernelname} + cp .config ${pkgdir}/boot/config${_kernelname} install -D -m644 Makefile \ ${pkgdir}/usr/src/linux-${_kernver}/Makefile install -D -m644 kernel/Makefile \ @@ -140,10 +171,20 @@ cd ${pkgdir}/lib/modules/${_kernver} && \ (rm -f source build; ln -sf ../../../usr/src/linux-${_kernver} build) # install fallback mkinitcpio.conf file and preset file for kernel - install -m644 -D ${srcdir}/${pkgname}.preset ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset || return 1 - # set correct depmod command for install - sed -i -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" $startdir/kernel26.install + install -m644 -D ${srcdir}/kernel26.preset ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset || return 1 + sed \ + -e "s|source .*|source /etc/mkinitcpio.d/kernel26${_kernelname}.kver|g" \ + -e "s|ALL_kver=.*|ALL_kver='${_basekernel}${_kernelname}'|g" \ + -e "s|default_image=.*|default_image=\"/boot/${pkgname}.img\"|g" \ + -e "s|fallback_image=.*|fallback_image=\"/boot/${pkgname}-fallback.img\"|g" \ + -i ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset echo -e "# DO NOT EDIT THIS FILE\nALL_kver='${_kernver}'" > ${startdir}/pkg/etc/mkinitcpio.d/${pkgname}.kver # remove unneeded architectures rm -rf ${pkgdir}/usr/src/linux-${_kernver}/arch/{alpha,arm,arm26,avr32,blackfin,cris,frv,h8300,ia64,m32r,m68k,m68knommu,mips,mn10300,parisc,powerpc,ppc,s390,sh,sh64,sparc,sparc64,um,v850,xtensa} + + # If not default kernel, remove firmwares since -ARCH will + # provide them. + if [ "${_kernelname}" != "" ]; then + rm -fr ${pkgdir}/lib/firmware + fi } diff -Naur core/kernel26.install mod/kernel26.install --- core/kernel26.install 2008-12-07 00:05:22.000000000 -0500 +++ mod/kernel26.install 2008-12-07 15:59:44.000000000 -0500 @@ -1,6 +1,7 @@ # arg 1: the new package version # arg 2: the old package version +KERNEL_NAME= KERNEL_VERSION=2.6.27-ARCH post_install () { @@ -16,7 +17,7 @@ echo ">>> http://wiki.archlinux.org/index.php/Mkinitcpio" echo "" echo ">>> Generating initial ramdisk, using mkinitcpio. Please wait..." - /sbin/mkinitcpio -p kernel26 + /sbin/mkinitcpio -p kernel26${KERNEL_NAME} } post_upgrade() { @@ -88,8 +89,8 @@ echo ">>> Please change your bootloader config files:" echo ">>> Grub: /boot/grub/menu.lst | Lilo: /etc/lilo.conf" echo "------------------------------------------------" - echo "| - initrd26.img to kernel26.img |" - echo "| - initrd26-full.img to kernel26-fallback.img |" + echo "| - initrd26.img to kernel26${KERNEL_NAME}.img |" + echo "| - initrd26-full.img to kernel26${KERNEL_NAME}-fallback.img |" echo "------------------------------------------------" fi if [ "`vercmp $2 2.6.19`" -lt 0 ]; then @@ -121,11 +122,11 @@ echo "" echo ">>> Generating initial ramdisk, using mkinitcpio. Please wait..." if [ "`vercmp $2 2.6.19`" -lt 0 ]; then - /sbin/mkinitcpio -p kernel26 -m "ATTENTION:\nIf you get a kernel panic below + /sbin/mkinitcpio -p kernel26${KERNEL_NAME} -m "ATTENTION:\nIf you get a kernel panic below and are using an Intel chipset, append 'earlymodules=piix' to the kernel commandline" else - /sbin/mkinitcpio -p kernel26 + /sbin/mkinitcpio -p kernel26${KERNEL_NAME} fi if [ "`vercmp $2 2.6.21`" -lt 0 ]; then echo "" diff -Naur core/kernel26.preset mod/kernel26.preset --- core/kernel26.preset 2008-12-07 00:05:22.000000000 -0500 +++ mod/kernel26.preset 2008-12-07 15:59:44.000000000 -0500 @@ -4,6 +4,7 @@ # DO NOT EDIT THIS LINE: source /etc/mkinitcpio.d/kernel26.kver ######################################## +ALL_kver='2.6.27' ALL_config="/etc/mkinitcpio.conf" PRESETS=('default' 'fallback') @@ -14,4 +15,4 @@ #fallback_config="/etc/mkinitcpio.conf" fallback_image="/boot/kernel26-fallback.img" -fallback_options="-S autodetect" \ No newline at end of file +fallback_options="-S autodetect"