Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

linux-pf PKGBUILD

By: Thaodan on Nov 6th, 2012  |  syntax: Bash  |  size: 23.14 KB  |  views: 102  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # Maintainer: Christos Nouskas <nous at archlinux dot us>
  2. # PKGBUILD assembled from kernel26
  3. # Some lines from  kernel26-bfs and kernel26-ck
  4. # Credits to respective maintainers
  5.  
  6. _major=3
  7. _minor=6
  8. #_patchlevel=0
  9. #_subversion=1
  10. _basekernel=${_major}.${_minor}
  11. _srcname=linux-${_major}.${_minor}
  12. pkgbase=linux-pf
  13. _pfrel=8
  14. _kernelname=-pf
  15. _pfpatchhome="http://pf.natalenko.name/sources/${_basekernel}/"
  16. _pfpatchname="patch-${_basekernel}.${_pfrel}${_kernelname}"
  17.  
  18. pkgname=('linux-pf')
  19. true && pkgname=('linux-pf' 'linux-pf-headers')
  20. pkgver=${_basekernel}.${_pfrel}
  21. pkgrel=1
  22. arch=('i686' 'x86_64')
  23. url="http://pf.natalenko.name/"
  24. license=('GPL2')
  25. options=('!strip')
  26. makedepends=('git' 'xmlto' 'docbook-xsl' 'xz')
  27. source=("ftp://www.kernel.org/pub/linux/kernel/v${_major}.x/linux-${_basekernel}.tar.xz"
  28.         'config' 'config.x86_64'                # the main kernel config files
  29.         'linux-pf.preset'                       # standard config files for mkinitcpio ramdisk
  30.         'logo_linux_clut224.ppm.bz2'            #
  31.         'logo_linux_mono.pbm.bz2'               # the Arch Linux boot logos
  32.         'logo_linux_vga16.ppm.bz2'              #
  33.         "interactive-governor.tar.gz::https://gist.github.com/gists/1172524/download"
  34.         'change-default-console-loglevel.patch'
  35.         "${_pfpatchhome}${_pfpatchname}.bz2"    # the -pf patchset
  36.         "http://www.linuxforge.net/linux/kernel/kernel-33-gcc47-0.patch" )
  37.  
  38. _aufs3git="git://aufs.git.sourceforge.net/gitroot/aufs/aufs3-standalone.git"
  39. _aufs3name=aufs3
  40. # '
  41.  
  42. build() {
  43.   cd "${srcdir}/linux-${_basekernel}"
  44.   # This is for me, to test the PKGBUILD
  45. if [[ $NOEXTRACT = "0" ]]; then
  46.  
  47.      # Arch linux logo
  48.      msg "Replacing penguins with arches"
  49.      bzip2 -dk ${startdir}/logo_linux_*.bz2
  50.      mv -f ${startdir}/logo_linux_*.p?m drivers/video/logo/
  51.      msg "Applying pf-kernel patch"
  52.      patch -Np1 < ${srcdir}/${_pfpatchname}
  53.      msg "Fetching and applying aufs3 patches"
  54.      git clone ${_aufs3git} ${_aufs3name}
  55.      cd ${_aufs3name}
  56.      git checkout origin/aufs${_basekernel} || _aufs3checkout=KRAKRA
  57.      if [[ ${_aufs3checkout} = "KRAKRA" ]]; then
  58.         echo
  59.         msg "AUFS3 not yet ported to version ${_basekernel}!"
  60.         msg "Skipping related patches."
  61.         echo
  62.         cd ..
  63.      else
  64. #        mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include"
  65. #        mv include/linux/Kbuild "${pkgdir}/usr/src/linux-${_kernver}/include/"
  66.         rm include/linux/Kbuild
  67.         cd ..
  68.         cp -a ${_aufs3name}/{Documentation,fs,include} ${srcdir}/linux-${_basekernel}/
  69.         msg "Patching aufs3"
  70.         for _patch in ${_aufs3name}/*.patch; do
  71.             patch -Np1 < ${_patch} || _aufs3fail=KRAKRA
  72.         done
  73.         if [[ ${_aufs3fail} = "KRAKRA" ]]; then
  74.             echo
  75.             msg "Not all aufs3 patches applied correctly. Ignore this if you won't use AUFS."
  76.             msg "Otherwise, press CTRL-C now and fix manually"
  77.             echo
  78.         fi
  79.     fi
  80.  
  81.    # Interactive governor patch
  82.    # broken for now
  83.    #   msg "Interactice CPU governor patch"
  84.    #   mv ${srcdir}/gist*/gistfile1.diff ${srcdir}
  85.    #   patch -Np1 < ${srcdir}/gistfile1.diff
  86.  
  87.   # linux-ARCH patches
  88.  
  89.   # add latest fixes from stable queue, if needed
  90.   # http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
  91.  
  92.   # set DEFAULT_CONSOLE_LOGLEVEL to 4 (same value as the 'quiet' kernel param)
  93.   # remove this when a Kconfig knob is made available by upstream
  94.   # (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227)
  95.   patch -Np1 -i "${srcdir}/change-default-console-loglevel.patch"
  96.  
  97.   # end linux-ARCH patches
  98.  
  99.  
  100.  
  101.   # added gcc 4.7 support for Kconfig and menuconfig
  102.   patch -Np1 -i "${srcdir}/kernel-33-gcc47-0.patch"
  103.    if [ "$CARCH" = "x86_64" ]; then
  104.         cat "${startdir}/config.x86_64" >| .config
  105.    else
  106.         cat "${startdir}/config" >| .config
  107.    fi
  108. fi
  109.  
  110. #----------------------------------------
  111. if [[ "$_BATCH" != "y" ]]; then         # for batch building
  112.   echo
  113.   echo "======================================================="
  114.   msg "You might be prompted below for some config options"
  115.   echo "======================================================="
  116.   echo
  117.   msg "Hit <Y> to use your running kernel's config"
  118.   echo "    (needs IKCONFIG and IKCONFIG_PROC)"
  119.   msg "Hit <L> to run 'make localmodconfig'"
  120.   msg "Hit <N> (or just <ENTER>) to build an all-inclusive kernel like stock -ARCH"
  121.   echo "    (warning: it can take a looong time)"
  122.   echo
  123.   read answer
  124.   shopt -s nocasematch
  125.   if [[ "$answer" = "y" ]]; then
  126.      if [[ -s /proc/config.gz ]]; then
  127.         msg "Extracting config from /proc/config.gz..."
  128.         zcat /proc/config.gz >| ./.config
  129.      else
  130.         msg "running 'sudo modprobe configs'"
  131.         sudo modprobe configs
  132.         if [[ -s /proc/config.gz ]]; then
  133.             msg "Extracting config from /proc/config.gz..."
  134.             zcat /proc/config.gz >| ./.config
  135.         else
  136.             msg "You kernel was not compiled with IKCONFIG_PROC."
  137.             msg "Attempting to run /usr/bin/modprobed_db recall from modprobe_db..."
  138.             if [ -e /usr/bin/modprobed_db ]; then
  139.                 sudo /usr/bin/modprobed_db recall
  140. -           else
  141. -               msg "modprobed_db not installed, running make localmodconfig instead..."
  142. -               make localmodconfig
  143.             fi
  144.         fi
  145.      fi
  146.   elif [[ "$answer" = "l" ]]; then
  147.      # Copied from kernel26-ck's PKGBUILD
  148.      msg "Attempting to run /usr/bin/reload_database with sudo from modprobe_db..."
  149.      if [ -e /usr/bin/modprobed_db ]; then
  150.         sudo /usr/bin/modprobed_db recall
  151.      fi
  152.      msg "Running 'make localmodconfig'..."
  153.      make localmodconfig
  154.   else
  155.      msg "Using stock ARCH kernel .config (with BFS, BFQ and TuxOnIce enabled)."
  156.   fi
  157.  
  158.   # Make some good use of MAKEFLAGS
  159.   # MAKEFLAGS=`grep -v '#' /etc/makepkg.conf | grep MAKEFLAGS= | sed s/MAKEFLAGS=// | sed s/\"//g`
  160.  
  161.   # make prepare
  162.  
  163.   # Options for additional configuration
  164.   echo
  165.   msg "Kernel configuration options before build:"
  166.   echo "    <M> make menuconfig (console menu)"
  167.   echo "    <N> make nconfig (newer alternative to menuconfig)"
  168.   echo "    <G> make gconfig (needs gtk)"
  169.   echo "    <X> make xconfig (needs qt)"
  170.   echo "    <O> make oldconfig"
  171.   echo "    <L> make localyesconfig"
  172.   echo "    <ENTER> to skip configuration and start compiling"
  173.   read answer
  174.   case "$answer" in
  175.    m) make menuconfig
  176.       ;;
  177.    g) make gconfig
  178.       ;;
  179.    x) make xconfig
  180.       ;;
  181.    n) make nconfig
  182.       ;;
  183.    o) make oldconfig
  184.       ;;
  185.    l) make localyesconfig
  186.       ;;
  187.    default)
  188.       ;;
  189.   esac
  190.   cp -v .config ${startdir}/config.local
  191.   CPU=`egrep "MK8=y|MCORE2=y|MPSC=y|MATOM=y|MPENTIUMII=y|MPENTIUMIII=y|MPENTIUMM=y|MPENTIUM4=y|MK7=y|CONFIG_GENERIC_CPU=y|M686=y|MBARCELONA=y|MBOBCAT=y|MBULLDOZER=y|MPILEDRIVER=y|MCOREI7=y|MCOREI7AVX=y|MCOREAVXI=y|MCOREAVX2=y" ./.config`
  192.   CPU=`sed -e "s/CONFIG_M\(.*\)=y/\1/" <<<$CPU`
  193.   CPU=`sed -e "s/CONFIG_GENERIC_CPU=y/GENERIC/" <<<$CPU`
  194.   CPU=`sed -e "s/^686$/GENERIC/" <<<$CPU`
  195.   cp -v .config ${startdir}/config.$CPU-$CARCH
  196.  
  197.   # Give option to rename package according to CPU
  198.   echo
  199.   if [[ "$CPU" != "GENERIC" ]]; then
  200.     echo "=============================================================="
  201.     msg "An non-generic CPU was selected for this kernel."
  202.     echo
  203.     msg "Hit <G>     :  to create a generic package named linux-pf"
  204.     msg "Hit <ENTER> :  to create a package named after the selected CPU"
  205.     echo "                   (e.g. linux-pf-core2 - recommended)"
  206.     echo
  207.     msg "This option affects ONLY the package name. Whether or not the"
  208.     msg "kernel is optimized was determined at the previous config step."
  209.     echo "=============================================================="
  210.     read answer
  211.     shopt -s nocasematch
  212.     if [[ "$answer" != "g" ]]; then
  213.        export _PKGOPT=y
  214.     fi
  215.   fi
  216. fi      # batch check ends here
  217. export CPU
  218. #----------------------------------------
  219.  
  220.   # Strip config of uneeded localversion
  221.   if [ "${_kernelname}" != "" ]; then
  222.      sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"\"|g" ./.config
  223.   fi
  224.  
  225.   # Set EXTRAVERSION to -pf
  226.   sed -i "s/EXTRAVERSION = -${_pfrel}/EXTRAVERSION = ${_kernelname}/" Makefile
  227.   _arch=$CARCH
  228.  
  229.   # Remove the sublevel from Makefile
  230.   # This ensures our kernel version is always 3.X-pf
  231.   # This way, minor kernel updates will not break external modules
  232.   sed -ri 's|^(SUBLEVEL =).*|\1|' Makefile
  233.  
  234.   # Don't run depmod on 'make install'. We'll do this ourselves in packaging
  235.   sed -i '2iexit 0' scripts/depmod.sh
  236.  
  237.   # If the following is set, stop right there. We only need the headers for
  238.   # dependent drivers' compiling
  239.   [[ ${_NOBUILD} ]] && exit 0
  240.  
  241.   # Build
  242.   # Want extreme and non-sensical optimization? Uncomment the following line!
  243.   # export KCFLAGS="-march=native -Ofast"
  244.   make ${MAKEFLAGS} bzImage modules
  245. }
  246.  
  247. package_linux-pf() {
  248.  _pkgdesc="Linux kernel and modules with the pf-kernel patch [-ck patchset (BFS included), TuxOnIce, BFQ] and aufs3."
  249.  pkgdesc=${_pkgdesc}
  250.  groups=('base')
  251.  backup=(etc/mkinitcpio.d/${pkgbase}.preset)
  252.  depends=('coreutils' 'linux-firmware' 'kmod>=9-2' 'mkinitcpio>=0.7')
  253.  optdepends=('linux-docs: Kernel hackers manual - HTML documentation that comes with the Linux kernel.'
  254.             'crda: to set the correct wireless channels of your country'
  255.             'pm-utils: utilities and scripts for suspend and hibernate power management'
  256.             'tuxonice-userui: TuxOnIce userspace user interface'
  257.             'hibernate-script: set of scripts for managing TuxOnIce, hibernation and suspend to RAM'
  258.             'nvidia-pf: NVIDIA drivers for linux-pf'
  259.             'nvidia-beta-all: NVIDIA drivers for all installed kernels'
  260.             'modprobed_db: Keeps track of EVERY kernel module that has ever been probed. Useful for make localmodconfig.')
  261.  #provides=(${pkgbase}=${_basekernel} 'aufs3')  # for $pkgname-optimized
  262.  provides=(${pkgbase}=${_basekernel} 'aufs3')
  263.  # below 'provides' is for when you have no other kernel (which is a bad idea anyway)
  264.  # provides=(${pkgbase}=${_basekernel} 'linux=${pkgver}' 'aufs3')
  265.  # If generic build, then conflict with all optimized ones
  266.  conflicts=('linux-pf-core2' 'linux-pf-k8' 'linux-pf-psc' 'linux-pf-atom'
  267.             'linux-pf-k7' 'linux-pf-p3' 'linux-pf-pm' 'linux-pf-p4'
  268.             'linux-pf-headers-core2' 'linux-pf-headers-k8' 'linux-pf-headers-psc'
  269.             'linux-pf-headers-atom' 'linux-pf-headers-k7' 'linux-pf-headers-p3'
  270.             'linux-pf-headers-pm' 'linux-pf-headers-p4'
  271.             'kernel26-pf-core2' 'kernel26-pf-k8' 'kernel26-pf-psc' 'kernel26-pf-atom'
  272.             'kernel26-pf-k7' 'kernel26-pf-p3' 'kernel26-pf-pm' 'kernel26-pf-p4')
  273.  replaces=('kernel26-pf' 'aufs3')
  274.  install='linux-pf.install'
  275.  
  276.  #'
  277.   cd "${srcdir}/linux-${_basekernel}"
  278.  
  279.   # Remove undeeded aufs3 git tree
  280.   rm -fr aufs3 2>/dev/null
  281.  
  282.   # work around the AUR parser
  283.   # This allows building cpu-optimized packages with according package names.
  284.   # Useful for repo maintainers.
  285.  
  286.   headers="headers"
  287.   pkgnameopt="${pkgbase}"               # this MUST be outside the following 'if'
  288.   if [[ "$_PKGOPT" = "y" ]]; then       # package naming according to optimization
  289.     case $CPU in
  290.      CORE2)
  291.          pkgname="${pkgbase}-core2"
  292.          pkgdesc="${_pkgdesc} Intel Core2 optimized."
  293.          ;;
  294.      K8)
  295.          pkgname="${pkgbase}-k8"
  296.          pkgdesc="${_pkgdesc} AMD K8 optimized."
  297.          ;;
  298.      BARCELONA)
  299.          pkgname="${pkgbase}-barcelona"
  300.          pkgdesc="${_pkgdesc} AMD Barcelona optimized."
  301.          ;;
  302.      BOBCAT)
  303.          pkgname="${pkgbase}-bobcat"
  304.          pkgdesc="${_pkgdesc} AMD Bobcat optimized"
  305.          ;;
  306.      BULLDOZER)
  307.          pkgname"${pkgbase}-bulldozer"
  308.          pkgdesc="${_pkgdesc} AMD Bulldozer optimized"
  309.          ;;
  310.      PILEDRIVER)
  311.          pkgname"${pkgbase}-piledriver"
  312.          pkgdesc="${_pkgdesc} AMD Piledriver optimized"
  313.          ;;
  314.      PSC)
  315.          pkgname="${pkgbase}-psc"
  316.          pkgdesc="${_pkgdesc} Intel Pentium4/D/Xeon optimized."
  317.          ;;
  318.      ATOM)
  319.          pkgname="${pkgbase}-atom"
  320.          pkgdesc="${_pkgdesc} Intel Atom optimized."
  321.          ;;
  322.      K7)
  323.          pkgname="${pkgbase}-k7"
  324.          pkgdesc="${_pkgdesc} AMD K7 optimized."
  325.          ;;
  326.      PENTIUMII)
  327.          pkgname="${pkgbase}-p2"
  328.          pkgdesc="${_pkgdesc} Intel Pentium2 optimized."
  329.          ;;
  330.      PENTIUMIII)
  331.          pkgname="${pkgbase}-p3"
  332.          pkgdesc="${_pkgdesc} Intel Pentium3 optimized."
  333.          ;;
  334.      PENTIUMM)
  335.          pkgname="${pkgbase}-pm"
  336.          pkgdesc="${_pkgdesc} Intel Pentium-M optimized."
  337.          ;;
  338.      PENTIUM4)
  339.          pkgname="${pkgbase}-p4"
  340.          pkgdesc="${_pkgdesc} Intel Pentium4 optimized."
  341.          ;;
  342.      COREI7)
  343.          pkgname="${pkgbase}-corei7"
  344.          pkgdesc="${_pkgdesc} Intel Core Nehalem optimized."
  345.          ;;
  346.      COREI7AVX)
  347.          pkgname="${pkgbase}-corei7avx"
  348.          pkgdesc="${_pkgdesc} Intel 2nd Gen Core processors including Sandy Bridge."
  349.          ;;
  350.      COREAVXI)
  351.          pkgname="${pkgbase}-coreavxi"
  352.          pkgdesc="${_pkgdesc} Intel 3rd Gen Core processors including Ivy Bridge."
  353.          ;;
  354.      COREAVX2)
  355.          pkgname="${pkgbase}-coreavx2"
  356.          pkgdesc="${_pkgdesc} Intel AVX-2 processors including Haswell."
  357.          ;;
  358.      default)
  359.   # Note to me: DO NOT EVER REMOVE THIS. It's for the AUR PKGBUILD parser.
  360.          pkgname="${pkgbase}"
  361.          pkgdesc="Linux kernel and modules with the pf-kernel patch [-ck patchset (BFS included), TuxOnIce, BFQ] and aufs3"
  362.          ;;
  363.     esac
  364.  
  365.  
  366.   # If optimized build, conflict with generic and other optimized ones
  367.  
  368.   if [[ "$pkgname" != "$pkgbase" ]]; then
  369.         pkgnameopt="${pkgname}"         # this MUST be inside this if-fi
  370.         pkgname="${pkgbase}"
  371.         echo pkgname $pkgname
  372.         cpuopt=`sed -e "s/linux-pf-//" <<<$pkgnameopt`          # get suffix
  373.         cpuoptdesc=`sed -e "s/${_pkgdesc}//" <<<$pkgdesc`       # get description
  374.         conflicts=(${conflicts[@]/linux-pf-${cpuopt}/})         # remove current
  375.         conflicts=(${conflicts[@]/linux-pf-headers-${cpuopt}/}) # remove current's headers
  376.         export cpuopt cpuoptdesc
  377.   fi
  378.  
  379.   # second batch check ends here
  380.  fi
  381.  
  382.  # Pass conflicts array to linux-pf-headers() BEFORE adding generic linux-pf or headers will conflict
  383.  export _conflicts=${conflicts[@]}
  384.  conflicts=('linux-pf' 'kernel26-pf' ${conflicts[@]})   # add generic packages
  385.  
  386.   echo
  387.   echo "    ======================================="
  388.   msg  "The packages will be named ${pkgnameopt}"
  389.   msg  "and ${pkgname}-${headers}"
  390.   msg  "${pkgdesc}"
  391.   echo "    ======================================="
  392.   echo
  393.  
  394.  ### package_linux-pf
  395.  
  396.   cd "${srcdir}/linux-${_basekernel}"
  397.  
  398.   KARCH=x86
  399.  
  400.   echo # get kernel version
  401.   _kernver="$(make kernelrelease)"
  402.  
  403.   ### c/p from linux-ARCH
  404.  
  405.   mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot}
  406.   make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}" modules_install
  407.   cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}"
  408.  
  409.   # add vmlinux
  410.   install -D -m644 vmlinux "${pkgdir}/usr/src/linux-${_kernver}/vmlinux"
  411.  
  412.   # install fallback mkinitcpio.conf file and preset file for kernel
  413.   install -D -m644 "${srcdir}/${pkgbase}.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
  414.  
  415.   # set correct depmod command for install
  416.   sed \
  417.     -e  "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/" \
  418.     -e  "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/" \
  419.     -i "${startdir}/${pkgbase}.install"
  420.   sed \
  421.     -e "1s|'linux.*'|'${pkgbase}'|" \
  422.     -e "s|ALL_kver=.*|ALL_kver=\"/boot/vmlinuz-${pkgbase}\"|" \
  423.     -e "s|default_image=.*|default_image=\"/boot/initramfs-${pkgbase}.img\"|" \
  424.     -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs-${pkgbase}-fallback.img\"|" \
  425.     -i "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
  426.  
  427.   # remove build and source links
  428.   rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build}
  429.   # remove the firmware
  430.   rm -rf "${pkgdir}/lib/firmware"
  431.   # gzip -9 all modules to save 100MB of space
  432.   find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \;
  433.   # make room for external modules
  434.   ln -s "../extramodules-${_basekernel}${_kernelname:--pf}" "${pkgdir}/lib/modules/${_kernver}/extramodules"
  435.   # add real version for building modules and running depmod from post_install/upgrade
  436.   mkdir -p "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--pf}"
  437.   echo "${_kernver}" > "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--pf}/version"
  438.  
  439.   echo # Now we call depmod... in $pkgdir
  440.   depmod -b "$pkgdir" -F System.map "$_kernver"
  441.  
  442.   # move module tree /lib -> /usr/lib
  443.   mv "$pkgdir/lib" "$pkgdir/usr"
  444.  
  445. # end c/p
  446.  
  447.   ###
  448.   # Trick the AUR parser to accept split PKGBUILD
  449.   true && pkgname="${pkgnameopt}"
  450. }
  451.  
  452. ### package_linux-pf-headers
  453. package_linux-pf-headers() {
  454.   pkgdesc="Header files and scripts for building modules for linux-pf kernel."
  455.   depends=('linux-pf')
  456.   IFS=' ' read -a conflicts <<<${_conflicts}
  457.   [[ ${cpuopt} ]] && pkgname=${pkgname}-${cpuopt} && depends=${depends}-${cpuopt}
  458.   [[ ${cpuoptdesc} ]] && pkgdesc=${pkgdesc}${cpuoptdesc}
  459.  
  460.   provides=('linux-pf-headers')
  461.   cd "${srcdir}/linux-${_basekernel}"
  462. # c/p from linux-ARCH
  463.  
  464.   install -dm755 "${pkgdir}/usr/lib/modules/${_kernver}"
  465.  
  466.   cd "${pkgdir}/usr/lib/modules/${_kernver}"
  467.   ln -sf ../../../src/linux-${_kernver} build
  468.  
  469.  
  470.   cd "${srcdir}/${_srcname}"
  471.   install -D -m644 Makefile \
  472.     "${pkgdir}/usr/src/linux-${_kernver}/Makefile"
  473.   install -D -m644 kernel/Makefile \
  474.     "${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile"
  475.   install -D -m644 .config \
  476.     "${pkgdir}/usr/src/linux-${_kernver}/.config"
  477.  
  478.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include"
  479.  
  480.   for i in acpi asm-generic config crypto drm generated linux math-emu \
  481.     media mtd net pcmcia scsi sound trace video xen; do
  482.     cp -a include/${i} "${pkgdir}/usr/src/linux-${_kernver}/include/"
  483.   done
  484.  
  485.   # copy arch includes for external modules
  486.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/x86"
  487.   cp -a arch/x86/include "${pkgdir}/usr/src/linux-${_kernver}/arch/x86/"
  488.  
  489.   # copy files necessary for later builds, like nvidia and vmware
  490.   cp Module.symvers "${pkgdir}/usr/src/linux-${_kernver}"
  491.   cp -a scripts "${pkgdir}/usr/src/linux-${_kernver}"
  492.  
  493.   # fix permissions on scripts dir
  494.   chmod og-w -R "${pkgdir}/usr/src/linux-${_kernver}/scripts"
  495.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions"
  496.  
  497.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel"
  498.  
  499.   cp arch/${KARCH}/Makefile "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
  500.  
  501.   if [ "${CARCH}" = "i686" ]; then
  502.     cp arch/${KARCH}/Makefile_32.cpu "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
  503.   fi
  504.  
  505.   cp arch/${KARCH}/kernel/asm-offsets.s "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel/"
  506.  
  507.   # add headers for lirc package
  508.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video"
  509.  
  510.   cp drivers/media/video/*.h  "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/"
  511.  
  512.   for i in bt8xx cpia2 cx25840 cx88 em28xx pwc saa7134 sn9c102; do
  513.     mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
  514.     cp -a drivers/media/video/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
  515.   done
  516.  
  517.   # add docbook makefile
  518.   install -D -m644 Documentation/DocBook/Makefile \
  519.     "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
  520.  
  521.   # add dm headers
  522.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
  523.   cp drivers/md/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
  524.  
  525.   # add inotify.h
  526.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/linux"
  527.   cp include/linux/inotify.h "${pkgdir}/usr/src/linux-${_kernver}/include/linux/"
  528.  
  529.   # add wireless headers
  530.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
  531.   cp net/mac80211/*.h "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
  532.  
  533.   # add dvb headers for external modules
  534.   # in reference to:
  535.   # http://bugs.archlinux.org/task/9912
  536.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core"
  537.   cp drivers/media/dvb/dvb-core/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/"
  538.   # and...
  539.   # http://bugs.archlinux.org/task/11194
  540.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
  541.   cp include/config/dvb/*.h "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
  542.  
  543.   # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
  544.   # in reference to:
  545.   # http://bugs.archlinux.org/task/13146
  546.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  547.   cp drivers/media/dvb/frontends/lgdt330x.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  548.   cp drivers/media/video/msp3400-driver.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  549.  
  550.   # add dvb headers
  551.   # in reference to:
  552.   # http://bugs.archlinux.org/task/20402
  553.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb"
  554.   cp drivers/media/dvb/dvb-usb/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/"
  555.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends"
  556.   cp drivers/media/dvb/frontends/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  557.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners"
  558.   cp drivers/media/common/tuners/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners/"
  559.  
  560.   # add xfs and shmem for aufs building
  561.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs"
  562.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/mm"
  563.   cp fs/xfs/xfs_sb.h "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h"
  564.  
  565.   # copy in Kconfig files
  566.   for i in `find . -name "Kconfig*"`; do
  567.     mkdir -p "${pkgdir}"/usr/src/linux-${_kernver}/`echo ${i} | sed 's|/Kconfig.*||'`
  568.     cp ${i} "${pkgdir}/usr/src/linux-${_kernver}/${i}"
  569.   done
  570.  
  571.   chown -R root.root "${pkgdir}/usr/src/linux-${_kernver}"
  572.   find "${pkgdir}/usr/src/linux-${_kernver}" -type d -exec chmod 755 {} \;
  573.  
  574.   # strip scripts directory
  575.   find "${pkgdir}/usr/src/linux-${_kernver}/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
  576.     case "$(file -bi "${binary}")" in
  577.       *application/x-sharedlib*) # Libraries (.so)
  578.         /usr/bin/strip ${STRIP_SHARED} "${binary}";;
  579.       *application/x-archive*) # Libraries (.a)
  580.         /usr/bin/strip ${STRIP_STATIC} "${binary}";;
  581.       *application/x-executable*) # Binaries
  582.         /usr/bin/strip ${STRIP_BINARIES} "${binary}";;
  583.     esac
  584.   done
  585.  
  586.   # remove unneeded architectures
  587.   rm -rf "${pkgdir}"/usr/src/linux-${_kernver}/arch/{alpha,arm,arm26,avr32,blackfin,c6x,cris,frv,h8300,hexagon,ia64,m32r,m68k,m68knommu,mips,microblaze,mn10300,openrisc,parisc,powerpc,ppc,s390,score,sh,sh64,sparc,sparc64,tile,unicore32,um,v850,xtensa}
  588.  
  589. # end c/p
  590. }
  591.  
  592. # Work around the AUR parser
  593. pkgdesc="Linux kernel and modules with the pf-kernel patch [-ck patchset (BFS included), TuxOnIce, BFQ] and aufs3"
  594.  
  595. # makepkg -g >>PKGBUILD
  596. sha256sums=('4ab9a6ef1c1735713f9f659d67f92efa7c1dfbffb2a2ad544005b30f9791784f'
  597.             '991b88a87b39e32d99f7b66e4274628ef01f2c8298066d42f813a95441557144'
  598.             'edf142d38c13ebdd810cb39e4785591a3e59e3642f8d48318bbdace0f2975daf'
  599.             '82d660caa11db0cd34fd550a049d7296b4a9dcd28f2a50c81418066d6e598864'
  600.             '03ed4eb4a35d42ae6beaaa5e6fdbada4244ed6c343944bba6462defaa6fed0bf'
  601.             '51ea665cfec42d9f9c7796af2b060b7edbdeb367e42811f8c02667ad729f6b19'
  602.             '9e1e81d80afac6f316e53947e1b081017090081cd30e6c4c473420b77af4b52b'
  603.             'd537a358c9f8b9cbcad34ba99f88af070f54d99c66d3e5d3d4734576ed2fb6e1'
  604.             'b9d79ca33b0b51ff4f6976b7cd6dbb0b624ebf4fbf440222217f8ffc50445de4'
  605.             '541ed364ddf0545ea4533d1fbf8eb8a0381ed6bf16b53e491f5b8831f0e85f70'
  606.             '8f2dad5b89dac8c76c3dd3ad902928d6032ec2c6ada41d873d752bad5586b154')