This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

linux-pf - PKGBUILD

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