Thaodan

linux-pf PKGBUILD

Jan 13th, 2013
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 27.52 KB | None | 0 0
  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=7
  8. #_patchlevel=0
  9. #_subversion=1
  10. _basekernel=${_major}.${_minor}
  11. _srcname=linux-${_major}.${_minor}
  12. pkgbase=linux-pf
  13. _pfrel=2
  14. _kernelname=-pf
  15. _pfpatchhome="http://pf.natalenko.name/sources/${_basekernel}/"
  16. _pfpatchname="patch-${_basekernel}.${_pfrel}${_kernelname}"
  17.  
  18. ### PATCH AND BUILD OPTIONS
  19. # taken from graysky linux-ck see: https://aur.archlinux.org/packages/linux-ck
  20. # Set these variables to ANYTHING (yes or no or 1 or 0 or "I like icecream") to enable them
  21. #
  22.  
  23. _NUMA_off=yes       # Disable NUMA in kernel config
  24.  
  25. ### DOCS
  26. # Starting with the 3.6.6-3 release, this package ships with the kernel-3x-gcc47-x.patch.
  27. # This allows users an expanded scope of CPU specific options.
  28. # Consult the following resources to understand which option is right for you application:
  29. #
  30. # http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel
  31. # http://en.gentoo-wiki.com/wiki/Safe_Cflags/AMD
  32. # http://www.linuxforge.net/docs/linux/linux-gcc.php
  33. # http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html
  34.  
  35. # DETAILS FOR using 'make localmodconfig'
  36. # As of mainline 2.6.32, running with this option will only build the modules that you currently have
  37. # probed in your system VASTLY reducing the number of modules built and the build time to do it.
  38. #
  39. # WARNING - make CERTAIN that all modules are modprobed BEFORE you begin making the pkg!
  40. #
  41. # To keep track of which modules are needed for your specific system/hardware, give my module_db script
  42. # a try: http://aur.archlinux.org/packages.php?ID=41689  Note that if you use my script, this PKGBUILD
  43. # will auto run the 'sudo modprobed_db reload' for you to probe all the modules you have logged!
  44. #
  45. # More at this wiki page ---> https://wiki.archlinux.org/index.php/Modprobed_db
  46.  
  47. # DETAILS FOR running kernel's config
  48. # Enabling this option will use the .config of the RUNNING kernel rather than the ARCH defaults.
  49. # Useful when the package gets updated and you already went through the trouble of customizing your
  50. # config options.  NOT recommended when a new kernel is released, but again, convenient for package bumps.
  51.  
  52. # DRTAILS FOR _NUMA_off=yes
  53. # Since 99.9% of users do not have multiple CPUs but do have multiple cores in one CPU
  54. # see, https://bugs.archlinux.org/task/31187
  55.  
  56. pkgname=('linux-pf')
  57. true && pkgname=('linux-pf' 'linux-pf-headers')
  58. pkgver=${_basekernel}.${_pfrel}
  59. pkgrel=1
  60. arch=('i686' 'x86_64')
  61. url="http://pf.natalenko.name/"
  62. license=('GPL2')
  63. options=('!strip')
  64. makedepends=('git' 'xmlto' 'docbook-xsl' 'xz')
  65. source=("ftp://www.kernel.org/pub/linux/kernel/v${_major}.x/linux-${_basekernel}.tar.xz"
  66.     'config' 'config.x86_64'        # the main kernel config files
  67.     'linux-pf.preset'           # standard config files for mkinitcpio ramdisk
  68.     'logo_linux_clut224.ppm.bz2'        #
  69.     'logo_linux_mono.pbm.bz2'       # the Arch Linux boot logos
  70.     'logo_linux_vga16.ppm.bz2'      #
  71.     "interactive-governor.tar.gz::https://gist.github.com/gists/1172524/download"
  72.     'change-default-console-loglevel.patch'
  73.     'fat-3.6.x.patch'
  74.     'fix-watchdog-3.7.patch'
  75.     'http://repo-ck.com/source/gcc_patch/kernel-37-gcc47-1.patch.gz'
  76.     "${_pfpatchhome}${_pfpatchname}.bz2"    # the -pf patchset
  77.  )
  78.  
  79. _aufs3git="git://aufs.git.sourceforge.net/gitroot/aufs/aufs3-standalone.git"
  80. _aufs3name=aufs3
  81. # '
  82.  
  83. build() {
  84.   cd "${srcdir}/linux-${_basekernel}"
  85.   # This is for me, to test the PKGBUILD
  86. if [[ $NOEXTRACT = "0" ]]; then
  87.  
  88.      # Arch linux logo
  89.      msg "Replacing penguins with arches"
  90.      bzip2 -dk ${startdir}/logo_linux_*.bz2
  91.      mv -f ${startdir}/logo_linux_*.p?m drivers/video/logo/
  92.      msg "Applying pf-kernel patch"
  93.      patch -Np1 < ${srcdir}/${_pfpatchname}
  94.      msg "Fetching and applying aufs3 patches"
  95.      git clone ${_aufs3git} ${_aufs3name}
  96.      cd ${_aufs3name}
  97.      git checkout origin/aufs${_basekernel} || _aufs3checkout=KRAKRA
  98.      if [[ ${_aufs3checkout} = "KRAKRA" ]]; then
  99.     echo
  100.         msg "AUFS3 not yet ported to version ${_basekernel}!"
  101.         msg "Skipping related patches."
  102.     echo
  103.     cd ..
  104.      else
  105. #        mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include"
  106. #        mv include/linux/Kbuild "${pkgdir}/usr/src/linux-${_kernver}/include/"
  107.     rm include/uapi/linux/Kbuild
  108.     cd ..
  109.     cp -a ${_aufs3name}/{Documentation,fs,include} ${srcdir}/linux-${_basekernel}/
  110.     msg "Patching aufs3"
  111.     for _patch in ${_aufs3name}/*.patch; do
  112.         patch -Np1 < ${_patch} || _aufs3fail=KRAKRA
  113.         done
  114.         if [[ ${_aufs3fail} = "KRAKRA" ]]; then
  115.         echo
  116.             msg "Not all aufs3 patches applied correctly. Ignore this if you won't use AUFS."
  117.             msg "Otherwise, press CTRL-C now and fix manually"
  118.             echo
  119.         fi
  120.     fi
  121.  
  122.   # Interactive governor patch
  123.   # broken for now
  124.   #   msg "Interactice CPU governor patch"
  125.   #   mv ${srcdir}/gist*/gistfile1.diff ${srcdir}
  126.   #   patch -Np1 < ${srcdir}/gistfile1.diff
  127.  
  128.   # linux-ARCH patches
  129.  
  130.   # add latest fixes from stable queue, if needed
  131.   # http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
  132.  
  133.  
  134.   # set DEFAULT_CONSOLE_LOGLEVEL to 4 (same value as the 'quiet' kernel param)
  135.   # remove this when a Kconfig knob is made available by upstream
  136.   # (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227)
  137.   patch -Np1 -i "${srcdir}/change-default-console-loglevel.patch"
  138.  
  139.   # fix cosmetic fat issue
  140.   # https://bugs.archlinux.org/task/32916
  141.   patch -Np1 -i "${srcdir}/fat-3.6.x.patch"
  142.  
  143.  
  144.   # fix watchdog enable/disable regression
  145.   # https://bugs.archlinux.org/task/33095
  146.   patch -Np1 -i "${srcdir}/fix-watchdog-3.7.patch"
  147.  
  148.   # end linux-ARCH patches
  149.  
  150.  
  151.  
  152.   # added gcc 4.7.1 support for Kconfig and menuconfig
  153.   zcat "${srcdir}/kernel-37-gcc47-1.patch.gz" | patch -Np1
  154.    if [ "$CARCH" = "x86_64" ]; then
  155.     cat "${startdir}/config.x86_64" >| .config
  156.    else
  157.     cat "${startdir}/config" >| .config
  158.    fi
  159. fi
  160.  
  161. #----------------------------------------
  162. if [[ "$_BATCH" != "y" ]]; then     # for batch building
  163.   echo
  164.   echo "======================================================="
  165.   msg "You might be prompted below for some config options"
  166.   echo "======================================================="
  167.   echo
  168.   msg "Hit <Y> to use your running kernel's config"
  169.   echo "    (needs IKCONFIG and IKCONFIG_PROC)"
  170.   msg "Hit <L> to run 'make localmodconfig'"
  171.   msg "Hit <N> (or just <ENTER>) to build an all-inclusive kernel like stock -ARCH"
  172.   echo "    (warning: it can take a looong time)"
  173.   echo
  174.   read answer
  175.   shopt -s nocasematch
  176.   if [[ "$answer" = "y" ]]; then
  177.      if [[ -s /proc/config.gz ]]; then
  178.     msg "Extracting config from /proc/config.gz..."
  179.     zcat /proc/config.gz >| ./.config
  180.      else
  181.     msg "running 'sudo modprobe configs'"
  182.     sudo modprobe configs
  183.         if [[ -s /proc/config.gz ]]; then
  184.         msg "Extracting config from /proc/config.gz..."
  185.         zcat /proc/config.gz >| ./.config
  186.     else
  187.         msg "You kernel was not compiled with IKCONFIG_PROC."
  188.         msg "Attempting to run /usr/bin/modprobed_db recall from modprobe_db..."
  189.         if [ -e /usr/bin/modprobed_db ]; then
  190.         sudo /usr/bin/modprobed_db recall
  191. -       else
  192. -       msg "modprobed_db not installed, running make localmodconfig instead..."
  193. -       make localmodconfig
  194.         fi
  195.         fi
  196.      fi
  197.   elif [[ "$answer" = "l" ]]; then
  198.      # Copied from kernel26-ck's PKGBUILD
  199.      msg "Attempting to run /usr/bin/reload_database with sudo from modprobe_db..."
  200.      if [ -e /usr/bin/modprobed_db ]; then
  201.     sudo /usr/bin/modprobed_db recall
  202.      fi
  203.      msg "Running 'make localmodconfig'..."
  204.      make localmodconfig
  205.   else
  206.      msg "Using stock ARCH kernel .config (with BFS, BFQ and TuxOnIce enabled)."
  207.   fi
  208.  
  209.   # Make some good use of MAKEFLAGS
  210.   # MAKEFLAGS=`grep -v '#' /etc/makepkg.conf | grep MAKEFLAGS= | sed s/MAKEFLAGS=// | sed s/\"//g`
  211.  
  212.   # make prepare
  213.  
  214.   # Options for additional configuration
  215.   echo
  216.   msg "Kernel configuration options before build:"
  217.   echo "    <M> make menuconfig (console menu)"
  218.   echo "    <N> make nconfig (newer alternative to menuconfig)"
  219.   echo "    <G> make gconfig (needs gtk)"
  220.   echo "    <X> make xconfig (needs qt)"
  221.   echo "    <O> make oldconfig"
  222.   echo "    <L> make localyesconfig"
  223.   echo "    <ENTER> to skip configuration and use stock -ARCH defaults"
  224.   read answer
  225.   case "$answer" in
  226.    m) make menuconfig
  227.       ;;
  228.    g) make gconfig
  229.       ;;
  230.    x) make xconfig
  231.       ;;
  232.    n) make nconfig
  233.       ;;
  234.    o) make oldconfig
  235.       ;;
  236.    l) make localyesconfig
  237.       ;;
  238.    default)
  239.       ;;
  240.   esac
  241.   cp -v .config ${startdir}/config.local
  242.   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`
  243.   CPU=`sed -e "s/CONFIG_M\(.*\)=y/\1/" <<<$CPU`
  244.   CPU=`sed -e "s/CONFIG_GENERIC_CPU=y/GENERIC/" <<<$CPU`
  245.   CPU=`sed -e "s/^686$/GENERIC/" <<<$CPU`
  246.   cp -f .config ${startdir}/config.$CPU-$CARCH
  247.  
  248.   # Give option to rename package according to CPU
  249.   echo
  250.   if [[ "$CPU" = "GENERIC" ]]; then
  251.     msg "Hit <P>     :  to include the patchlevel number in kernver"
  252.     msg "               (i.e. linux-pf-${_basekernel}.${_pfrel})"
  253.     msg "Hit <ENTER> :  to remove the patchlevel number from kernver (default)"
  254.     msg "               (i.e. linux-pf-${_basekernel})"
  255.     read answer
  256.     shopt -s nocasematch
  257.     if [[ "$answer" = "p" ]]; then
  258.        export _SUBLEVEL=y
  259.     fi
  260.   else
  261.     lcpu=`tr '[:upper:]' '[:lower:]' <<< $CPU`
  262.     lcpu=`sed -e "s/entium//" <<<$lcpu`    
  263.     echo "=============================================================="
  264.     msg "An non-generic CPU was selected for this kernel."
  265.     echo
  266.     msg "Hit <G>     :  to create a generic package named linux-pf"
  267.     msg "Hit <ENTER> :  to create a package named after the selected CPU"
  268.     msg "               (linux-pf-${lcpu} - recommended default)"
  269.     echo
  270.     msg "This option affects ONLY the package name. Whether or not the"
  271.     msg "kernel is optimized was determined at the previous config step."
  272.     echo "=============================================================="
  273.     read answer
  274.     shopt -s nocasematch
  275.     if [[ "$answer" != "g" ]]; then
  276.        export _PKGOPT=y
  277.     fi
  278.     msg "Hit <P>     :  to include the patchlevel number in kernver"
  279.     if [[ ${_PKGOPT} != "y" ]]; then
  280.        msg "               (i.e. linux-pf-${_basekernel}.${_pfrel})"
  281.     else
  282.        msg "               (i.e. linux-pf-${lcpu}-${_basekernel}.${_pfrel})"
  283.     fi
  284.     msg "Hit <ENTER> :  to remove the patchlevel number from kernver (default)"
  285.     if [[ ${_PKGOPT} != "y" ]]; then
  286.        msg "               (i.e. linux-pf-${_basekernel})"
  287.     else
  288.        msg "               (i.e. linux-pf-${lcpu}-${_basekernel})"
  289.     fi
  290.     read answer
  291.     shopt -s nocasematch
  292.     if [[ "$answer" = "p" ]]; then
  293.        export _SUBLEVEL=y
  294.     fi
  295.   fi
  296. fi  # batch check ends here
  297. export CPU
  298. #----------------------------------------
  299.  
  300.   # Strip config of uneeded localversion
  301.   if [ "${_kernelname}" != "" ]; then
  302.      sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"\"|g" ./.config
  303.   fi
  304.  
  305.   # Set EXTRAVERSION to -pf
  306.   sed -i "s/EXTRAVERSION = -${_pfrel}/EXTRAVERSION = ${_kernelname}/" Makefile
  307.   _arch=$CARCH
  308.  
  309.   # Remove the sublevel from Makefile
  310.   # This ensures our kernel version is always 3.X-pf
  311.   # This way, minor kernel updates will not break external modules
  312.   if [ "${_SUBLEVEL}" != "y" ]; then
  313.      sed -ri 's|^(SUBLEVEL =).*|\1|' Makefile
  314.   fi
  315.  
  316.   # disable NUMA since 99.9% of users do not have multiple CPUs but do have multiple cores in one CPU
  317.   # see, https://bugs.archlinux.org/task/31187
  318.   if [ -n "$_NUMA_off" ]; then
  319.     if [ "${CARCH}" = "x86_64" ]; then
  320.      sed -i -e 's/CONFIG_NUMA=y/# CONFIG_NUMA is not set/' \
  321.       -i -e '/CONFIG_AMD_NUMA=y/d' \
  322.       -i -e '/CONFIG_X86_64_ACPI_NUMA=y/d' \
  323.       -i -e '/CONFIG_NODES_SPAN_OTHER_NODES=y/d' \
  324.       -i -e '/# CONFIG_NUMA_EMU is not set/d' \
  325.       -i -e '/CONFIG_NODES_SHIFT=6/d' \
  326.       -i -e '/CONFIG_NEED_MULTIPLE_NODES=y/d' \
  327.       -i -e '/CONFIG_USE_PERCPU_NUMA_NODE_ID=y/d' \
  328.       -i -e '/CONFIG_ACPI_NUMA=y/d' ./.config
  329.     fi
  330.   fi
  331.  
  332.   # Don't run depmod on 'make install'. We'll do this ourselves in packaging
  333.   sed -i '2iexit 0' scripts/depmod.sh
  334.  
  335.   # If the following is set, stop right there. We only need the headers for
  336.   # dependent drivers' compiling (nvidia, virtualbox etc)
  337.   [[ ${_NOBUILD} ]] && exit 0
  338.  
  339.   # Build
  340.   # Want extreme and non-sensical optimization? Uncomment the following line!
  341.   # export KCFLAGS="-march=native -Ofast"
  342.   make ${MAKEFLAGS} LOCALVERSION= bzImage modules
  343. }
  344.  
  345. package_linux-pf() {
  346.  _pkgdesc="Linux kernel and modules with the pf-kernel patch [-ck patchset (BFS included), TuxOnIce, BFQ] and aufs3."
  347.  pkgdesc=${_pkgdesc}
  348.  groups=('base')
  349.  backup=(etc/mkinitcpio.d/${pkgbase}.preset)
  350.  depends=('coreutils' 'linux-firmware' 'kmod>=9-2' 'mkinitcpio>=0.7')
  351.  optdepends=('linux-docs: Kernel hackers manual - HTML documentation that comes with the Linux kernel.'
  352.         'crda: to set the correct wireless channels of your country'
  353.         'pm-utils: utilities and scripts for suspend and hibernate power management'
  354.         'tuxonice-userui: TuxOnIce userspace user interface'
  355.         'hibernate-script: set of scripts for managing TuxOnIce, hibernation and suspend to RAM'
  356.         'nvidia-pf: NVIDIA drivers for linux-pf'
  357.         'nvidia-beta-all: NVIDIA drivers for all installed kernels'
  358.         'modprobed_db: Keeps track of EVERY kernel module that has ever been probed. Useful for make localmodconfig.')
  359.  #provides=(${pkgbase}=${_basekernel} 'aufs3')  # for $pkgname-optimized
  360.  provides=(${pkgbase}=${_basekernel} 'aufs3')
  361.  # below 'provides' is for when you have no other kernel (which is a bad idea anyway)
  362.  # provides=(${pkgbase}=${_basekernel} 'linux=${pkgver}' 'aufs3')
  363.  # If generic build, then conflict with all optimized ones
  364.  conflicts=('linux-pf-core2' 'linux-pf-k8' 'linux-pf-psc' 'linux-pf-atom'
  365.         'linux-pf-k7' 'linux-pf-p3' 'linux-pf-pm' 'linux-pf-p4'
  366.         'linux-pf-headers-core2' 'linux-pf-headers-k8' 'linux-pf-headers-psc'
  367.         'linux-pf-headers-atom' 'linux-pf-headers-k7' 'linux-pf-headers-p3'
  368.         'linux-pf-headers-pm' 'linux-pf-headers-p4'
  369.         'kernel26-pf-core2' 'kernel26-pf-k8' 'kernel26-pf-psc' 'kernel26-pf-atom'
  370.         'kernel26-pf-k7' 'kernel26-pf-p3' 'kernel26-pf-pm' 'kernel26-pf-p4'
  371.         'linux-pf-bobcat' 'linux-pf-barcelona' 'linux-pf-bulldozer'
  372.         'linux-pf-pilediver' 'linux-pf-nehalem' 'linux-pf-ivybridge' 'linux-pf-sandybridge' 'linux-pf-haswell'
  373.         'linux-pf-headers-bobcat' 'linux-pf-headers-barcelona' 'linux-pf-headers-bulldozer'
  374.         'linux-pf-headers-pilediver' 'linux-pf-headers-nehalem' 'linux-pf-headers-ivybridge' 'linux-pf-headers-sandybridge' 'linux-pf-headers-haswell' )
  375.  replaces=('kernel26-pf' 'aufs3')
  376.  backup=("etc/mkinitcpio.d/${pkgbase}.preset")
  377.  install='linux-pf.install'
  378.  
  379.  #'
  380.   cd "${srcdir}/linux-${_basekernel}"
  381.  
  382.   # Remove undeeded aufs3 git tree
  383.   rm -fr aufs3 2>/dev/null
  384.  
  385.   # work around the AUR parser
  386.   # This allows building cpu-optimized packages with according package names.
  387.   # Useful for repo maintainers.
  388.  
  389.   headers="headers"
  390.   pkgnameopt="${pkgbase}"       # this MUST be outside the following 'if'
  391.   if [[ "$_PKGOPT" = "y" ]]; then   # package naming according to optimization
  392.     case $CPU in
  393.      CORE2)
  394.          pkgname="${pkgbase}-core2"
  395.          pkgdesc="${_pkgdesc} Intel Core2 optimized."
  396.          ;;
  397.      K8)
  398.          pkgname="${pkgbase}-k8"
  399.          pkgdesc="${_pkgdesc} AMD K8 optimized."
  400.          ;;
  401.      BARCELONA)
  402.          pkgname="${pkgbase}-barcelona"
  403.          pkgdesc="${_pkgdesc} AMD Barcelona optimized."
  404.      ;;
  405.      BOBCAT)
  406.      pkgname="${pkgbase}-bobcat"
  407.      pkgdesc="${_pkgdesc} AMD Bobcat optimized"
  408.      ;;
  409.      BULLDOZER)
  410.      pkgname"${pkgbase}-bulldozer"
  411.      pkgdesc="${_pkgdesc} AMD Bulldozer optimized"
  412.      ;;
  413.      PILEDRIVER)
  414.      pkgname"${pkgbase}-piledriver"
  415.      pkgdesc="${_pkgdesc} AMD Piledriver optimized"
  416.      ;;
  417.      PSC)
  418.          pkgname="${pkgbase}-psc"
  419.          pkgdesc="${_pkgdesc} Intel Pentium4/D/Xeon optimized."
  420.          ;;
  421.      ATOM)
  422.          pkgname="${pkgbase}-atom"
  423.          pkgdesc="${_pkgdesc} Intel Atom optimized."
  424.          ;;
  425.      K7)
  426.          pkgname="${pkgbase}-k7"
  427.          pkgdesc="${_pkgdesc} AMD K7 optimized."
  428.          ;;
  429.      PENTIUMII)
  430.          pkgname="${pkgbase}-p2"
  431.          pkgdesc="${_pkgdesc} Intel Pentium2 optimized."
  432.          ;;
  433.      PENTIUMIII)
  434.          pkgname="${pkgbase}-p3"
  435.          pkgdesc="${_pkgdesc} Intel Pentium3 optimized."
  436.          ;;
  437.      PENTIUMM)
  438.          pkgname="${pkgbase}-pm"
  439.          pkgdesc="${_pkgdesc} Intel Pentium-M optimized."
  440.          ;;
  441.      PENTIUM4)
  442.          pkgname="${pkgbase}-p4"
  443.          pkgdesc="${_pkgdesc} Intel Pentium4 optimized."
  444.          ;;
  445.      COREI7)
  446.      pkgname="${pkgbase}-nehalem "
  447.          pkgdesc="${_pkgdesc} Intel Core Nehalem optimized."
  448.      ;;
  449.      COREI7AVX)
  450.          pkgname="${pkgbase}-sandybridge"
  451.          pkgdesc="${_pkgdesc} Intel 2nd Gen Core processors including Sandy Bridge."
  452.      ;;
  453.      COREAVXI)
  454.          pkgname="${pkgbase}-ivybridge"
  455.          pkgdesc="${_pkgdesc} Intel 3rd Gen Core processors including Ivy Bridge."
  456.      ;;
  457.      COREAVX2)
  458.          pkgname="${pkgbase}-haswell"
  459.          pkgdesc="${_pkgdesc} Intel AVX-2 processors including Haswell."
  460.      ;;
  461.      default)
  462.   # Note to me: DO NOT EVER REMOVE THIS. It's for the AUR PKGBUILD parser.
  463.          pkgname="${pkgbase}"
  464.          pkgdesc="Linux kernel and modules with the pf-kernel patch [-ck patchset (BFS included), TuxOnIce, BFQ] and aufs3"
  465.          ;;
  466.     esac
  467.  
  468.  
  469.   # If optimized build, conflict with generic and other optimized ones
  470.  
  471.   if [[ "$pkgname" != "$pkgbase" ]]; then
  472.     pkgnameopt="${pkgname}"     # this MUST be inside this if-fi
  473.     pkgname="${pkgbase}"
  474.     echo pkgname $pkgname
  475.     cpuopt=`sed -e "s/linux-pf-//" <<<$pkgnameopt`      # get suffix
  476.     cpuoptdesc=`sed -e "s/${_pkgdesc}//" <<<$pkgdesc`   # get description
  477.     conflicts=(${conflicts[@]/linux-pf-${cpuopt}/})     # remove current
  478.     conflicts=(${conflicts[@]/linux-pf-headers-${cpuopt}/}) # remove current's headers
  479.     export cpuopt cpuoptdesc
  480.   fi
  481.  
  482.   # second batch check ends here
  483.  fi
  484.  
  485.  # Pass conflicts array to linux-pf-headers() BEFORE adding generic linux-pf or headers will conflict
  486.  export _conflicts=${conflicts[@]}
  487.  conflicts=('linux-pf' 'kernel26-pf' ${conflicts[@]})   # add generic packages
  488.  
  489.   echo
  490.   echo "    ======================================="
  491.   msg  "The packages will be named ${pkgnameopt}"
  492.   msg  "and ${pkgname}-${headers}"
  493.   msg  "${pkgdesc}"
  494.   echo "    ======================================="
  495.   echo
  496.  
  497.  ### package_linux-pf
  498.  
  499.   cd "${srcdir}/linux-${_basekernel}"
  500.  
  501.   KARCH=x86
  502.  
  503.   echo # get kernel version
  504.   _kernver="$(make kernelrelease)"
  505.  
  506.   ### c/p from linux-ARCH
  507.  
  508.   mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot}
  509.   make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}" modules_install
  510.   cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}"
  511.  
  512.   # add vmlinux
  513.   install -D -m644 vmlinux "${pkgdir}/usr/src/linux-${_kernver}/vmlinux"
  514.  
  515.   # install fallback mkinitcpio.conf file and preset file for kernel
  516.   install -D -m644 "${srcdir}/linux-pf.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
  517.  
  518.   # set correct depmod command for install
  519.   sed \
  520.     -e  "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/" \
  521.     -e  "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/" \
  522.     -i "${startdir}/linux-pf.install"
  523.   sed \
  524.     -e "1s|'linux.*'|'${pkgbase}'|" \
  525.     -e "s|ALL_kver=.*|ALL_kver=\"/boot/vmlinuz-${pkgbase}\"|" \
  526.     -e "s|default_image=.*|default_image=\"/boot/initramfs-${pkgbase}.img\"|" \
  527.     -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs-${pkgbase}-fallback.img\"|" \
  528.     -i "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
  529.  
  530.   # remove build and source links
  531.   rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build}
  532.   # remove the firmware
  533.   rm -rf "${pkgdir}/lib/firmware"
  534.   # gzip -9 all modules to save 100MB of space
  535.   find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \;
  536.   # make room for external modules
  537.   ln -s "../extramodules-${_basekernel}${_kernelname:--pf}" "${pkgdir}/lib/modules/${_kernver}/extramodules"
  538.   # add real version for building modules and running depmod from post_install/upgrade
  539.   mkdir -p "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--pf}"
  540.   echo "${_kernver}" > "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--pf}/version"
  541.  
  542.   # Now we call depmod..."
  543.   depmod -b "$pkgdir" -F System.map "$_kernver"
  544.  
  545.   # move module tree /lib -> /usr/lib
  546.   mv "$pkgdir/lib" "$pkgdir/usr"
  547.  
  548. # end c/p
  549.  
  550.   ###
  551.   # Trick the AUR parser to accept split PKGBUILD
  552.   true && pkgname="${pkgnameopt}"
  553. }
  554.  
  555. ### package_linux-pf-headers
  556. package_linux-pf-headers() {
  557.   pkgdesc="Header files and scripts for building modules for linux-pf kernel."
  558.  depends=('linux-pf')
  559.   IFS=' ' read -a conflicts <<<${_conflicts}
  560.   [[ ${cpuopt} ]] && pkgname=${pkgname}-${cpuopt} && depends=${depends}-${cpuopt}
  561.   [[ ${cpuoptdesc} ]] && pkgdesc=${pkgdesc}${cpuoptdesc}
  562.   provides=('linux-pf-headers')
  563.   cd "${srcdir}/linux-${_basekernel}"
  564. # c/p from linux-ARCH
  565.  
  566.   install -dm755 "${pkgdir}/usr/lib/modules/${_kernver}"
  567.  
  568.   cd "${pkgdir}/usr/lib/modules/${_kernver}"
  569.   ln -sf ../../../src/linux-${_kernver} build
  570.  
  571.  
  572.   cd "${srcdir}/${_srcname}"
  573.   install -D -m644 Makefile \
  574.     "${pkgdir}/usr/src/linux-${_kernver}/Makefile"
  575.   install -D -m644 kernel/Makefile \
  576.     "${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile"
  577.   install -D -m644 .config \
  578.     "${pkgdir}/usr/src/linux-${_kernver}/.config"
  579.  
  580.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include"
  581.  
  582.   for i in acpi asm-generic config crypto drm generated linux math-emu \
  583.     media net pcmcia scsi sound trace uapi video xen; do
  584.     cp -a include/${i} "${pkgdir}/usr/src/linux-${_kernver}/include/"
  585.   done
  586.  
  587.   # copy arch includes for external modules
  588.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/x86"
  589.   cp -a arch/x86/include "${pkgdir}/usr/src/linux-${_kernver}/arch/x86/"
  590.  
  591.   # copy files necessary for later builds, like nvidia and vmware
  592.   cp Module.symvers "${pkgdir}/usr/src/linux-${_kernver}"
  593.   cp -a scripts "${pkgdir}/usr/src/linux-${_kernver}"
  594.  
  595.   # fix permissions on scripts dir
  596.   chmod og-w -R "${pkgdir}/usr/src/linux-${_kernver}/scripts"
  597.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions"
  598.  
  599.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel"
  600.  
  601.   cp arch/${KARCH}/Makefile "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
  602.  
  603.   if [ "${CARCH}" = "i686" ]; then
  604.     cp arch/${KARCH}/Makefile_32.cpu "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
  605.   fi
  606.  
  607.   cp arch/${KARCH}/kernel/asm-offsets.s "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel/"
  608.  
  609.   # add headers for lirc package
  610.   # pci
  611.   for i in bt8xx cx88 saa7134; do
  612.     mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/pci/${i}"
  613.     cp -a drivers/media/pci/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/pci/${i}"
  614.   done
  615.   # usb
  616.   for i in cpia2 em28xx pwc sn9c102; do
  617.     mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/usb/${i}"
  618.     cp -a drivers/media/usb/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/usb/${i}"
  619.   done
  620.   # i2c
  621.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/i2c"
  622.   cp drivers/media/i2c/*.h  "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/i2c/"
  623.   for i in cx25840; do
  624.     mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/i2c/${i}"
  625.     cp -a drivers/media/i2c/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/i2c/${i}"
  626.   done
  627.  
  628.   # add docbook makefile
  629.   install -D -m644 Documentation/DocBook/Makefile \
  630.     "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
  631.  
  632.   # add dm headers
  633.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
  634.   cp drivers/md/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
  635.  
  636.   # add inotify.h
  637.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/linux"
  638.   cp include/linux/inotify.h "${pkgdir}/usr/src/linux-${_kernver}/include/linux/"
  639.  
  640.   # add wireless headers
  641.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
  642.   cp net/mac80211/*.h "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
  643.  
  644.   # add dvb headers for external modules
  645.   # in reference to:
  646.   # http://bugs.archlinux.org/task/9912
  647.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb-core"
  648.   cp drivers/media/dvb-core/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb-core/"
  649.   # and...
  650.   # http://bugs.archlinux.org/task/11194
  651.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
  652.   cp include/config/dvb/*.h "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
  653.  
  654.   # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
  655.   # in reference to:
  656.   # http://bugs.archlinux.org/task/13146
  657.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends/"
  658.   cp drivers/media/dvb-frontends/lgdt330x.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends/"
  659.   cp drivers/media/i2c/msp3400-driver.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/i2c/"
  660.  
  661.   # add dvb headers
  662.   # in reference to:
  663.   # http://bugs.archlinux.org/task/20402
  664.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/usb/dvb-usb"
  665.   cp drivers/media/usb/dvb-usb/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/usb/dvb-usb/"
  666.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends"
  667.   cp drivers/media/dvb-frontends/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends/"
  668.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/tuners"
  669.   cp drivers/media/tuners/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/tuners/"
  670.  
  671.  
  672.   # add xfs and shmem for aufs building
  673.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs"
  674.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/mm"
  675.   cp fs/xfs/xfs_sb.h "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h"
  676.  
  677.   # copy in Kconfig files
  678.   for i in `find . -name "Kconfig*"`; do
  679.     mkdir -p "${pkgdir}"/usr/src/linux-${_kernver}/`echo ${i} | sed 's|/Kconfig.*||'`
  680.     cp ${i} "${pkgdir}/usr/src/linux-${_kernver}/${i}"
  681.   done
  682.  
  683.   chown -R root.root "${pkgdir}/usr/src/linux-${_kernver}"
  684.   find "${pkgdir}/usr/src/linux-${_kernver}" -type d -exec chmod 755 {} \;
  685.  
  686.   # strip scripts directory
  687.   find "${pkgdir}/usr/src/linux-${_kernver}/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
  688.     case "$(file -bi "${binary}")" in
  689.       *application/x-sharedlib*) # Libraries (.so)
  690.         /usr/bin/strip ${STRIP_SHARED} "${binary}";;
  691.       *application/x-archive*) # Libraries (.a)
  692.         /usr/bin/strip ${STRIP_STATIC} "${binary}";;
  693.       *application/x-executable*) # Binaries
  694.         /usr/bin/strip ${STRIP_BINARIES} "${binary}";;
  695.     esac
  696.   done
  697.  
  698.   # remove unneeded architectures
  699.   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}
  700.  
  701. # end c/p
  702. }
  703.  
  704. # Work around the AUR parser
  705. pkgdesc="Linux kernel and modules with the pf-kernel patch [-ck patchset (BFS included), TuxOnIce, BFQ] and aufs3"
  706.  
  707. # makepkg -g >>PKGBUILD
  708. sha256sums=('60a64d0bf76eeec3355f115c577935757b84629c8c129ce5b8bb02075f6b9458'
  709.             'eda59c55a7d2a3bd290b7b9477ce070cb0dbeef97db7619a01e75fabea80e9c5'
  710.             '543b171c09c6b20c4b651606c3c204ae61e145a9c6fc9754d0829d01604a45c5'
  711.             '82d660caa11db0cd34fd550a049d7296b4a9dcd28f2a50c81418066d6e598864'
  712.             '03ed4eb4a35d42ae6beaaa5e6fdbada4244ed6c343944bba6462defaa6fed0bf'
  713.             '51ea665cfec42d9f9c7796af2b060b7edbdeb367e42811f8c02667ad729f6b19'
  714.             '9e1e81d80afac6f316e53947e1b081017090081cd30e6c4c473420b77af4b52b'
  715.             'd537a358c9f8b9cbcad34ba99f88af070f54d99c66d3e5d3d4734576ed2fb6e1'
  716.             'b9d79ca33b0b51ff4f6976b7cd6dbb0b624ebf4fbf440222217f8ffc50445de4'
  717.             'ec53a9c0ac4c8a7e47a4a42371b9b08bd769bd3fca3440e6afab852566750a8d'
  718.             '01de250e398c4a8893eb0ac7dc952cf2847b3d8e0e4ed60ba2a3fa9c698ffbf9'
  719.             'f966ef51e338765d2a81b94f752b501edc0ce16df8c4f726f4414c0eb9c1a68b'
  720.             '53d34100897a84404fa2a70e7e91dff8c0c60c915c4ea59c87d2187692bd56aa')
Advertisement
Add Comment
Please, Sign In to add comment