All pastes #739317 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-10-17 01:35 UTC
rendered paste body
# Contributor: Patrick Bartels <p4ddy.b@gmail.com>

# If you want to use ndiswrapper on a i686 system, you have to disable 4k stack sizes
_disable_4kstacks=0

# Skip the menuconfig thing
_skip_menuconfig=1

pkgname='kernel26server'
pkgver='2.6.23.1'
pkgrel='1'
_basekernel='2.6.23'
_revision='2.6.23.1'
_system='server'
pkgdesc='The Linux Kernel and modules with some patches'
url='http://kamikaze.waninkoko.info/'
arch=('i686' 'x86_64')
license=('GPL2')
backup=('boot/kconfig26server' "etc/mkinitcpio.d/$pkgname.preset")
depends=('module-init-tools' 'mkinitcpio>=0.5.13')
install=kernel26$_system.install
source=(http://kernel.org/pub/linux/kernel/v2.6/linux-$_basekernel.tar.bz2
	http://dev.gentoo.org/~spock/projects/uvesafb/archive/uvesafb-0.1-rc3-2.6.23-rc3.patch
        http://kamikaze.waninkoko.info/patches/2.6.23/kamikaze2/broken-out/cpufreq-allow-ondemand-and-conservative-cpufreq-governors-to-be-used-as-default.patch
        http://kamikaze.waninkoko.info/patches/2.6.23/kamikaze2/broken-out/allow-ondemand-and-conservative-cpufreq-governors-to-be-used-as-default-kconfig-fix.patch
        http://kamikaze.waninkoko.info/patches/2.6.23/kamikaze2/broken-out/cpu-support-rollup-2.6.23.patch
        http://kamikaze.waninkoko.info/patches/2.6.23/kamikaze2/broken-out/edac-2.6.23-for-2.6.23.patch
        http://kamikaze.waninkoko.info/patches/2.6.23/kamikaze2/broken-out/enable-4k-stacks-default-2.6.23.patch
        http://kamikaze.waninkoko.info/patches/2.6.23/kamikaze2/broken-out/hrtimers-2.6.23.patch
        http://kamikaze.waninkoko.info/patches/2.6.23/kamikaze2/broken-out/hz-432-kconfig-option.patch
        http://kamikaze.waninkoko.info/patches/2.6.23/kamikaze2/broken-out/iwlwifi-1.1.17-2.6.23.patch
        http://kamikaze.waninkoko.info/patches/2.6.23/kamikaze2/broken-out/powertop-2.6.23.patch
        http://kamikaze.waninkoko.info/patches/2.6.23/kamikaze2/broken-out/reiser4-2.6.23-1.patch
        http://www.grsecurity.net/test/grsecurity-2.1.11-2.6.23-200710121810.patch
	http://www.eu.kernel.org/pub/linux/kernel/v2.6/patch-$_revision.bz2
        logo_linux_clut224.ppm
        logo_linux_mono.pbm
        logo_linux_vga16.ppm
        $pkgname.preset
        mkinitcpio-$pkgname.conf
        config-$_system)
md5sums=('2cc2fd4d521dc5d7cfce0d8a9d1b3472'
	 '245c9871a01fb6eeb6cd218c5d14a62b'
	 'd199ee9552f653342c6e96c3f16108f0'
	 'e5989a5cbb6486bc2a1764aa8b837c15'
	 '741b9ed9c16ec1502af16c9af578926e'
	 'ceb60885a166bf01be49964d768f840f'
	 'a0b48f4e284c33e6fc76bc5c1bef6cae'
	 '699d134dc09ec1116867f5b8796265bb'
	 'c7da91c8e251bead6f1f51eb06895857'
	 '5bd25abbf794c3c6c003b7116d34bce5'
	 'fc2a54f9bbea1f7c95a81769074bd327'
	 'f0984eaf310c93b96f1cfe72d7a7dcf2'
	 '5a84d89ec5880dda94ae847ba7eee366'
	 '896c5d4e7fd68d37b8c16e5d2842563b'
         '5a62bcc7e96601052c7405459b483826'
         'ed6b42fea2f5d27f7eb920746ccc1ebb'
         'a995ec849ea43d3c89d607bbdd1e7d09'
         '8d012a58c576f8f170be3fd10e6a4f4a'
         '75670775fb861fa1d0af62c651ddad0d'
         'e561dbde83aa4fc41ad31a31a2f63190')

build() {
  [ "$CARCH" = "i686" ]   && KARCH=i386
  [ "$CARCH" = "x86_64" ] && KARCH=x86_64
  cd $startdir/src/linux-$_basekernel
  
  # Broken out patches from the Kamikaze patchset
  msg "Applying cpu frequency patches"
  patch -Nsp1 -i ../cpufreq-allow-ondemand-and-conservative-cpufreq-governors-to-be-used-as-default.patch || return 1
  patch -Nsp1 -i ../allow-ondemand-and-conservative-cpufreq-governors-to-be-used-as-default-kconfig-fix.patch || return 1
  msg "Applying cpu support patch"
  patch -Nsp1 -i ../cpu-support-rollup-2.6.23.patch || return 1
  msg "Applying edac patch"
  patch -Nsp1 -i ../edac-2.6.23-for-2.6.23.patch || return 1
  msg "Applying 4k stacks patch"
  patch -Nsp1 -i ../enable-4k-stacks-default-2.6.23.patch || return 1
  msg "Applying hi-res timers patch"
  patch -Nsp1 -i ../hrtimers-2.6.23.patch || return 1
  msg "Applying powertop patch"
  patch -Nsp1 -i ../powertop-2.6.23.patch || return 1
  msg "Applying reiser4 patch"
  patch -Nsp1 -i ../reiser4-2.6.23-1.patch || return 1
  msg "Applying grsecurity patch"
  patch -Nsp1 -i ../grsecurity-2.1.11-2.6.23-200710121810.patch || return 1

  # Latest kernel patch
  msg "Applying kernel $_revision patchset"
  patch -Nsp1 -i ../patch-$_revision || return 1
  
  # 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/

  # Config stuff
  if [ -e $startdir/config-$_system ]; then
    cat $startdir/config-$_system > ./.config
  elif [ "$CARCH" = "x86_64" ]; then
    cat ../config.x86_64 > ./.config
  else
    cat ../config > ./.config
  fi

  # Build the full kernel version to use in pathnames
  . ./.config
  _kernver="$_revision-$_system"
  
  # Load configuration
  msg "Loading configuration"
  yes "" | make config

  if [ "$CARCH" = "i686" ] && [ "$_disable_4kstacks" = "1" ]; then
    sed -i "s/CONFIG_4KSTACKS=y/# CONFIG_4KSTACKS is not set/" .config
  fi
  
  msg "Opening menuconfig"
  [ "$_skip_menuconfig" = "1" ] || make gconfig
	
  # Build!
  msg "Building the kernel"
  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.map26server	
  cp arch/$KARCH/boot/bzImage $startdir/pkg/boot/vmlinuz26server
  
  msg "Installing additional files"
  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/kconfig26server
  
  mkdir -p $startdir/pkg/usr/src/linux-$_kernver/include

  for i in acpi asm-{generic,i386,x86_64} 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
  msg2 'Fixing permissions'
  chmod og-w -R $startdir/pkg/usr/src/linux-$_kernver/scripts
  # mkdir -p $startdir/pkg/usr/src/linux-$_kernver/.tmp_versions

  mkdir -p $startdir/pkg/usr/src/linux-$_kernver/arch/$KARCH/kernel
  
  cp arch/$KARCH/Makefile $startdir/pkg/usr/src/linux-$_kernver/arch/$KARCH/
  if [ "$CARCH" = "i686" ]; then
    cp arch/$KARCH/Makefile.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
  msg2 'Adding headers'
  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
  msg2 'Adding 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
  msg2 'Adding 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
  msg2 'Adding 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

  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)
  
  # For binary modules make prepare, not needed anymore in .22 kernels
  # cd $startdir/pkg/lib/modules/$_kernver/build
  # make prepare
  
  # Install fallback mkinitcpio.conf file and preset file for kernel
  msg2 'Installing mkinitcpio.conf and preset file for kernel'
  install -m644 -D $startdir/src/$pkgname.preset $startdir/pkg/etc/mkinitcpio.d/$pkgname.preset || return 1
  install -m644 -D $startdir/src/mkinitcpio-$pkgname.conf $startdir/pkg/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/kernel26server.install
  echo -e "# DO NOT EDIT THIS FILE\nALL_kver='$_kernver'" > $startdir/pkg/etc/mkinitcpio.d/$pkgname.kver
  
  # Remove unneeded architectures
  msg2 'Removing unneeded architectures'
  rm -rf $startdir/pkg/usr/src/linux-$_kernver/arch/{alpha,arm,arm26,avr32,blackfin,cris,frv,h8300,ia64,m32r,m68k,m68knommu,mips,parisc,powerpc,ppc,s390,sh,sh64,sparc,sparc64,um,v850,xtensa}
}