updated on Wed Jan 18 08:00:29 UTC 2012
[aur-mirror.git] / linux-ac100 / PKGBUILD
blob6ea42083f6d9511f11dabd3fc25a3c397e389ea1
1 pkgbase=linux-ac100
2 pkgname=linux-ac100
3 #pkgname=(linux-ac100 linux-ac100-headers)
4 _kernelname=${pkgname#linux}
5 _basekernel=3.0
6 pkgver=20120111
7 pkgrel=1
8 arch=(arm armv7h)
9 url="http://www.kernel.org/"
10 license=(GPL2)
11 makedepends=(xmlto docbook-xsl git lzop)
12 options=(!strip)
13 source=(linux-ac100.install
14         linux-ac100.preset
15         bootimg.cfg
16         armdma.patch
17         config
18         change-default-console-loglevel.patch)
20 _gitroot=https://gitorious.org/~marvin24/ac100/marvin24s-kernel/commits/chromeos-ac100-3.0-exp
21 _gitname=chromeos-ac100-3.0-exp
23 MAKEFLAGS="${MAKEFLAGS} ARCH=arm"
25 build() {
26   cd $srcdir
27   if [[ -d "$_gitname" ]]; then
28     cd "$_gitname"
29     git reset --hard
30     git clean -dxf
31     #git pull origin
32   else
33     git clone "$_gitroot" "$_gitname"
34     cd "$_gitname"
35   fi
37   unset LDFLAGS
39   patch -Np1 -i "${srcdir}/change-default-console-loglevel.patch"
40   patch -Np1 -i "${srcdir}/armdma.patch"
42   cat "${srcdir}/config" > ./.config
43   #cat "${srcdir}/$_gitname/arch/arm/configs/paz00_defconfig" > ./.config
45   sed -ri "s|^(EXTRAVERSION =).*|\1 -${pkgrel}|" Makefile
47   make prepare
48   #make menuconfig # nconfig / xconfig / oldconfig
49   #cp ./.config ../config
51   make ${MAKEFLAGS} zImage modules
54 package_linux-ac100() {
55   pkgdesc="The Linux Kernel and modules - toshiba ac100 (tegra/paz00)"
56   depends=(coreutils linux-firmware 'module-init-tools>=3.16' 'mkinitcpio>=0.7' abootimg-git)
57   optdepends=('crda: to set the correct wireless channels of your country')
58   provides=(linux)
59   backup=("etc/mkinitcpio.d/${pkgname}.preset")
60   install=${pkgname}.install
62   cd "$srcdir/$_gitname"
64   # get kernel version
65   _kernver="$(make ${MAKEFLAGS} kernelrelease)"
67   mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot/ac100}
68   make INSTALL_MOD_PATH="${pkgdir}" modules_install
69   cp arch/arm/boot/zImage $pkgdir/boot/ac100/
70   cp $srcdir/bootimg.cfg $pkgdir/boot/ac100/
72   # set correct depmod command for install
73   sed -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
74       -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
75       -i "${startdir}/${pkgname}.install"
77   # remove build and source links
78   rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build}
79   # remove the firmware
80   rm -rf "${pkgdir}/lib/firmware"
81   # gzip -9 all modules to safe 100MB of space
82   find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \;
83   # make room for external modules
84   #ln -s "../extramodules-${_basekernel}-${_kernelname:-ARCH}" "${pkgdir}/lib/modules/${_kernver}/extramodules"
85   # add real version for building modules and running depmod from post_install/upgrade
86   #mkdir -p "${pkgdir}/lib/modules/extramodules-${_basekernel}-${_kernelname:-ARCH}"
87   #echo "${_kernver}" > "${pkgdir}/lib/modules/extramodules-${_basekernel}-${_kernelname:-ARCH}/version"
88   install -D -m644 "$srcdir/$pkgname.preset" "$pkgdir/etc/mkinitcpio.d/$pkgname.preset"
89   sed -i "s/^ALL_kver=.*$/ALL_kver=$_kernver/" "$pkgdir/etc/mkinitcpio.d/$pkgname.preset"
92 package_linux-ac100-headers() {
93   pkgdesc="Header files and scripts for building modules for linux kernel - toshiba ac100 (tegra/paz00)"
94   provides=('linux-headers')
96   mkdir -p "${pkgdir}/lib/modules/${_kernver}"
98   cd "${pkgdir}/lib/modules/${_kernver}"
99   ln -sf ../../../usr/src/linux-${_kernver} build
101   cd "$srcdir/$_gitname"
102   install -D -m644 Makefile "${pkgdir}/usr/src/linux-${_kernver}/Makefile"
103   install -D -m644 kernel/Makefile "${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile"
104   install -D -m644 .config "${pkgdir}/usr/src/linux-${_kernver}/.config"
106   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include"
108   for i in acpi asm-generic config crypto drm generated linux math-emu \
109     media net pcmcia scsi sound trace video xen; do
110     cp -a include/${i} "${pkgdir}/usr/src/linux-${_kernver}/include/"
111   done
113   # copy arch includes for external modules
114   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/arm
115   cp -a arch/arm/include ${pkgdir}/usr/src/linux-${_kernver}/arch/arm/
116   mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/arm/mach-tegra
117   cp -a arch/arm/mach-tegra/include ${pkgdir}/usr/src/linux-${_kernver}/arch/arm/mach-tegra/
119   # copy files necessary for later builds, like nvidia and vmware
120   cp Module.symvers "${pkgdir}/usr/src/linux-${_kernver}"
121   cp -a scripts "${pkgdir}/usr/src/linux-${_kernver}"
123   # fix permissions on scripts dir
124   chmod og-w -R "${pkgdir}/usr/src/linux-${_kernver}/scripts"
125   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions"
127   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/arm/kernel"
129   cp arch/arm/Makefile "${pkgdir}/usr/src/linux-${_kernver}/arch/arm/"
131   cp arch/arm/kernel/asm-offsets.s "${pkgdir}/usr/src/linux-${_kernver}/arch/arm/kernel/"
133   # add headers for lirc package
134   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video"
136   cp drivers/media/video/*.h  "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/"
138   for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102; do
139     mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
140     cp -a drivers/media/video/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
141   done
143   # add docbook makefile
144   install -D -m644 Documentation/DocBook/Makefile \
145     "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
147   # add dm headers
148   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
149   cp drivers/md/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
151   # add inotify.h
152   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/linux"
153   cp include/linux/inotify.h "${pkgdir}/usr/src/linux-${_kernver}/include/linux/"
155   # add wireless headers
156   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
157   cp net/mac80211/*.h "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
159   # add dvb headers for external modules
160   # in reference to:
161   # http://bugs.archlinux.org/task/9912
162   #mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core"
163   #cp drivers/media/dvb/dvb-core/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/"
164   # and...
165   # http://bugs.archlinux.org/task/11194
166   #mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
167   #cp include/config/dvb/*.h "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
169   # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
170   # in reference to:
171   # http://bugs.archlinux.org/task/13146
172   #mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
173   #cp drivers/media/dvb/frontends/lgdt330x.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
174   #cp drivers/media/video/msp3400-driver.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
176   # add dvb headers
177   # in reference to:
178   # http://bugs.archlinux.org/task/20402
179   #mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb"
180   #cp drivers/media/dvb/dvb-usb/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/"
181   #mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends"
182   #cp drivers/media/dvb/frontends/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
183   #mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners"
184   #cp drivers/media/common/tuners/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners/"
186   # add xfs and shmem for aufs building
187   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs"
188   mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/mm"
189   cp fs/xfs/xfs_sb.h "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h"
191   # copy in Kconfig files
192   for i in `find . -name "Kconfig*"`; do
193     mkdir -p "${pkgdir}"/usr/src/linux-${_kernver}/`echo ${i} | sed 's|/Kconfig.*||'`
194     cp ${i} "${pkgdir}/usr/src/linux-${_kernver}/${i}"
195   done
197   chown -R root.root "${pkgdir}/usr/src/linux-${_kernver}"
198   find "${pkgdir}/usr/src/linux-${_kernver}" -type d -exec chmod 755 {} \;
200   # strip scripts directory
201   find "${pkgdir}/usr/src/linux-${_kernver}/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
202     case "$(file -bi "${binary}")" in
203       *application/x-sharedlib*) # Libraries (.so)
204         /usr/bin/strip ${STRIP_SHARED} "${binary}";;
205       *application/x-archive*) # Libraries (.a)
206         /usr/bin/strip ${STRIP_STATIC} "${binary}";;
207       *application/x-executable*) # Binaries
208         /usr/bin/strip ${STRIP_BINARIES} "${binary}";;
209     esac
210   done
212   # remove unneeded architectures
213   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}
216 md5sums=('a410d4de0f3a0fba164a9046ddfdb0eb'
217          '8ab9596a6c1f08548a1580a3511437dc'
218          '21a2561abad495d7dde05b0bb9cf231c'
219          '6e7667c6c6348bfeca22eaaa05462d62'
220          '1c757e5c4457b6cfea52eba09a19721a'
221          '9d3c56a4b999c8bfbd4018089a62f662')