# $Id: PKGBUILD 82 2009-07-17 19:56:55Z aaron $ # Maintainer: Sergej Pupykin pkgname=selinux-kernel26 pkgver=2.6.30 _kernver=2.6.30-selinux pkgrel=1 pkgdesc="The Linux Kernel and modules" arch=(i686 x86_64) license=('GPL2') url="http://www.kernel.org" backup=(boot/kconfig26-selinux etc/mkinitcpio.d/kernel26-selinux.preset) depends=('module-init-tools' 'mkinitcpio') install=kernel26.install source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$pkgver.tar.bz2 config config.x86_64 kernel26-selinux.preset mkinitcpio-kernel26-selinux.conf) build() { [ "${CARCH}" = "i686" ] && KARCH=x86 [ "${CARCH}" = "x86_64" ] && KARCH=x86 cd $startdir/src/linux-$pkgver # remove the extraversion from Makefile sed -i 's|^EXTRAVERSION = .*$|EXTRAVERSION =|g' Makefile 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 # load configuration yes "" | make config # build! make bzImage modules || return 1 mkdir -p $startdir/pkg/{lib/modules,boot} make INSTALL_MOD_PATH=$startdir/pkg modules_install || return 1 cp System.map $startdir/pkg/boot/System.map26-selinux cp arch/$KARCH/boot/bzImage $startdir/pkg/boot/vmlinuz26-selinux # for binary modules make prepare cd $startdir/pkg/lib/modules/${_kernver}/build make prepare # install fallback mkinitcpio.conf file and preset file for kernel install -m644 -D $startdir/src/kernel26-selinux.preset $startdir/pkg/etc/mkinitcpio.d/kernel26-selinux.preset || return 1 install -m644 -D $startdir/src/mkinitcpio-kernel26-selinux.conf $startdir/pkg/etc/mkinitcpio.d/kernel26-selinux-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}'" > ${startdir}/pkg/etc/mkinitcpio.d/kernel26-selinux.kver ######## install -D -m644 Makefile \ $startdir/pkg/usr/src/linux-${_kernver}/Makefile install -D -m644 kernel/Makefile \ $startdir/pkg/usr/src/linux-${_kernver}/kernel/Makefile install -D -m644 .config \ $startdir/pkg/usr/src/linux-${_kernver}/.config install -D -m644 .config $startdir/pkg/boot/kconfig26-selinux mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/include mkdir -p $startdir/pkg/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 $startdir/pkg/usr/src/linux-${_kernver}/include/ done # copy files necessary for later builds, like nvidia and vmware cp Module.symvers $startdir/pkg/usr/src/linux-${_kernver} cp -a scripts $startdir/pkg/usr/src/linux-${_kernver} # fix permissions on scripts dir chmod og-w -R $startdir/pkg/usr/src/linux-${_kernver}/scripts mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/.tmp_versions cp arch/$KARCH/Makefile $startdir/pkg/usr/src/linux-${_kernver}/arch/$KARCH/ if [ "$CARCH" = "i686" ]; then cp arch/$KARCH/Makefile_32.cpu $startdir/pkg/usr/src/linux-${_kernver}/arch/$KARCH/ fi cp arch/$KARCH/kernel/asm-offsets.s $startdir/pkg/usr/src/linux-${_kernver}/arch/$KARCH/kernel/ # add headers for lirc package mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/drivers/media/video cp drivers/media/video/*.h $startdir/pkg/usr/src/linux-${_kernver}/drivers/media/video/ for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102 usbvideo zc0301; do mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/drivers/media/video/$i cp -a drivers/media/video/$i/*.h $startdir/pkg/usr/src/linux-${_kernver}/drivers/media/video/$i done # add dm headers mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/drivers/md cp drivers/md/*.h $startdir/pkg/usr/src/linux-${_kernver}/drivers/md # add inotify.h mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/include/linux cp include/linux/inotify.h $startdir/pkg/usr/src/linux-${_kernver}/include/linux/ # add CLUSTERIP file for iptables mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/net/ipv4/netfilter/ cp net/ipv4/netfilter/ipt_CLUSTERIP.c $startdir/pkg/usr/src/linux-${_kernver}/net/ipv4/netfilter/ # add wireless headers mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/net/mac80211/ cp net/mac80211/*.h $startdir/pkg/usr/src/linux-${_kernver}/net/mac80211/ # add vmlinux cp vmlinux $startdir/pkg/usr/src/linux-${_kernver} # copy in Kconfig files for i in `find . -name "Kconfig*"`; do mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/`echo $i | sed 's|/Kconfig.*||'` cp $i $startdir/pkg/usr/src/linux-${_kernver}/$i done # selinux headers mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/security/selinux && \ cp -ar security/selinux/include $startdir/pkg/usr/src/linux-${_kernver}/security/selinux/ if [ "${CARCH}" = "i686" ]; then cp -a include/asm-$KARCH/{tsc,msr-index,processor-flags}.h ${startdir}/pkg/usr/src/linux-${_kernver}/include/asm-$KARCH else cp -a include/asm-$KARCH/tsc.h ${startdir}/pkg/usr/src/linux-${_kernver}/include/asm-$KARCH fi cd $startdir/pkg/usr/src/linux-${_kernver}/include && ln -s asm-$KARCH asm chown -R root.root $startdir/pkg/usr/src/linux-${_kernver} find $startdir/pkg/usr/src/linux-${_kernver} -type d -exec chmod 755 {} \; cd $startdir/pkg/lib/modules/${_kernver} && \ (rm -f source build; ln -sf ../../../usr/src/linux-${_kernver} build) && \ rm -rf $pkgdir/lib/firmware }