Arch/PKGBUILD
changeset 6 35c0804c8ca2
equal deleted inserted replaced
5:bca986acd412 6:35c0804c8ca2
       
     1 # Maintainer: Mike Staszel <mikestaszel@plugapps.com>
       
     2 # Maintainer: Kevin Mihelich <kevin@archlinuxarm.org>
       
     3 # Maintainer: Jason Plum <jplum@archlinuxarm.org>
       
     4 
       
     5 buildarch=2
       
     6 
       
     7 pkgbase=linux-dns320l
       
     8 pkgname=('linux-dns320l' 'linux-headers-dns320l')
       
     9 # pkgname=linux-custom       # Build kernel with a different name
       
    10 _kernelname=${pkgname#linux}
       
    11 _basekernel=3.11
       
    12 pkgver=${_basekernel}.1
       
    13 pkgrel=2
       
    14 arch=('arm')
       
    15 url="http://www.kernel.org/"
       
    16 license=('GPL2')
       
    17 makedepends=('xmlto' 'docbook-xsl' 'uboot-mkimage')
       
    18 options=('!strip')
       
    19 source=("ftp://ftp.kernel.org/pub/linux/kernel/v3.x/linux-${_basekernel}.tar.bz2"
       
    20         "ftp://ftp.kernel.org/pub/linux/kernel/v3.x/patch-${pkgver}.bz2"
       
    21         'dns320l.patch'
       
    22         'led_fixes.patch'
       
    23         'config'
       
    24         'mach-types::http://www.arm.linux.org.uk/developer/machines/download.php'
       
    25         )
       
    26 md5sums=('17c6c1bc3d96547c05dfa74344480142'
       
    27          '31e63fa819c76eadcaef2afa2e91b74c'
       
    28          '2dfdfde68f1193e2e5127039d68cb7cf'
       
    29          'c168b19148b66d6693cb371e3ab324e3'
       
    30          '241a87eac40403cd5b19014257f4d088'
       
    31          'SKIP')
       
    32 
       
    33 build() {
       
    34 msg "Patches:"
       
    35   cd "${srcdir}/linux-${_basekernel}"
       
    36 
       
    37 msg2 "Add upstream patch"
       
    38   patch -p1 -i "${srcdir}/patch-${pkgver}"
       
    39 
       
    40 msg2 "Add the DNS320L patch for kirkwoods"
       
    41   patch -p1 -i "${srcdir}/dns320l.patch"
       
    42 
       
    43 msg2 "Add the LED fixes patch for DNS320l"
       
    44   # FS#26528
       
    45   patch -p1 -i "${srcdir}/led_fixes.patch"
       
    46 
       
    47 msg2 "Add mach-types"
       
    48   cp "${srcdir}/mach-types" arch/arm/tools
       
    49 
       
    50   cat "${srcdir}/config" > ./.config
       
    51 
       
    52   # set extraversion to pkgrel
       
    53   sed -ri "s|^(EXTRAVERSION =).*|\1 -${pkgrel}|" Makefile
       
    54 
       
    55   # don't run depmod on 'make install'. We'll do this ourselves in packaging
       
    56   sed -i '2iexit 0' scripts/depmod.sh
       
    57 
       
    58   # get kernel version
       
    59   make prepare
       
    60 
       
    61   # load configuration
       
    62   # Configure the kernel. Replace the line below with one of your choice.
       
    63   #make menuconfig # CLI menu for configuration
       
    64   #make nconfig # new CLI menu for configuration
       
    65   #make xconfig # X-based configuration
       
    66   #make oldconfig # using old config from previous kernel version
       
    67   # ... or manually edit .config
       
    68 
       
    69   # Copy back our configuration (use with new kernel version)
       
    70   #cp ./.config ../${_basekernel}.config
       
    71 
       
    72   ####################
       
    73   # stop here
       
    74   # this is useful to configure the kernel
       
    75   #msg "Stopping build"
       
    76   #return 1
       
    77   ####################
       
    78 
       
    79   #yes "" | make config
       
    80 
       
    81 msg "Building!"
       
    82   make ${MAKEFLAGS} uImage modules
       
    83 }
       
    84 
       
    85 package_linux-dns320l() {
       
    86   pkgdesc="The Linux Kernel and modules"
       
    87   depends=('coreutils' 'linux-firmware' 'module-init-tools>=3.16' 'mkinitcpio>=0.7')
       
    88   optdepends=('crda: to set the correct wireless channels of your country')
       
    89   provides=('kernel26' 'aufs_friendly' 'cryptodev_friendly')
       
    90   conflicts=('kernel26')
       
    91   replaces=('kernel26')
       
    92   install=${pkgname}.install
       
    93 
       
    94   cd "${srcdir}/linux-${_basekernel}"
       
    95 
       
    96   KARCH=arm
       
    97 
       
    98   # get kernel version
       
    99   _kernver="$(make kernelrelease)"
       
   100 
       
   101   mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot}
       
   102   make INSTALL_MOD_PATH="${pkgdir}" modules_install
       
   103   cp arch/$KARCH/boot/uImage "${pkgdir}/boot/uImage"
       
   104 
       
   105   # set correct depmod command for install
       
   106   sed \
       
   107     -e  "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
       
   108     -e  "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
       
   109     -i "${startdir}/${pkgname}.install"
       
   110 
       
   111   # remove build and source links
       
   112   rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build}
       
   113   # remove the firmware
       
   114   rm -rf "${pkgdir}/lib/firmware"
       
   115   # gzip -9 all modules to save 100MB of space
       
   116   find "${pkgdir}" -name '*.ko' |xargs -P 2 -n 1 gzip -9
       
   117   # make room for external modules
       
   118   ln -s "../extramodules-${_basekernel}-${_kernelname:-ARCH}" "${pkgdir}/lib/modules/${_kernver}/extramodules"
       
   119   # add real version for building modules and running depmod from post_install/upgrade
       
   120   mkdir -p "${pkgdir}/lib/modules/extramodules-${_basekernel}-${_kernelname:-ARCH}"
       
   121   echo "${_kernver}" > "${pkgdir}/lib/modules/extramodules-${_basekernel}-${_kernelname:-ARCH}/version"
       
   122 
       
   123   cd "${srcdir}/linux-${_basekernel}"
       
   124 
       
   125   # Now we call depmod...
       
   126   depmod -b "$pkgdir" -F System.map "$_kernver"
       
   127 
       
   128   # move module tree /lib -> /usr/lib
       
   129   mkdir -p "${pkgdir}/usr"
       
   130   mv "$pkgdir/lib" "$pkgdir/usr"
       
   131 }
       
   132 
       
   133 package_linux-headers-dns320l() {
       
   134   pkgdesc="Header files and scripts for building modules for linux kernel - Marvell Kirkwood"
       
   135   provides=('kernel26-headers' 'linux-headers=${pkgver}')
       
   136   conflicts=('kernel26-headers' 'linux-headers')
       
   137 
       
   138   install -dm755 "${pkgdir}/usr/lib/modules/${_kernver}"
       
   139 
       
   140   cd "${pkgdir}/usr/lib/modules/${_kernver}"
       
   141   ln -sf ../../../src/linux-${_kernver} build
       
   142 
       
   143   cd "${srcdir}/linux-${_basekernel}"
       
   144   install -D -m644 Makefile \
       
   145     "${pkgdir}/usr/src/linux-${_kernver}/Makefile"
       
   146   install -D -m644 kernel/Makefile \
       
   147     "${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile"
       
   148   install -D -m644 .config \
       
   149     "${pkgdir}/usr/src/linux-${_kernver}/.config"
       
   150 
       
   151   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include"
       
   152   make headers_install INSTALL_HDR_PATH="${pkgdir}/usr/src/linux-${_kernver}"
       
   153 
       
   154 # Clean up unneeded files
       
   155 #  find "${pkgdir}" -name "..install.cmd" -delete
       
   156 
       
   157   for i in acpi asm-generic config crypto drm generated linux math-emu \
       
   158     media net pcmcia scsi sound trace uapi video xen; do
       
   159     cp -a include/${i} "${pkgdir}/usr/src/linux-${_kernver}/include/"
       
   160   done
       
   161 
       
   162   # copy arch includes for external modules
       
   163   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/arm
       
   164   cp -a arch/arm/include ${pkgdir}/usr/src/linux-${_kernver}/arch/arm/
       
   165   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/arm/mach-kirkwood   
       
   166   cp -a arch/arm/mach-kirkwood/include ${pkgdir}/usr/src/linux-${_kernver}/arch/arm/mach-kirkwood/
       
   167   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/arm/plat-orion
       
   168   cp -a arch/arm/plat-orion/include ${pkgdir}/usr/src/linux-${_kernver}/arch/arm/plat-orion/
       
   169 
       
   170   # copy files necessary for later builds, like nvidia and vmware
       
   171   cp Module.symvers "${pkgdir}/usr/src/linux-${_kernver}"
       
   172   cp -a scripts "${pkgdir}/usr/src/linux-${_kernver}"
       
   173 
       
   174   # fix permissions on scripts dir
       
   175   chmod og-w -R "${pkgdir}/usr/src/linux-${_kernver}/scripts"
       
   176   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions"
       
   177 
       
   178   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/arm/kernel"
       
   179 
       
   180   cp arch/arm/Makefile "${pkgdir}/usr/src/linux-${_kernver}/arch/arm/"
       
   181 
       
   182   cp arch/arm/kernel/asm-offsets.s "${pkgdir}/usr/src/linux-${_kernver}/arch/arm/kernel/"
       
   183 
       
   184  # add headers for lirc package
       
   185   # pci
       
   186   for i in bt8xx cx88 saa7134; do
       
   187 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/pci/${i}"
       
   188     cp -a drivers/media/pci/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/pci/${i}"
       
   189   done
       
   190   # usb
       
   191   for i in cpia2 em28xx pwc sn9c102; do
       
   192 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/usb/${i}"
       
   193     cp -a drivers/media/usb/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/usb/${i}"
       
   194   done
       
   195   # i2c
       
   196   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/i2c"
       
   197   cp drivers/media/i2c/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/i2c/"
       
   198   for i in cx25840; do
       
   199 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/i2c/${i}"
       
   200     cp -a drivers/media/i2c/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/i2c/${i}"
       
   201   done
       
   202 
       
   203   # add docbook makefile
       
   204   install -D -m644 Documentation/DocBook/Makefile \
       
   205     "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
       
   206 
       
   207 # add dm headers
       
   208   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
       
   209   cp drivers/md/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
       
   210 
       
   211   # add inotify.h
       
   212   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/linux"
       
   213   cp include/linux/inotify.h "${pkgdir}/usr/src/linux-${_kernver}/include/linux/"
       
   214 
       
   215   # add wireless headers
       
   216   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
       
   217   cp net/mac80211/*.h "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
       
   218 
       
   219   # add dvb headers for external modules
       
   220   # in reference to:
       
   221   # http://bugs.archlinux.org/task/9912
       
   222   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb-core"
       
   223   cp drivers/media/dvb-core/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb-core/"
       
   224   # and...
       
   225   # http://bugs.archlinux.org/task/11194
       
   226   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
       
   227   cp include/config/dvb/*.h "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
       
   228 
       
   229   # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
       
   230   # in reference to:
       
   231   # http://bugs.archlinux.org/task/13146
       
   232   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends/"
       
   233   cp drivers/media/dvb-frontends/lgdt330x.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends/"
       
   234   #cp drivers/media/i2c/msp3400-driver.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/i2c/"
       
   235 
       
   236   # add dvb headers
       
   237   # in reference to:
       
   238   # http://bugs.archlinux.org/task/20402
       
   239   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/usb/dvb-usb"
       
   240   cp drivers/media/usb/dvb-usb/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/usb/dvb-usb/"
       
   241   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends"
       
   242   cp drivers/media/dvb-frontends/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb-frontends/"
       
   243   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/tuners"
       
   244   cp drivers/media/tuners/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/tuners/"
       
   245 
       
   246   # add xfs and shmem for aufs building
       
   247   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs"
       
   248   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/mm"
       
   249   cp fs/xfs/xfs_sb.h "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h"
       
   250 
       
   251   # copy in Kconfig files
       
   252   for i in `find . -name "Kconfig*"`; do
       
   253     mkdir -p "${pkgdir}"/usr/src/linux-${_kernver}/`echo ${i} | sed 's|/Kconfig.*||'`
       
   254     cp ${i} "${pkgdir}/usr/src/linux-${_kernver}/${i}"
       
   255   done
       
   256   
       
   257   chown -R root.root "${pkgdir}/usr/src/linux-${_kernver}"
       
   258   find "${pkgdir}/usr/src/linux-${_kernver}" -type d -exec chmod 755 {} \;
       
   259 
       
   260   # strip scripts directory
       
   261   find "${pkgdir}/usr/src/linux-${_kernver}/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
       
   262     case "$(file -bi "${binary}")" in
       
   263       *application/x-sharedlib*) # Libraries (.so)
       
   264         /usr/bin/strip ${STRIP_SHARED} "${binary}";;
       
   265       *application/x-archive*) # Libraries (.a)
       
   266         /usr/bin/strip ${STRIP_STATIC} "${binary}";;
       
   267       *application/x-executable*) # Binaries
       
   268         /usr/bin/strip ${STRIP_BINARIES} "${binary}";;
       
   269     esac
       
   270   done
       
   271 
       
   272   # remove unneeded architectures
       
   273   rm -rf "${pkgdir}"/usr/src/linux-${_kernver}/arch/{alpha,arm26,avr32,blackfin,cris,frv,h8300,ia64,m32r,m68k,m68knommu,mips,microblaze,mn10300,parisc,powerpc,ppc,s390,sh,sh64,sparc,sparc64,um,v850,x86,xtensa}
       
   274 
       
   275 }