arch-PKGBUILD 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. # ChromiumOS kernel for Veyron Chromebooks
  2. # Maintainer: Kevin Mihelich <kevin@archlinuxarm.org>
  3. buildarch=4
  4. pkgbase=linux-veyron
  5. _kernelname=${pkgbase#linux}
  6. _desc="Veyron Chromebooks"
  7. pkgver=3.14.0
  8. pkgrel=26
  9. _commit=8c3348722d05cdc134aeeb2bb1da63f6992b8bfe
  10. arch=('armv7h')
  11. url="https://chromium.googlesource.com/chromiumos/third_party/kernel/+/chromeos-3.14"
  12. license=('GPL2')
  13. makedepends=('xmlto' 'docbook-xsl' 'kmod' 'inetutils' 'bc' 'git' 'uboot-tools' 'vboot-utils' 'dtc')
  14. options=('!strip')
  15. source=("https://chromium.googlesource.com/chromiumos/third_party/kernel/+archive/${_commit}.tar.gz"
  16. http://archlinuxarm.org/builder/src/veyron/sd{8787,8797,8897}_uapsta_cros.bin
  17. 'http://archlinuxarm.org/builder/src/veyron/BCM4354_003.001.012.0306.0659.hcd'
  18. '0001-use-chromiumos-mwifiex-drivers.patch'
  19. '0002-mwifiex-do-not-create-AP-and-P2P-interfaces-upon-dri.patch'
  20. '0003-UPSTREAM-soc-rockchip-add-handler-for-usb-uart-funct.patch'
  21. '0004-fix-brcmfmac-oops-and-race-condition.patch'
  22. '0005-random-simplify-loop-in-random_read.patch'
  23. '0006-random-introduce-getrandom-2-system-call.patch'
  24. '0007-ARM-wire-up-getrandom-syscall.patch'
  25. '0008-random-Wake-up-all-getrandom-2-callers-when-pool-is-.patch'
  26. 'config'
  27. 'kernel.its'
  28. 'kernel.keyblock'
  29. 'kernel_data_key.vbprivk'
  30. 'cmdline'
  31. 'brcmfmac4354-sdio.txt'
  32. '99-veyron-brcm.rules')
  33. md5sums=('07393e20ea7ea48ba7dab52e57620a04'
  34. 'bda543cb5943eac34e16d12911f3ee99'
  35. '5e2d7cd74de07d13052de99411c13a2f'
  36. '1534c1dbfe5df35a5634072f7b912840'
  37. '20f8931f3795e5226829d48c3d470334'
  38. '7457f68b1ed40592f0057a9e3d5e546c'
  39. '78efe11e59a48fe1576f195e9fe27e92'
  40. '0a6e16818f4f1294b4d7bebad952c46f'
  41. 'f4e19254d5d8e4b427134e535c728186'
  42. '997b5f5e7cafc3547888fc82b40d5d01'
  43. '7c5c670779e324f1ce9286f7cd605160'
  44. '21cde62bbc6dc0e9dd1b3f6771a1438d'
  45. '605c38eb7c016d8283db3d3801067202'
  46. '9aac49e2baa96444f9314d02035a90a7'
  47. '761d2e8cef38584b9e2f478e8096e458'
  48. '61c5ff73c136ed07a7aadbf58db3d96a'
  49. '584777ae88bce2c5659960151b64c7d8'
  50. 'e3bdf63d5d936fb982c4cd62da1433ad'
  51. '97297f16115fb38e157bdc3a4527252d'
  52. 'cd779bcbe50e6562428279ff7e5b0cd9')
  53. prepare() {
  54. git apply 0001-use-chromiumos-mwifiex-drivers.patch
  55. git apply 0002-mwifiex-do-not-create-AP-and-P2P-interfaces-upon-dri.patch
  56. git apply 0003-UPSTREAM-soc-rockchip-add-handler-for-usb-uart-funct.patch
  57. git apply 0004-fix-brcmfmac-oops-and-race-condition.patch
  58. git apply 0005-random-simplify-loop-in-random_read.patch
  59. git apply 0006-random-introduce-getrandom-2-system-call.patch
  60. git apply 0007-ARM-wire-up-getrandom-syscall.patch
  61. git apply 0008-random-Wake-up-all-getrandom-2-callers-when-pool-is-.patch
  62. cp config .config
  63. # add pkgrel to extraversion
  64. sed -ri "s|^(EXTRAVERSION =)(.*)|\1 \2-${pkgrel}|" Makefile
  65. # don't run depmod on 'make install'. We'll do this ourselves in packaging
  66. sed -i '2iexit 0' scripts/depmod.sh
  67. export WIFIVERSION=-3.8
  68. cp include/linux/compiler-gcc5.h include/linux/compiler-gcc6.h
  69. cp include/linux/compiler-gcc5.h include/linux/compiler-gcc7.h
  70. }
  71. build() {
  72. # get kernel version
  73. make prepare
  74. # load configuration
  75. # Configure the kernel. Replace the line below with one of your choice.
  76. #make menuconfig # CLI menu for configuration
  77. #make nconfig # new CLI menu for configuration
  78. #make xconfig # X-based configuration
  79. #make oldconfig # using old config from previous kernel version
  80. # ... or manually edit .config
  81. # Copy back our configuration (use with new kernel version)
  82. #cp ./.config ../${pkgbase}.config
  83. ####################
  84. # stop here
  85. # this is useful to configure the kernel
  86. #msg "Stopping build"
  87. #return 1
  88. ####################
  89. #yes "" | make config
  90. # build!
  91. make ${MAKEFLAGS} zImage modules dtbs
  92. }
  93. _package() {
  94. pkgdesc="The Linux Kernel and modules - ${_desc}"
  95. depends=('coreutils' 'linux-firmware' 'kmod' 'brcm-patchram-plus')
  96. optdepends=('crda: to set the correct wireless channels of your country')
  97. provides=('kernel26' "linux=${pkgver}")
  98. conflicts=('linux')
  99. install=${pkgname}.install
  100. KARCH=arm
  101. # get kernel version
  102. _kernver="$(make kernelrelease)"
  103. _basekernel=${_kernver%%-*}
  104. _basekernel=${_basekernel%.*}
  105. mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot/dtbs}
  106. make INSTALL_MOD_PATH="${pkgdir}" modules_install
  107. mkimage -D "-I dts -O dtb -p 2048" -f kernel.its vmlinux.uimg
  108. dd if=/dev/zero of=bootloader.bin bs=512 count=1
  109. vbutil_kernel \
  110. --pack vmlinux.kpart \
  111. --version 1 \
  112. --vmlinuz vmlinux.uimg \
  113. --arch arm \
  114. --keyblock kernel.keyblock \
  115. --signprivate kernel_data_key.vbprivk \
  116. --config cmdline \
  117. --bootloader bootloader.bin
  118. cp vmlinux.kpart "${pkgdir}/boot"
  119. # set correct depmod command for install
  120. sed \
  121. -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
  122. -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
  123. -i "${startdir}/${pkgname}.install"
  124. # remove build and source links
  125. rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build}
  126. # remove the firmware
  127. rm -rf "${pkgdir}/lib/firmware"
  128. # gzip -9 all modules to save 100MB of space
  129. find "${pkgdir}" -name '*.ko' |xargs -P 2 -n 1 gzip -9
  130. # make room for external modules
  131. ln -s "../extramodules-${_basekernel}-${_kernelname:-ARCH}" "${pkgdir}/lib/modules/${_kernver}/extramodules"
  132. # add real version for building modules and running depmod from post_install/upgrade
  133. mkdir -p "${pkgdir}/lib/modules/extramodules-${_basekernel}-${_kernelname:-ARCH}"
  134. echo "${_kernver}" > "${pkgdir}/lib/modules/extramodules-${_basekernel}-${_kernelname:-ARCH}/version"
  135. # Now we call depmod...
  136. depmod -b "$pkgdir" -F System.map "$_kernver"
  137. # move module tree /lib -> /usr/lib
  138. mkdir -p "${pkgdir}/usr"
  139. mv "$pkgdir/lib" "$pkgdir/usr"
  140. # install ChromeOS mwifiex firmware
  141. mkdir -p "${pkgdir}"/usr/lib/firmware/mrvl
  142. cp sd{8787,8797,8897}_uapsta_cros.bin "${pkgdir}"/usr/lib/firmware/mrvl
  143. # install ChromeOS brcm firmware
  144. mkdir -p "${pkgdir}"/usr/lib/firmware/brcm
  145. mkdir -p "${pkgdir}"/usr/lib/udev/rules.d
  146. cp BCM4354_003.001.012.0306.0659.hcd brcmfmac4354-sdio.txt "${pkgdir}"/usr/lib/firmware/brcm
  147. cp 99-veyron-brcm.rules "${pkgdir}"/usr/lib/udev/rules.d
  148. }
  149. _package-headers() {
  150. pkgdesc="Header files and scripts for building modules for linux kernel - ${_desc}"
  151. provides=("linux-headers=${pkgver}")
  152. conflicts=('linux-headers')
  153. install -dm755 "${pkgdir}/usr/lib/modules/${_kernver}"
  154. install -D -m644 Makefile \
  155. "${pkgdir}/usr/lib/modules/${_kernver}/build/Makefile"
  156. install -D -m644 kernel/Makefile \
  157. "${pkgdir}/usr/lib/modules/${_kernver}/build/kernel/Makefile"
  158. install -D -m644 .config \
  159. "${pkgdir}/usr/lib/modules/${_kernver}/build/.config"
  160. mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/include"
  161. for i in acpi asm-generic config crypto drm generated keys linux math-emu \
  162. media net pcmcia scsi sound trace uapi video xen; do
  163. cp -a include/${i} "${pkgdir}/usr/lib/modules/${_kernver}/build/include/"
  164. done
  165. # copy arch includes for external modules
  166. mkdir -p ${pkgdir}/usr/lib/modules/${_kernver}/build/arch/$KARCH
  167. cp -a arch/$KARCH/include ${pkgdir}/usr/lib/modules/${_kernver}/build/arch/$KARCH/
  168. # copy files necessary for later builds, like nvidia and vmware
  169. cp Module.symvers "${pkgdir}/usr/lib/modules/${_kernver}/build"
  170. cp -a scripts "${pkgdir}/usr/lib/modules/${_kernver}/build"
  171. # fix permissions on scripts dir
  172. chmod og-w -R "${pkgdir}/usr/lib/modules/${_kernver}/build/scripts"
  173. mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/.tmp_versions"
  174. mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/kernel"
  175. cp arch/${KARCH}/Makefile "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/"
  176. cp arch/${KARCH}/kernel/asm-offsets.s "${pkgdir}/usr/lib/modules/${_kernver}/build/arch/${KARCH}/kernel/"
  177. # add docbook makefile
  178. install -D -m644 Documentation/DocBook/Makefile \
  179. "${pkgdir}/usr/lib/modules/${_kernver}/build/Documentation/DocBook/Makefile"
  180. # add dm headers
  181. mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/md"
  182. cp drivers/md/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/md"
  183. # add inotify.h
  184. mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/include/linux"
  185. cp include/linux/inotify.h "${pkgdir}/usr/lib/modules/${_kernver}/build/include/linux/"
  186. # add wireless headers
  187. mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/net/mac80211/"
  188. cp net/mac80211/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/net/mac80211/"
  189. # add dvb headers for external modules
  190. # in reference to:
  191. # http://bugs.archlinux.org/task/9912
  192. mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-core"
  193. cp drivers/media/dvb-core/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-core/"
  194. # and...
  195. # http://bugs.archlinux.org/task/11194
  196. mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/include/config/dvb/"
  197. cp include/config/dvb/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/include/config/dvb/"
  198. # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
  199. # in reference to:
  200. # http://bugs.archlinux.org/task/13146
  201. mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-frontends/"
  202. cp drivers/media/dvb-frontends/lgdt330x.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-frontends/"
  203. mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/i2c/"
  204. cp drivers/media/i2c/msp3400-driver.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/i2c/"
  205. # add dvb headers
  206. # in reference to:
  207. # http://bugs.archlinux.org/task/20402
  208. mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/usb/dvb-usb"
  209. cp drivers/media/usb/dvb-usb/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/usb/dvb-usb/"
  210. mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-frontends"
  211. cp drivers/media/dvb-frontends/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/dvb-frontends/"
  212. mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/tuners"
  213. cp drivers/media/tuners/*.h "${pkgdir}/usr/lib/modules/${_kernver}/build/drivers/media/tuners/"
  214. # add xfs and shmem for aufs building
  215. mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/fs/xfs"
  216. mkdir -p "${pkgdir}/usr/lib/modules/${_kernver}/build/mm"
  217. # copy in Kconfig files
  218. for i in $(find . -name "Kconfig*"); do
  219. mkdir -p "${pkgdir}"/usr/lib/modules/${_kernver}/build/`echo ${i} | sed 's|/Kconfig.*||'`
  220. cp ${i} "${pkgdir}/usr/lib/modules/${_kernver}/build/${i}"
  221. done
  222. chown -R root.root "${pkgdir}/usr/lib/modules/${_kernver}/build"
  223. find "${pkgdir}/usr/lib/modules/${_kernver}/build" -type d -exec chmod 755 {} \;
  224. # strip scripts directory
  225. find "${pkgdir}/usr/lib/modules/${_kernver}/build/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
  226. case "$(file -bi "${binary}")" in
  227. *application/x-sharedlib*) # Libraries (.so)
  228. /usr/bin/strip ${STRIP_SHARED} "${binary}";;
  229. *application/x-archive*) # Libraries (.a)
  230. /usr/bin/strip ${STRIP_STATIC} "${binary}";;
  231. *application/x-executable*) # Binaries
  232. /usr/bin/strip ${STRIP_BINARIES} "${binary}";;
  233. esac
  234. done
  235. # remove unneeded architectures
  236. rm -rf "${pkgdir}"/usr/lib/modules/${_kernver}/build/arch/{alpha,arc,arm26,arm64,avr32,blackfin,c6x,cris,frv,h8300,hexagon,ia64,m32r,m68k,m68knommu,metag,mips,microblaze,mn10300,openrisc,parisc,powerpc,ppc,s390,score,sh,sh64,sparc,sparc64,tile,unicore32,um,v850,x86,xtensa}
  237. }
  238. pkgname=("${pkgbase}" "${pkgbase}-headers")
  239. for _p in ${pkgname[@]}; do
  240. eval "package_${_p}() {
  241. _package${_p#${pkgbase}}
  242. }"
  243. done