Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: Bash  |  size: 11.85 KB  |  hits: 55  |  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. # $Id: PKGBUILD 130991 2011-07-09 12:23:51Z thomas $
  2. # Maintainer: Tobias Powalowski <tpowa@archlinux.org>
  3. # Maintainer: Thomas Baechler <thomas@archlinux.org>
  4.  
  5. pkgbase=linux-joggler
  6. pkgname=(linux-joggler linux-joggler-headers)
  7. _kernelname=${pkgname#linux}
  8. _basekernel=3.2
  9. pkgver=${_basekernel}.8
  10. pkgrel=1
  11. arch=('i686' 'x86_64')
  12. url="http://www.kernel.org/"
  13. license=('GPL2')
  14. makedepends=('xmlto' 'docbook-xsl')
  15. options=('!strip')
  16. source=("http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.2.tar.xz"
  17.         "http://www.kernel.org/pub/linux/kernel/v3.x/patch-${pkgver}.xz"
  18.         # the main kernel config files
  19.         'config' 'config.x86_64'
  20.         # standard config files for mkinitcpio ramdisk
  21.         "${pkgname}.preset"
  22.         'change-default-console-loglevel.patch'
  23.         'i915-fix-ghost-tv-output.patch'
  24.         'i915-gpu-finish.patch'
  25.         'ext4-options.patch'
  26.         'joggler-backlight-control-3.2.patch'
  27.         'joggler-i2c-3.2.patch'
  28.         'joggler-sound-3.2.patch')
  29. md5sums=('364066fa18767ec0ae5f4e4abcf9dc51'
  30.          '417b97cdd9e8b2664eb31260dbbcdc72'
  31.          'c59de3f11622bd05d503b618897b8fbc'
  32.          '2182f8e0de70498130f7d9d770092c73'
  33.          'eb14dcfd80c00852ef81ded6e826826a'
  34.          '9d3c56a4b999c8bfbd4018089a62f662'
  35.          '263725f20c0b9eb9c353040792d644e5'
  36.          '4cd79aa147825837dc8bc9f6b736c0a0'
  37.          'c8299cf750a84e12d60b372c8ca7e1e8'
  38.          '0bf4ed77ad915ecae5daf3c6ca0f6578'
  39.          'c7563db8320b3ae7133d701752bffedf'
  40.          '20ec5d428ad4e757e757f0ecaab02db4')
  41. CARCH="i686"
  42.  
  43. build() {
  44.   cd "${srcdir}/linux-${_basekernel}"
  45.  
  46.   export KARCH="x86"
  47.   export ARCH="x86"
  48.  
  49.   # add upstream patch
  50.   patch -p1 -i "${srcdir}/patch-${pkgver}"
  51.  
  52.   # add latest fixes from stable queue, if needed
  53.   # http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
  54.  
  55.   # fix FS#27883
  56.   # drm/i915: Only clear the GPU domains upon a successful finish
  57.   patch -Np1 -i "${srcdir}/i915-gpu-finish.patch"
  58.  
  59.   # Some chips detect a ghost TV output
  60.   # mailing list discussion: http://lists.freedesktop.org/archives/intel-gfx/2011-April/010371.html
  61.   # Arch Linux bug report: FS#19234
  62.   #
  63.   # It is unclear why this patch wasn't merged upstream, it was accepted,
  64.   # then dropped because the reasoning was unclear. However, it is clearly
  65.   # needed.
  66.   patch -Np1 -i "${srcdir}/i915-fix-ghost-tv-output.patch"
  67.  
  68.   # set DEFAULT_CONSOLE_LOGLEVEL to 4 (same value as the 'quiet' kernel param)
  69.   # remove this when a Kconfig knob is made available by upstream
  70.   # (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227)
  71.   patch -Np1 -i "${srcdir}/change-default-console-loglevel.patch"
  72.  
  73.   # fix ext4 module to mount ext3/2 correct
  74.   # https://bugs.archlinux.org/task/28653
  75.   patch -Np1 -i "${srcdir}/ext4-options.patch"
  76.  
  77.   if [ "${CARCH}" = "x86_64" ]; then
  78.     cat "${srcdir}/config.x86_64" > ./.config
  79.   else
  80.     cat "${srcdir}/config" > ./.config
  81.   fi
  82.  
  83.   patch -Np1 -i "${srcdir}/joggler-backlight-control-3.2.patch"
  84.   patch -Np1 -i "${srcdir}/joggler-sound-3.2.patch"
  85.   patch -Np1 -i "${srcdir}/joggler-i2c-3.2.patch"
  86.  
  87.   if [ "${_kernelname}" != "" ]; then
  88.     sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
  89.   fi
  90.  
  91.   # set extraversion to pkgrel
  92.   sed -ri "s|^(EXTRAVERSION =).*|\1 -${pkgrel}|" Makefile
  93.  
  94.   # get kernel version
  95.   make prepare
  96.  
  97.   # load configuration
  98.   # Configure the kernel. Replace the line below with one of your choice.
  99.   #make menuconfig # CLI menu for configuration
  100.   #make nconfig # new CLI menu for configuration
  101.   #make xconfig # X-based configuration
  102.   #make oldconfig # using old config from previous kernel version
  103.   # ... or manually edit .config
  104.  
  105.   ####################
  106.   # stop here
  107.   # this is useful to configure the kernel
  108.   #msg "Stopping build"
  109.   #return 1
  110.   ####################
  111.  
  112.   yes "" | make config
  113.  
  114.   # build!
  115.   make ${MAKEFLAGS} bzImage modules
  116. }
  117.  
  118. package_linux-joggler() {
  119.   pkgdesc="The Linux Kernel, modules, headers and scripts customised for the O2 Joggler"
  120.   groups=('base')
  121.   depends=('coreutils' 'linux-firmware' 'module-init-tools>=3.16' 'mkinitcpio>=0.7')
  122.   optdepends=('crda: to set the correct wireless channels of your country')
  123.   provides=('kernel26')
  124.   conflicts=('kernel26')
  125.   replaces=('kernel26')
  126.   backup=("etc/mkinitcpio.d/${pkgname}.preset")
  127.   install=${pkgname}.install
  128.  
  129.   cd "${srcdir}/linux-${_basekernel}"
  130.  
  131.   export KARCH="x86"
  132.   export ARCH="x86"
  133.  
  134.   # get kernel version
  135.   _kernver="$(make kernelrelease)"
  136.  
  137.   mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot}
  138.   make INSTALL_MOD_PATH="${pkgdir}" modules_install
  139.   cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgname}"
  140.  
  141.   # add vmlinux
  142.   install -D -m644 vmlinux "${pkgdir}/usr/src/linux-${_kernver}/vmlinux"
  143.  
  144.   # install fallback mkinitcpio.conf file and preset file for kernel
  145.   install -D -m644 "${srcdir}/${pkgname}.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset"
  146.  
  147.   # set correct depmod command for install
  148.   sed \
  149.     -e  "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
  150.     -e  "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
  151.     -i "${startdir}/${pkgname}.install"
  152.   sed \
  153.     -e "s|ALL_kver=.*|ALL_kver=\"/boot/vmlinuz-${pkgname}\"|g" \
  154.     -e "s|default_image=.*|default_image=\"/boot/initramfs-${pkgname}.img\"|g" \
  155.     -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs-${pkgname}-fallback.img\"|g" \
  156.     -i "${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset"
  157.  
  158.   # remove build and source links
  159.   rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build}
  160.   # remove the firmware
  161.   rm -rf "${pkgdir}/lib/firmware"
  162.   # gzip -9 all modules to save 100MB of space
  163.   find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \;
  164.   # make room for external modules
  165.   ln -s "../extramodules-${_basekernel}${_kernelname:--ARCH}" "${pkgdir}/lib/modules/${_kernver}/extramodules"
  166.   # add real version for building modules and running depmod from post_install/upgrade
  167.   mkdir -p "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--ARCH}"
  168.   echo "${_kernver}" > "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--ARCH}/version"
  169.  
  170.   cd "${pkgdir}/lib/modules/${_kernver}"
  171.   ln -sf ../../../usr/src/linux-${pkgver}-${pkgrel}-ARCH build
  172. }
  173.  
  174. package_linux-joggler-headers() {
  175.         _Hpkgdesc='Header files and scripts to build modules for linux-ck.'
  176.         pkgdesc="${_Hpkgdesc}"
  177.         provides=("linux-joggler-headers=${pkgver}")
  178.  
  179.         export KARCH="x86"
  180.         export ARCH="x86"
  181.  
  182.         mkdir -p "${pkgdir}/lib/modules/${_kernver}"
  183.  
  184.         cd "${pkgdir}/lib/modules/${_kernver}"
  185.         ln -sf ../../../usr/src/linux-${_kernver} build
  186.  
  187.         cd "${srcdir}/linux-${_basekernel}"
  188.         install -D -m644 Makefile \
  189.                 "${pkgdir}/usr/src/linux-${_kernver}/Makefile"
  190.         install -D -m644 kernel/Makefile \
  191.                 "${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile"
  192.         install -D -m644 .config \
  193.                 "${pkgdir}/usr/src/linux-${_kernver}/.config"
  194.  
  195.         mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include"
  196.  
  197.         for i in acpi asm-generic config crypto drm generated linux math-emu \
  198.                 media net pcmcia scsi sound trace video xen; do
  199.                 cp -a include/${i} "${pkgdir}/usr/src/linux-${_kernver}/include/"
  200.         done
  201.  
  202.         # copy arch includes for external modules
  203.         mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/x86"
  204.         cp -a arch/x86/include "${pkgdir}/usr/src/linux-${_kernver}/arch/x86/"
  205.  
  206.         # copy files necessary for later builds, like nvidia and vmware
  207.         cp Module.symvers "${pkgdir}/usr/src/linux-${_kernver}"
  208.         cp -a scripts "${pkgdir}/usr/src/linux-${_kernver}"
  209.  
  210.         # fix permissions on scripts dir
  211.         chmod og-w -R "${pkgdir}/usr/src/linux-${_kernver}/scripts"
  212.         mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions"
  213.        
  214.         mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel"
  215.  
  216.         cp arch/${KARCH}/Makefile "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
  217.  
  218.         if [ "${CARCH}" = "i686" ]; then
  219.                 cp arch/${KARCH}/Makefile_32.cpu "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
  220.         fi
  221.  
  222.         cp arch/${KARCH}/kernel/asm-offsets.s "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel/"
  223.  
  224.         # add headers for lirc package
  225.         mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video"
  226.  
  227.         cp drivers/media/video/*.h  "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/"
  228.  
  229.         for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102; do
  230.                 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
  231.                 cp -a drivers/media/video/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
  232.         done
  233.  
  234.         # add docbook makefile
  235.         install -D -m644 Documentation/DocBook/Makefile \
  236.         "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
  237.  
  238.         # add dm headers
  239.         mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
  240.         cp drivers/md/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
  241.  
  242.         # add inotify.h
  243.         mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/linux"
  244.         cp include/linux/inotify.h "${pkgdir}/usr/src/linux-${_kernver}/include/linux/"
  245.  
  246.         # add wireless headers
  247.         mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
  248.         cp net/mac80211/*.h "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
  249.  
  250.         # add dvb headers for external modules
  251.         # in reference to:
  252.         # http://bugs.archlinux.org/task/9912
  253.         mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core"
  254.         cp drivers/media/dvb/dvb-core/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/"
  255.         # and...
  256.         # http://bugs.archlinux.org/task/11194
  257.         mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
  258.         [[ -e include/config/dvb/ ]] && cp include/config/dvb/*.h "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
  259.  
  260.         # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
  261.         # in reference to:
  262.         # http://bugs.archlinux.org/task/13146
  263.         mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  264.         cp drivers/media/dvb/frontends/lgdt330x.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  265.         cp drivers/media/video/msp3400-driver.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  266.  
  267.         # add dvb headers
  268.         # in reference to:
  269.         # http://bugs.archlinux.org/task/20402
  270.         mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb"
  271.         cp drivers/media/dvb/dvb-usb/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/"
  272.         mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends"
  273.         cp drivers/media/dvb/frontends/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  274.         mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners"
  275.         cp drivers/media/common/tuners/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners/"
  276.  
  277.         # add xfs and shmem for aufs building
  278.         mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs"
  279.         mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/mm"
  280.         cp fs/xfs/xfs_sb.h "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h"
  281.  
  282.         # copy in Kconfig files
  283.         for i in `find . -name "Kconfig*"`; do
  284.                 mkdir -p "${pkgdir}"/usr/src/linux-${_kernver}/`echo ${i} | sed 's|/Kconfig.*||'`
  285.                 cp ${i} "${pkgdir}/usr/src/linux-${_kernver}/${i}"
  286.         done
  287.  
  288.         chown -R root.root "${pkgdir}/usr/src/linux-${_kernver}"
  289.         find "${pkgdir}/usr/src/linux-${_kernver}" -type d -exec chmod 755 {} \;
  290.  
  291.         # strip scripts directory
  292.         find "${pkgdir}/usr/src/linux-${_kernver}/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
  293.         case "$(file -bi "${binary}")" in
  294.                 *application/x-sharedlib*) # Libraries (.so)
  295.                         /usr/bin/strip ${STRIP_SHARED} "${binary}";;
  296.                 *application/x-archive*) # Libraries (.a)
  297.                         /usr/bin/strip ${STRIP_STATIC} "${binary}";;
  298.                 *application/x-executable*) # Binaries
  299.                         /usr/bin/strip ${STRIP_BINARIES} "${binary}";;
  300.         esac
  301.         done
  302.  
  303.         # remove unneeded architectures
  304.         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}
  305. }