# $Id: PKGBUILD,v 1.224 2007/05/06 18:54:10 tpowa Exp $ # Maintainer: judd pkgname=kernel26 _basekernel=2.6.21 pkgver=2.6.21.1 pkgrel=8 pkgdesc="The Linux Kernel and modules" arch=(i686 x86_64) url="http://www.kernel.org" backup=('boot/kconfig26' etc/mkinitcpio.d/${pkgname}.preset) depends=('module-init-tools' 'mkinitcpio>=0.5.13') # pwc, ieee80211 and hostap-driver26 modules are included in kernel26 now # nforce package support was abandoned by nvidia, kernel modules should cover everything now. # kernel24 support is dropped since glibc24 replaces=('kernel24' 'kernel24-scsi' 'kernel26-scsi' 'alsa-driver' 'ieee80211' 'hostap-driver26' 'pwc' 'nforce' 'squashfs' 'unionfs' ) install=kernel26.install # common sources and md5sums _common_source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$_basekernel.tar.bz2 ftp://ftp.kernel.org/pub/linux/kernel/v2.6/patch-$pkgver.bz2 logo_linux_clut224.ppm logo_linux_mono.pbm logo_linux_vga16.ppm acpi-dsdt-initrd-v0.8.4-2.6.21.patch toshiba-bluetooth.patch toshiba-acpi.patch usb-storage-unusual-devs.patch mactel-linux-2.6.21.patch coretemp.patch atkbd.patch alsa-20070506.patch.bz2 alsa-include.patch.bz2 patch_realtek.patch sis900.patch zd1211.patch acpi-buggy-bios.patch bluetooth-alsa.patch revert_sky2.patch http://heanet.dl.sourceforge.net/sourceforge/squashfs/squashfs3.2-r2.tar.gz ftp://ftp.fsl.cs.sunysb.edu/pub/unionfs/unionfs-2.x/linux-2.6.21-u2.diff.gz) _common_md5sums=('1b515f588078dfa7f4bab2634bd17e80' 'c4c368f173af267a564948065ffc1689'\ '5a62bcc7e96601052c7405459b483826' 'ed6b42fea2f5d27f7eb920746ccc1ebb'\ 'a995ec849ea43d3c89d607bbdd1e7d09' '493137566bc397ec762c86e64bd96849'\ '695d8578a0334fa9bb140917561f03d4' 'f6978eca251dfca21ffa46f1169583a4'\ '3ed791c3af3099489faf0d22cbcc55a8' '55e6fb0b0778db4ffea45c75565e1f28'\ '197453581bf03bd8f6cb50a4cbcc8685' '3f72c692c7c9cf596680bc3ce0cb84ec'\ '9db585806016b338a11886b2cbba84de' '5e00933ee60f7e1af44225e785de6820'\ '00bc768e40b48bbbcea4466289af29fc' 'f0c3200fde468a1ed37b363f0fb60c9c'\ 'bec19952e53d01fc5f4e6f48ce3fa856' 'bbc730a590d4e09b3d937b257e5a4bfe'\ 'b68adb3c52eeff2d441ca41c380382b7' '34980076fbd8e745d9345b42f6457fa4'\ 'bf360b92eba9e6d5610196ce2e02fcd1' '4964894a3f406d600226b62de570605b') # define subpackages here subpkgs=('kernel26suspend2') # main package source=(${_common_source[*]} config config.x86_64 kernel26.preset mkinitcpio-$pkgname.conf) md5sums=(${_common_md5sums[*]}\ 'dd0ab2770aa77868a0ca73822daecdfe' '89af4e2eceaf6e0c2d01567438fcc961'\ '2365779022389399c5c705004cdbc583' '36858bd6a0bca63d2aa901b2e42d4a05') # suspend2 subpackage pkgname_suspend2='kernel26suspend2' backup_suspend2=('etc/mkinitcpio.d/kernel26suspend2-fallback.conf' \ 'etc/mkinitcpio.d/kernel26suspend2.preset') depends_suspend2=('module-init-tools' 'mkinitcpio>=0.5.13') install_suspend2=$install source_suspend2=(${_common_source[*]} config_suspend2 config_suspend2.x86_64 kernel26suspend2.preset mkinitcpio-kernel26suspend2.conf http://www.suspend2.net/downloads/all/suspend2-2.2.9.15-for-2.6.21.patch.bz2 http://www.tud.ttu.ee/~t030562/nobile/include/cpufreq-speedstep-dothan-3.patch) md5sums_suspend2(${_common_md5sums[*]}\ 'f0abc87ea8f2894b08b527009cb747d2' 'e0c94fe663dca9f6ba510a0d563acc6c'\ 'e140dce8ad579f30f6f721c78209c7fe' '2f922c5d8bea6bcbb17983daa68f348f'\ '6b487092ae4396db71d63cc9945be861' 'eb57406fe52ff1c078978ca8956e914a') _common_build() { [ "${CARCH}" = "i686" ] && KARCH=i386 [ "${CARCH}" = "x86_64" ] && KARCH=x86_64 cd $_srcdir/linux-$_basekernel # add upstream patch from 2.6.21 series patch -Np1 -i ../patch-$pkgver || return 1 # add acpi custom dsdt patch patch -Np1 -i ../acpi-dsdt-initrd-v0.8.4-2.6.21.patch || return 1 # fix enabling of bluetooth on some toshiba notebooks patch -Np1 -i ../toshiba-bluetooth.patch || return 1 # fix hotkeys on some toshiba notebooks patch -Np1 -i ../toshiba-acpi.patch || return 1 # fix I/O errors with Teac HD-35PU devices patch -Np1 -i ../usb-storage-unusual-devs.patch || return 1 # add mactel patch patch -Np1 -i ../mactel-linux-2.6.21.patch || return 1 # add coretemp and additional sensors patch -Np1 -i ../coretemp.patch || return 1 # fix atkbd issue on some laptops patch -Np1 -i ../atkbd.patch || return 1 # add latest alsa fixes ftp://ftp.suse.com/pub/projects/alsa/snapshot/driver/ # status is 20070506! patch -Np1 -i ../alsa-20070506.patch || return 1 patch -Np0 -i ../alsa-include.patch || return 1 # fix patch_realtek for new asus and lenovo patch -Np1 -i ../patch_realtek.patch || return 1 # fix sis900 oops patch -Np1 -i ../sis900.patch || return 1 # fix zd1211 driver to support more cards patch -Np1 -i ../zd1211.patch || return 1 # fix buggy bios acpi to get c states patch -Np1 -i ../acpi-buggy-bios.patch || return 1 # revert sky2 change, it breaks some nics that actually work fine, sigh patch -Rp1 -i ../revert_sky2.patch || return 1 # fix alsa bluetooth, http://bluetooth-alsa.cvs.sourceforge.net/bluetooth-alsa/plugz/patches/ patch -Np1 -i ../bluetooth-alsa.patch || return 1 # add sqashfs patch -Np1 -i ../squashfs3.2-r2/kernel-patches/linux-2.6.20/squashfs3.2-patch || return 1 # add unionfs patch -Np1 -i ../linux-2.6.21-u2.diff || return 1 # remove the extraversion from Makefile sed -i 's|^EXTRAVERSION = .*$|EXTRAVERSION =|g' Makefile # Arch logo! cp ../logo_linux_clut224.ppm drivers/video/logo/ cp ../logo_linux_mono.pbm drivers/video/logo/ cp ../logo_linux_vga16.ppm drivers/video/logo/ if [ "$CARCH" = "x86_64" ]; then cat ../${_config_x86_64} >./.config else # get rid of the 'i' in i686 carch=`echo $CARCH | sed 's|i||'` cat ../${_config} | sed "s|#CARCH#|$carch|g" >./.config fi # build the full kernel version to use in pathnames . ./.config _kernver="${_basekernel}${CONFIG_LOCALVERSION}" # load configuration yes "" | make config # build! 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 install -D -m644 Makefile \ $_pkgdir/usr/src/linux-${_kernver}/Makefile install -D -m644 kernel/Makefile \ $_pkgdir/usr/src/linux-${_kernver}/kernel/Makefile install -D -m644 .config \ $_pkgdir/usr/src/linux-${_kernver}/.config install -D -m644 .config $_pkgdir/boot/kconfig26 mkdir -p $_pkgdir/usr/src/linux-${_kernver}/include mkdir -p $_pkgdir/usr/src/linux-${_kernver}/arch/$KARCH/kernel for i in acpi asm-generic asm-$KARCH config linux math-emu media net pcmcia scsi sound video; do cp -a include/$i $_pkgdir/usr/src/linux-${_kernver}/include/ done # copy files necessary for later builds, like nvidia and vmware cp Module.symvers $_pkgdir/usr/src/linux-${_kernver} cp -a scripts $_pkgdir/usr/src/linux-${_kernver} # fix permissions on scripts dir chmod og-w -R $_pkgdir/usr/src/linux-${_kernver}/scripts mkdir -p $_pkgdir/usr/src/linux-${_kernver}/.tmp_versions cp arch/$KARCH/Makefile $_pkgdir/usr/src/linux-${_kernver}/arch/$KARCH/ if [ "$CARCH" = "i686" ]; then cp arch/$KARCH/Makefile.cpu $_pkgdir/usr/src/linux-${_kernver}/arch/$KARCH/ fi cp arch/$KARCH/kernel/asm-offsets.s $_pkgdir/usr/src/linux-${_kernver}/arch/$KARCH/kernel/ # add headers for lirc package mkdir -p $_pkgdir/usr/src/linux-${_kernver}/drivers/media/video cp drivers/media/video/*.h $_pkgdir/usr/src/linux-${_kernver}/drivers/media/video/ for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102 usbvideo zc0301; do mkdir -p $_pkgdir/usr/src/linux-${_kernver}/drivers/media/video/$i cp -a drivers/media/video/$i/*.h $_pkgdir/usr/src/linux-${_kernver}/drivers/media/video/$i done # add dm headers mkdir -p $_pkgdir/usr/src/linux-${_kernver}/drivers/md cp drivers/md/*.h $_pkgdir/usr/src/linux-${_kernver}/drivers/md # add inotify.h mkdir -p $_pkgdir/usr/src/linux-${_kernver}/include/linux cp include/linux/inotify.h $_pkgdir/usr/src/linux-${_kernver}/include/linux/ # add CLUSTERIP file for iptables mkdir -p $_pkgdir/usr/src/linux-${_kernver}/net/ipv4/netfilter/ cp net/ipv4/netfilter/ipt_CLUSTERIP.c $_pkgdir/usr/src/linux-${_kernver}/net/ipv4/netfilter/ # add vmlinux cp vmlinux $_pkgdir/usr/src/linux-${_kernver} # copy in Kconfig files for i in `find . -name "Kconfig*"`; do mkdir -p $_pkgdir/usr/src/linux-${_kernver}/`echo $i | sed 's|/Kconfig.*||'` cp $i $_pkgdir/usr/src/linux-${_kernver}/$i done if [ "${KARCH}" = "i386" ]; then mkdir ${_pkgdir}/usr/src/linux-${_kernver}/include/asm-x86_64 cp -a include/asm-x86_64/tsc.h ${_pkgdir}/usr/src/linux-${_kernver}/include/asm-x86_64 else mkdir ${_pkgdir}/usr/src/linux-${_kernver}/include/asm-i386 cp -a include/asm-i386/tsc.h ${_pkgdir}/usr/src/linux-${_kernver}/include/asm-i386 fi cd $_pkgdir/usr/src/linux-${_kernver}/include && ln -s asm-$KARCH asm chown -R root.root $_pkgdir/usr/src/linux-${_kernver} cd $_pkgdir/lib/modules/${_kernver} && \ (rm -f source build; ln -sf ../../../usr/src/linux-${_kernver} build) # for binary modules make prepare cd $_pkgdir/lib/modules/${_kernver}/build make prepare # install fallback mkinitcpio.conf file and preset file for kernel install -m644 -D $_srcdir/${_pkgname}.preset $_pkgdir/etc/mkinitcpio.d/${_pkgname}.preset || return 1 install -m644 -D $_srcdir/mkinitcpio-${_pkgname}.conf $_pkgdir/etc/mkinitcpio.d/${_pkgname}-fallback.conf || return 1 # set correct depmod command for install sed -i -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" $startdir/kernel26.install echo -e "# DO NOT EDIT THIS FILE\nALL_kver='${_kernver}'" > ${_pkgdir}/etc/mkinitcpio.d/${_pkgname}.kver } build() { local _pkgdir=$startdir/pkg local _srcdir=$startdir/src local _config='config' local _config_x86_64='config.x86_64' local _pkgname=$pkgname _common_build } # NOTE: each subpackage that has a "build_foo" will have separate "src_foo" directory build_suspend2() { local _pkgdir=$startdir/pkg_suspend2 local _srcdir=$startdir/src_suspend2 local _config='config_suspend2' local _config_x86_64='config_suspend2.x86_64' local _pkgname=${pkgname_suspend2} # Apply suspend2 specific patches cd $_srcdir/linux-${_basekernel} # add suspend2 support patch -Np1 -i ../suspend2-2.2.9.15-for-2.6.21.patch || return 1 # Add dothan speedstep support patch -Np1 -i ../cpufreq-speedstep-dothan-3.patch || return _common_build }