Advertisement
Thaodan

linux-pf PKGBUILD

Oct 27th, 2012
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 24.01 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=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.      BARCELONA)
  303.          pkgname="${pkgbase}-barcelona"
  304.          pkgdesc="${_pkgdesc} AMD Barcelona optimized."
  305.          ;;
  306.      BOBCAT)
  307.          pkgname="${pkgbase}-bobcat"
  308.          pkgdesc="${_pkgdesc} AMD Bobcat optimized"
  309.          ;;
  310.      BULLDOZER)
  311.          pkgname"${pkgbase}-bulldozer"
  312.          pkgdesc="${_pkgdesc} AMD Bulldozer optimized"
  313.          ;;
  314.      PILEDRIVER)
  315.          pkgname"${pkgbase}-piledriver"
  316.          pkgdesc="${_pkgdesc} AMD Piledriver optimized"
  317.          ;;
  318.      PSC)
  319.          pkgname="${pkgbase}-psc"
  320.          pkgdesc="${_pkgdesc} Intel Pentium4/D/Xeon optimized."
  321.          ;;
  322.      ATOM)
  323.          pkgname="${pkgbase}-atom"
  324.          pkgdesc="${_pkgdesc} Intel Atom optimized."
  325.          ;;
  326.      K7)
  327.          pkgname="${pkgbase}-k7"
  328.          pkgdesc="${_pkgdesc} AMD K7 optimized."
  329.          ;;
  330.      PENTIUMII)
  331.          pkgname="${pkgbase}-p2"
  332.          pkgdesc="${_pkgdesc} Intel Pentium2 optimized."
  333.          ;;
  334.      PENTIUMIII)
  335.          pkgname="${pkgbase}-p3"
  336.          pkgdesc="${_pkgdesc} Intel Pentium3 optimized."
  337.          ;;
  338.      PENTIUMM)
  339.          pkgname="${pkgbase}-pm"
  340.          pkgdesc="${_pkgdesc} Intel Pentium-M optimized."
  341.          ;;
  342.      PENTIUM4)
  343.          pkgname="${pkgbase}-p4"
  344.          pkgdesc="${_pkgdesc} Intel Pentium4 optimized."
  345.          ;;
  346.      COREI7)
  347.          pkgname="${pkgbase}-corei7"
  348.          pkgdesc="${_pkgdesc} Intel Core Nehalem optimized."
  349.          ;;
  350.      COREI7AVX)
  351.          pkgname="${pkgbase}-corei7avx"
  352.          pkgdesc="${_pkgdesc} Intel 2nd Gen Core processors including Sandy Bridge."
  353.          ;;
  354.      COREAVXI)
  355.          pkgname="${pkgbase}-coreavxi"
  356.          pkgdesc="${_pkgdesc} Intel 3rd Gen Core processors including Ivy Bridge."
  357.          ;;
  358.      COREAVX2)
  359.          pkgname="${pkgbase}-coreavx2"
  360.          pkgdesc="${_pkgdesc} Intel AVX-2 processors including Haswell."
  361.          ;;
  362.      default)
  363.   # Note to me: DO NOT EVER REMOVE THIS. It's for the AUR PKGBUILD parser.
  364.          pkgname="${pkgbase}"
  365.          pkgdesc="Linux kernel and modules with the pf-kernel patch [-ck patchset (BFS included), TuxOnIce, BFQ] and aufs3"
  366.          ;;
  367.     esac
  368.  
  369.  
  370.   # If optimized build, conflict with generic and other optimized ones
  371.  
  372.   if [[ "$pkgname" != "$pkgbase" ]]; then
  373.         pkgnameopt="${pkgname}"         # this MUST be inside this if-fi
  374.         pkgname="${pkgbase}"
  375.         echo pkgname $pkgname
  376.         cpuopt=`sed -e "s/linux-pf-//" <<<$pkgnameopt`          # get suffix
  377.         cpuoptdesc=`sed -e "s/${_pkgdesc}//" <<<$pkgdesc`       # get description
  378.         conflicts=(${conflicts[@]/linux-pf-${cpuopt}/})         # remove current
  379.         conflicts=(${conflicts[@]/linux-pf-headers-${cpuopt}/}) # remove current's headers
  380.         export cpuopt cpuoptdesc
  381.   fi
  382.  
  383.   # second batch check ends here
  384.  fi
  385.  
  386.  # Pass conflicts array to linux-pf-headers() BEFORE adding generic linux-pf or headers will conflict
  387.  export _conflicts=${conflicts[@]}
  388.  conflicts=('linux-pf' 'kernel26-pf' ${conflicts[@]})   # add generic packages
  389.  
  390.   echo
  391.   echo "    ======================================="
  392.   msg  "The packages will be named ${pkgnameopt}"
  393.   msg  "and ${pkgname}-${headers}"
  394.   msg  "${pkgdesc}"
  395.   echo "    ======================================="
  396.   echo
  397.  
  398.  ### package_linux-pf
  399.  
  400.   cd "${srcdir}/linux-${_basekernel}"
  401.  
  402.   KARCH=x86
  403.  
  404.   echo # get kernel version
  405.   _kernver="$(make kernelrelease)"
  406.  
  407.   ### c/p from linux-ARCH
  408.  
  409.   mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot}
  410.   make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}" modules_install
  411.   cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}"
  412.  
  413.   # add vmlinux
  414.   install -D -m644 vmlinux "${pkgdir}/usr/src/linux-${_kernver}/vmlinux"
  415.  
  416.   # install fallback mkinitcpio.conf file and preset file for kernel
  417.   install -D -m644 "${srcdir}/${pkgbase}.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
  418.  
  419.   # set correct depmod command for install
  420.   sed \
  421.     -e  "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/" \
  422.     -e  "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/" \
  423.     -i "${startdir}/${pkgbase}.install"
  424.   sed \
  425.     -e "1s|'linux.*'|'${pkgbase}'|" \
  426.     -e "s|ALL_kver=.*|ALL_kver=\"/boot/vmlinuz-${pkgbase}\"|" \
  427.     -e "s|default_image=.*|default_image=\"/boot/initramfs-${pkgbase}.img\"|" \
  428.     -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs-${pkgbase}-fallback.img\"|" \
  429.     -i "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
  430.  
  431.   # remove build and source links
  432.   rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build}
  433.   # remove the firmware
  434.   rm -rf "${pkgdir}/lib/firmware"
  435.   # gzip -9 all modules to save 100MB of space
  436.   find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \;
  437.   # make room for external modules
  438.   ln -s "../extramodules-${_basekernel}${_kernelname:--pf}" "${pkgdir}/lib/modules/${_kernver}/extramodules"
  439.   # add real version for building modules and running depmod from post_install/upgrade
  440.   mkdir -p "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--pf}"
  441.   echo "${_kernver}" > "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--pf}/version"
  442.  
  443.   echo # Now we call depmod... in $pkgdir
  444.   depmod -b "$pkgdir" -F System.map "$_kernver"
  445.  
  446.   # move module tree /lib -> /usr/lib
  447.   mv "$pkgdir/lib" "$pkgdir/usr"
  448.  
  449. # end c/p
  450.  
  451.   ###
  452.   # Trick the AUR parser to accept split PKGBUILD
  453.   true && pkgname="${pkgnameopt}"
  454. }
  455.  
  456. ### package_linux-pf-headers
  457. package_linux-pf-headers() {
  458.   pkgdesc="Header files and scripts for building modules for linux-pf kernel."
  459.   depends=('linux-pf')
  460.   IFS=' ' read -a conflicts <<<${_conflicts}
  461.   [[ ${cpuopt} ]] && pkgname=${pkgname}-${cpuopt} && depends=${depends}-${cpuopt}
  462.   [[ ${cpuoptdesc} ]] && pkgdesc=${pkgdesc}${cpuoptdesc}
  463.  
  464.   provides=('linux-pf-headers')
  465.   cd "${srcdir}/linux-${_basekernel}"
  466. # c/p from linux-ARCH
  467.  
  468.   install -dm755 "${pkgdir}/usr/lib/modules/${_kernver}"
  469.  
  470.   cd "${pkgdir}/usr/lib/modules/${_kernver}"
  471.   ln -sf ../../../src/linux-${_kernver} build
  472.  
  473.  
  474.   cd "${srcdir}/${_srcname}"
  475.   install -D -m644 Makefile \
  476.     "${pkgdir}/usr/src/linux-${_kernver}/Makefile"
  477.   install -D -m644 kernel/Makefile \
  478.     "${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile"
  479.   install -D -m644 .config \
  480.     "${pkgdir}/usr/src/linux-${_kernver}/.config"
  481.  
  482.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include"
  483.  
  484.   for i in acpi asm-generic config crypto drm generated linux math-emu \
  485.     media mtd net pcmcia scsi sound trace video xen; do
  486.     cp -a include/${i} "${pkgdir}/usr/src/linux-${_kernver}/include/"
  487.   done
  488.  
  489.   # copy arch includes for external modules
  490.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/x86"
  491.   cp -a arch/x86/include "${pkgdir}/usr/src/linux-${_kernver}/arch/x86/"
  492.  
  493.   # copy files necessary for later builds, like nvidia and vmware
  494.   cp Module.symvers "${pkgdir}/usr/src/linux-${_kernver}"
  495.   cp -a scripts "${pkgdir}/usr/src/linux-${_kernver}"
  496.  
  497.   # fix permissions on scripts dir
  498.   chmod og-w -R "${pkgdir}/usr/src/linux-${_kernver}/scripts"
  499.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions"
  500.  
  501.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel"
  502.  
  503.   cp arch/${KARCH}/Makefile "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
  504.  
  505.   if [ "${CARCH}" = "i686" ]; then
  506.     cp arch/${KARCH}/Makefile_32.cpu "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
  507.   fi
  508.  
  509.   cp arch/${KARCH}/kernel/asm-offsets.s "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel/"
  510.  
  511.   # add headers for lirc package
  512.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video"
  513.  
  514.   cp drivers/media/video/*.h  "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/"
  515.  
  516.   for i in bt8xx cpia2 cx25840 cx88 em28xx pwc saa7134 sn9c102; do
  517.     mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
  518.     cp -a drivers/media/video/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
  519.   done
  520.  
  521.   # add docbook makefile
  522.   install -D -m644 Documentation/DocBook/Makefile \
  523.     "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
  524.  
  525.   # add dm headers
  526.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
  527.   cp drivers/md/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
  528.  
  529.   # add inotify.h
  530.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/linux"
  531.   cp include/linux/inotify.h "${pkgdir}/usr/src/linux-${_kernver}/include/linux/"
  532.  
  533.   # add wireless headers
  534.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
  535.   cp net/mac80211/*.h "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
  536.  
  537.   # add dvb headers for external modules
  538.   # in reference to:
  539.   # http://bugs.archlinux.org/task/9912
  540.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core"
  541.   cp drivers/media/dvb/dvb-core/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/"
  542.   # and...
  543.   # http://bugs.archlinux.org/task/11194
  544.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
  545.   cp include/config/dvb/*.h "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
  546.  
  547.   # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
  548.   # in reference to:
  549.   # http://bugs.archlinux.org/task/13146
  550.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  551.   cp drivers/media/dvb/frontends/lgdt330x.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  552.   cp drivers/media/video/msp3400-driver.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  553.  
  554.   # add dvb headers
  555.   # in reference to:
  556.   # http://bugs.archlinux.org/task/20402
  557.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb"
  558.   cp drivers/media/dvb/dvb-usb/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/"
  559.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends"
  560.   cp drivers/media/dvb/frontends/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  561.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners"
  562.   cp drivers/media/common/tuners/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners/"
  563.  
  564.   # add xfs and shmem for aufs building
  565.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs"
  566.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/mm"
  567.   cp fs/xfs/xfs_sb.h "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h"
  568.  
  569.   # copy in Kconfig files
  570.   for i in `find . -name "Kconfig*"`; do
  571.     mkdir -p "${pkgdir}"/usr/src/linux-${_kernver}/`echo ${i} | sed 's|/Kconfig.*||'`
  572.     cp ${i} "${pkgdir}/usr/src/linux-${_kernver}/${i}"
  573.   done
  574.  
  575.   chown -R root.root "${pkgdir}/usr/src/linux-${_kernver}"
  576.   find "${pkgdir}/usr/src/linux-${_kernver}" -type d -exec chmod 755 {} \;
  577.  
  578.   # strip scripts directory
  579.   find "${pkgdir}/usr/src/linux-${_kernver}/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
  580.     case "$(file -bi "${binary}")" in
  581.       *application/x-sharedlib*) # Libraries (.so)
  582.         /usr/bin/strip ${STRIP_SHARED} "${binary}";;
  583.       *application/x-archive*) # Libraries (.a)
  584.         /usr/bin/strip ${STRIP_STATIC} "${binary}";;
  585.       *application/x-executable*) # Binaries
  586.         /usr/bin/strip ${STRIP_BINARIES} "${binary}";;
  587.     esac
  588.   done
  589.  
  590.   # remove unneeded architectures
  591.   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}
  592.  
  593. # end c/p
  594. }
  595.  
  596. # Work around the AUR parser
  597. pkgdesc="Linux kernel and modules with the pf-kernel patch [-ck patchset (BFS included), TuxOnIce, BFQ] and aufs3"
  598.  
  599. # makepkg -g >>PKGBUILD
  600. sha256sums=('4ab9a6ef1c1735713f9f659d67f92efa7c1dfbffb2a2ad544005b30f9791784f'
  601.             'a6b99e5d4fc365d1dad3f7b65d699fabe460502bc5eaabbcf1e0d92b0817980b'
  602.             '9fb39ec5317a1aa8d972d269a6b4de2b44ce7bbafd54bbacd9d83b1417f64867'
  603.             '82d660caa11db0cd34fd550a049d7296b4a9dcd28f2a50c81418066d6e598864'
  604.             '03ed4eb4a35d42ae6beaaa5e6fdbada4244ed6c343944bba6462defaa6fed0bf'
  605.             '51ea665cfec42d9f9c7796af2b060b7edbdeb367e42811f8c02667ad729f6b19'
  606.             '9e1e81d80afac6f316e53947e1b081017090081cd30e6c4c473420b77af4b52b'
  607.             'd537a358c9f8b9cbcad34ba99f88af070f54d99c66d3e5d3d4734576ed2fb6e1'
  608.             'b9d79ca33b0b51ff4f6976b7cd6dbb0b624ebf4fbf440222217f8ffc50445de4'
  609.             'c49eca2478b7d911ee95a61c3f9080082b982ba4de34b9acff9b1ff2d5224957'
  610.             'f9cf30022dcb86a70891c5c1f64713fa4da108beec72e5e264942c674268a6b6'
  611.             '8f2dad5b89dac8c76c3dd3ad902928d6032ec2c6ada41d873d752bad5586b154')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement