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

Untitled

By: a guest on Nov 10th, 2011  |  syntax: None  |  size: 11.37 KB  |  views: 45  |  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: Ray Rashif <schiv@archlinux.org>
  2. # Contributor: timbosa <tinny_tim@dodo.com.au>
  3. # Contributor: Tobias Powalowski <tpowa@archlinux.org>
  4. # Contributor: Thomas Baechler <thomas@archlinux.org>
  5.  
  6. pkgname=linux-rt
  7. _kernelname=${pkgname#linux}
  8. _basekernel=3.0
  9. _rtpatch=rt23
  10. pkgver=${_basekernel}.8_$_rtpatch
  11. _pkgver=${_basekernel}.8
  12. pkgrel=1
  13. arch=('i686' 'x86_64')
  14. url="http://rt.wiki.kernel.org/"
  15. license=('GPL2')
  16. pkgdesc="The Linux Kernel and modules (with realtime preemption)"
  17. options=(!strip)
  18. backup=(etc/mkinitcpio.d/${pkgname}.preset)
  19. depends=('coreutils' 'linux-firmware' 'module-init-tools>=3.16' 'mkinitcpio>=0.7')
  20. optdepends=('crda: to set the correct wireless channels of your country')
  21. provides=('kernel26rt')
  22. conflicts=('kernel26rt')
  23. replaces=('kernel26rt')
  24. install=${pkgname}.install
  25. source=(#"ftp://ftp.kernel.org/pub/linux/kernel/v3.0/linux-${_basekernel}.tar.bz2"
  26.         "http://ftp.jaist.ac.jp/pub/Linux/kernel.org/linux/kernel/v3.x/linux-${_basekernel}.tar.bz2"
  27.         "ftp://ftp.kernel.org/pub/linux/kernel/v3.0/patch-${_pkgver}.bz2"
  28.                 #"ftp://ftp.archlinux.org/other/linux/patch-${_pkgver}.gz"
  29.         #"ftp://ftp.kernel.org/pub/linux/kernel/projects/rt/patch-${_pkgver}-${_rtpatch}.patch.bz2"
  30.                 "http://tglx.de/~tglx/rt/patch-${_pkgver}-${_rtpatch}.patch.gz"
  31.         # the main kernel config files
  32.         'config' 'config.x86_64'
  33.         # standard config files for mkinitcpio ramdisk
  34.         "${pkgname}.preset"
  35.         'fix-i915.patch'
  36.         'change-default-console-loglevel.patch')
  37.  
  38. build() {
  39.   cd "${srcdir}/linux-${_basekernel}"
  40.  
  41.   patch -p1 -i "${srcdir}/patch-${_pkgver}"
  42.  
  43.   # add realtime patch
  44.   patch -p1 -i "${srcdir}/patch-${_pkgver}-$_rtpatch.patch"
  45.  
  46.   # enable building proprietary nvidia driver against full rt preemption
  47.   # WARNING: GPL-INCOMPATIBLE
  48.   #sed -i \
  49.   #       's/EXPORT_SYMBOL_GPL(migrate_enable);/EXPORT_SYMBOL(migrate_enable);/' \
  50.   #       kernel/sched.c
  51.   #
  52.   #sed -i \
  53.   #       's/EXPORT_SYMBOL_GPL(migrate_disable);/EXPORT_SYMBOL(migrate_disable);/' \
  54.   #       kernel/sched.c
  55.   #
  56.   #sed -i \
  57.   #       's/EXPORT_SYMBOL_GPL(__rt_mutex_init);/EXPORT_SYMBOL(__rt_mutex_init);/' \
  58.   #       kernel/rtmutex.c
  59.  
  60.   # add latest fixes from stable queue, if needed
  61.   # http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
  62.  
  63.   # fix #19234 i1915 display size
  64.   patch -Np1 -i "${srcdir}/fix-i915.patch"
  65.  
  66.   # set DEFAULT_CONSOLE_LOGLEVEL to 4 (same value as the 'quiet' kernel param)
  67.   # remove this when a Kconfig knob is made available by upstream
  68.   # (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227)
  69.   patch -Np1 -i "${srcdir}/change-default-console-loglevel.patch"
  70.  
  71.   if [ "${CARCH}" = "x86_64" ]; then
  72.     cat "${srcdir}/config.x86_64" > ./.config
  73.   else
  74.     cat "${srcdir}/config" > ./.config
  75.   fi
  76.  
  77.   if [ "${_kernelname}" != "" ]; then
  78.     sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
  79.   fi
  80.  
  81.   # remove the sublevel from Makefile
  82.   # this ensures our kernel version is always 3.X-ARCH
  83.   # this way, minor kernel updates will not break external modules
  84.   # we need to change this soon, see FS#16702
  85.   sed -ri 's|^(SUBLEVEL =).*|\1|' Makefile
  86.  
  87.   # get kernel version
  88.   rm localversion-rt
  89.   make prepare
  90.  
  91.   # load configuration
  92.   # Configure the kernel. Replace the line below with one of your choice.
  93.   #make menuconfig # CLI menu for configuration
  94.   #make nconfig # new CLI menu for configuration
  95.   #make xconfig # X-based configuration
  96.   #make oldconfig # using old config from previous kernel version
  97.   # ... or manually edit .config
  98.  
  99.   ####################
  100.   # stop here
  101.   # this is useful to configure the kernel
  102.   #msg "Stopping build"
  103.   #return 1
  104.   ####################
  105.  
  106.   yes "" | make config
  107.  
  108.   # build!
  109.   make ${MAKEFLAGS} bzImage modules
  110. }
  111.  
  112. package() {
  113.   cd "${srcdir}/linux-${_basekernel}"
  114.  
  115.   KARCH=x86
  116.  
  117.   # get kernel version
  118.   _kernver="$(make kernelrelease)"
  119.  
  120.   mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot}
  121.   make INSTALL_MOD_PATH="${pkgdir}" modules_install
  122.   cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgname}"
  123.  
  124.   # add vmlinux
  125.   install -D -m644 vmlinux "${pkgdir}/usr/src/linux-${_kernver}/vmlinux"
  126.  
  127.   # install fallback mkinitcpio.conf file and preset file for kernel
  128.   install -D -m644 "${srcdir}/${pkgname}.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset"
  129.  
  130.   # set correct depmod command for install
  131.   sed \
  132.     -e  "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
  133.     -e  "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
  134.     -i "${startdir}/${pkgname}.install"
  135.   sed \
  136.         -e "s|ALL_kver=.*|ALL_kver=\"/boot/vmlinuz-${pkgname}\"|g" \
  137.     -e "s|default_image=.*|default_image=\"/boot/initramfs-${pkgname}.img\"|g" \
  138.     -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs-${pkgname}-fallback.img\"|g" \
  139.     -i "${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset"
  140.  
  141.   # remove build and source links
  142.   rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build}
  143.   # remove the firmware
  144.   rm -rf "${pkgdir}/lib/firmware"
  145.   # gzip -9 all modules to safe 100MB of space
  146.   find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \;
  147.  
  148.   ## -- headers --##
  149.   mkdir -p "${pkgdir}/lib/modules/${_kernver}"
  150.  
  151.   cd "${pkgdir}/lib/modules/${_kernver}"
  152.   ln -sf ../../../usr/src/linux-${_kernver} build
  153.  
  154.   cd "${srcdir}/linux-${_basekernel}"
  155.   install -D -m644 Makefile \
  156.     "${pkgdir}/usr/src/linux-${_kernver}/Makefile"
  157.   install -D -m644 kernel/Makefile \
  158.     "${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile"
  159.   install -D -m644 .config \
  160.     "${pkgdir}/usr/src/linux-${_kernver}/.config"
  161.  
  162.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include"
  163.  
  164.   for i in acpi asm-generic config crypto drm generated linux math-emu \
  165.     media net pcmcia scsi sound trace video xen; do
  166.     cp -a include/${i} "${pkgdir}/usr/src/linux-${_kernver}/include/"
  167.   done
  168.  
  169.   # copy arch includes for external modules
  170.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/x86"
  171.   cp -a arch/x86/include "${pkgdir}/usr/src/linux-${_kernver}/arch/x86/"
  172.  
  173.   # copy files necessary for later builds, like nvidia and vmware
  174.   cp Module.symvers "${pkgdir}/usr/src/linux-${_kernver}"
  175.   cp -a scripts "${pkgdir}/usr/src/linux-${_kernver}"
  176.  
  177.   # fix permissions on scripts dir
  178.   chmod og-w -R "${pkgdir}/usr/src/linux-${_kernver}/scripts"
  179.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions"
  180.  
  181.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel"
  182.  
  183.   cp arch/${KARCH}/Makefile "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
  184.  
  185.   if [ "${CARCH}" = "i686" ]; then
  186.     cp arch/${KARCH}/Makefile_32.cpu "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
  187.   fi
  188.  
  189.   cp arch/${KARCH}/kernel/asm-offsets.s "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel/"
  190.  
  191.   # add headers for lirc package
  192.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video"
  193.  
  194.   cp drivers/media/video/*.h  "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/"
  195.  
  196.   for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102; do
  197.     mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
  198.     cp -a drivers/media/video/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
  199.   done
  200.  
  201.   # add docbook makefile
  202.   install -D -m644 Documentation/DocBook/Makefile \
  203.     "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
  204.  
  205.   # add dm headers
  206.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
  207.   cp drivers/md/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
  208.  
  209.   # add inotify.h
  210.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/linux"
  211.   cp include/linux/inotify.h "${pkgdir}/usr/src/linux-${_kernver}/include/linux/"
  212.  
  213.   # add wireless headers
  214.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
  215.   cp net/mac80211/*.h "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
  216.  
  217.   # add dvb headers for external modules
  218.   # in reference to:
  219.   # http://bugs.archlinux.org/task/9912
  220.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core"
  221.   cp drivers/media/dvb/dvb-core/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/"
  222.   # and...
  223.   # http://bugs.archlinux.org/task/11194
  224.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
  225.   cp include/config/dvb/*.h "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
  226.  
  227.   # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
  228.   # in reference to:
  229.   # http://bugs.archlinux.org/task/13146
  230.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  231.   cp drivers/media/dvb/frontends/lgdt330x.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  232.   cp drivers/media/video/msp3400-driver.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  233.  
  234.   # add dvb headers
  235.   # in reference to:
  236.   # http://bugs.archlinux.org/task/20402
  237.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb"
  238.   cp drivers/media/dvb/dvb-usb/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/"
  239.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends"
  240.   cp drivers/media/dvb/frontends/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  241.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners"
  242.   cp drivers/media/common/tuners/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners/"
  243.  
  244.   # add xfs and shmem for aufs building
  245.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs"
  246.   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/mm"
  247.   cp fs/xfs/xfs_sb.h "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h"
  248.  
  249.   # copy in Kconfig files
  250.   for i in `find . -name "Kconfig*"`; do
  251.     mkdir -p "${pkgdir}"/usr/src/linux-${_kernver}/`echo ${i} | sed 's|/Kconfig.*||'`
  252.     cp ${i} "${pkgdir}/usr/src/linux-${_kernver}/${i}"
  253.   done
  254.  
  255.   chown -R root.root "${pkgdir}/usr/src/linux-${_kernver}"
  256.   find "${pkgdir}/usr/src/linux-${_kernver}" -type d -exec chmod 755 {} \;
  257.  
  258.   # strip scripts directory
  259.   find "${pkgdir}/usr/src/linux-${_kernver}/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
  260.     case "$(file -bi "${binary}")" in
  261.       *application/x-sharedlib*) # Libraries (.so)
  262.         /usr/bin/strip ${STRIP_SHARED} "${binary}";;
  263.       *application/x-archive*) # Libraries (.a)
  264.         /usr/bin/strip ${STRIP_STATIC} "${binary}";;
  265.       *application/x-executable*) # Binaries
  266.         /usr/bin/strip ${STRIP_BINARIES} "${binary}";;
  267.     esac
  268.   done
  269.  
  270.   # remove unneeded architectures
  271.   rm -rf "${pkgdir}"/usr/src/linux-${_kernver}/arch/{alpha,arm,arm26,avr32,blackfin,cris,frv,h8300,ia64,m32r,m68k,m68knommu,mips,microblaze,mn10300,parisc,powerpc,ppc,s390,sh,sh64,sparc,sparc64,um,v850,xtensa}
  272.  
  273.   ## -- docs --##
  274.   rm -r "${pkgdir}/usr/src/linux-${_kernver}/Documentation"
  275.   mv Documentation "${pkgdir}/usr/src/linux-${_kernver}"
  276.   find "${pkgdir}" -type f -exec chmod 444 {} \;
  277.   find "${pkgdir}" -type d -exec chmod 755 {} \;
  278.  
  279.   # remove a file already in linux package
  280.   rm -f "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
  281. }
  282.  
  283. # vim:set ts=2 sw=2 et:
  284. md5sums=('398e95866794def22b12dfbc15ce89c0'
  285.          '9d003f28c02ed5625693693cd9f6004b'
  286.          '7e9bce66480c96e641240c082eb48540'
  287.          '8bed8efe88e4fa1781d1f307f35f9b26'
  288.          'a542f23e4f270967b3e8a871e69d0a61'
  289.          'eb14dcfd80c00852ef81ded6e826826a'
  290.          '263725f20c0b9eb9c353040792d644e5'
  291.          '9d3c56a4b999c8bfbd4018089a62f662')
  292.  
clone this paste RAW Paste Data