cheronobyl

PKBUILD-Linux_VFIO-5.37_AUR

Oct 21st, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.64 KB | None | 0 0
  1. # Maintainer: Dan Ziemba <[email protected]>
  2. # Maintainer: Mark Weiman <[email protected]>
  3.  
  4. pkgbase=linux-vfio
  5. _srcver=5.3.7-arch1
  6. pkgver=${_srcver//-/.}
  7. pkgrel=1
  8. arch=(x86_64)
  9. url="https://git.archlinux.org/linux.git/log/?h=v$_srcver"
  10. license=(GPL2)
  11. makedepends=(xmlto kmod inetutils bc libelf git)
  12. options=('!strip')
  13. _srcname=archlinux-linux
  14. source=(
  15. "$_srcname::git+https://git.archlinux.org/linux.git?signed#tag=v$_srcver"
  16. config # the main kernel config file
  17. 60-linux.hook # pacman hook for depmod
  18. 90-linux.hook # pacman hook for initramfs regeneration
  19. linux.preset # standard config files for mkinitcpio ramdisk
  20. add-acs-overrides.patch # patch for acs overrides
  21. fix-vega-reset.patch # patch for Vega reset correction, added by Caleb 10/20
  22. i915-vga-arbiter.patch # patch for i915 VGA arbiter
  23. )
  24. validpgpkeys=(
  25. 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
  26. '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
  27. '8218F88849AAC522E94CF470A5E9288C4FA415FA' # Jan Alexander Steffens (heftig)
  28. )
  29. sha256sums=('SKIP'
  30. '7d09d1d79a4ecb82502b4483cf989ede3f643e05613de45e12563dfe85d80423'
  31. 'ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21'
  32. '75f99f5239e03238f88d1a834c50043ec32b1dc568f2cc291b07d04718483919'
  33. 'ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65'
  34. 'dbf4ac4b873ce6972e63b78d74ddba18f2701716163bb7f4b4fe5e909346a6e1'
  35. '3d711ad5eda51c42b20575a66683cd416fe7a02a3162d8a7107f2b2c82d328ce')
  36.  
  37. _kernelname=${pkgbase#linux}
  38. : ${_kernelname:=-ARCH}
  39.  
  40. prepare() {
  41. cd $_srcname
  42.  
  43. msg2 "Setting version..."
  44. scripts/setlocalversion --save-scmversion
  45. echo "-$pkgrel" > localversion.10-pkgrel
  46. echo "$_kernelname" > localversion.20-pkgname
  47.  
  48. local src
  49. for src in "${source[@]}"; do
  50. src="${src%%::*}"
  51. src="${src##*/}"
  52. [[ $src = *.patch ]] || continue
  53. msg2 "Applying patch $src..."
  54. patch -Np1 < "../$src"
  55. done
  56.  
  57. msg2 "Setting config..."
  58. cp ../config .config
  59. make olddefconfig
  60.  
  61. make -s kernelrelease > ../version
  62. msg2 "Prepared %s version %s" "$pkgbase" "$(<../version)"
  63. }
  64.  
  65. build() {
  66. cd $_srcname
  67. make bzImage modules
  68. }
  69.  
  70. _package() {
  71. pkgdesc="The ${pkgbase/linux/Linux} kernel and modules"
  72. [[ $pkgbase = linux ]] && groups=(base)
  73. depends=(coreutils linux-firmware kmod mkinitcpio)
  74. optdepends=('crda: to set the correct wireless channels of your country')
  75. backup=("etc/mkinitcpio.d/$pkgbase.preset")
  76. install=linux.install
  77.  
  78. local kernver="$(<version)"
  79.  
  80. cd $_srcname
  81.  
  82. msg2 "Installing boot image..."
  83. install -Dm644 "$(make -s image_name)" "$pkgdir/boot/vmlinuz-$pkgbase"
  84.  
  85. msg2 "Installing modules..."
  86. local modulesdir="$pkgdir/usr/lib/modules/$kernver"
  87. mkdir -p "$modulesdir"
  88. make INSTALL_MOD_PATH="$pkgdir/usr" modules_install
  89.  
  90. # a place for external modules,
  91. # with version file for building modules and running depmod from hook
  92. local extramodules="extramodules$_kernelname"
  93. local extradir="$pkgdir/usr/lib/modules/$extramodules"
  94. install -Dt "$extradir" -m644 ../version
  95. ln -sr "$extradir" "$modulesdir/extramodules"
  96.  
  97. # remove build and source links
  98. rm "$modulesdir"/{source,build}
  99.  
  100. msg2 "Installing hooks..."
  101. # sed expression for following substitutions
  102. local subst="
  103. s|%PKGBASE%|$pkgbase|g
  104. s|%KERNVER%|$kernver|g
  105. s|%EXTRAMODULES%|$extramodules|g
  106. "
  107.  
  108. # hack to allow specifying an initially nonexisting install file
  109. sed "$subst" "$startdir/$install" > "$startdir/$install.pkg"
  110. true && install=$install.pkg
  111.  
  112. # fill in mkinitcpio preset and pacman hooks
  113. sed "$subst" ../linux.preset | install -Dm644 /dev/stdin \
  114. "$pkgdir/etc/mkinitcpio.d/$pkgbase.preset"
  115. sed "$subst" ../60-linux.hook | install -Dm644 /dev/stdin \
  116. "$pkgdir/usr/share/libalpm/hooks/60-$pkgbase.hook"
  117. sed "$subst" ../90-linux.hook | install -Dm644 /dev/stdin \
  118. "$pkgdir/usr/share/libalpm/hooks/90-$pkgbase.hook"
  119.  
  120. msg2 "Fixing permissions..."
  121. chmod -Rc u=rwX,go=rX "$pkgdir"
  122. }
  123.  
  124. _package-headers() {
  125. pkgdesc="Header files and scripts for building modules for ${pkgbase/linux/Linux} kernel"
  126.  
  127. local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
  128.  
  129. cd $_srcname
  130.  
  131. msg2 "Installing build files..."
  132. install -Dt "$builddir" -m644 Makefile .config Module.symvers System.map vmlinux
  133. install -Dt "$builddir/kernel" -m644 kernel/Makefile
  134. install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile
  135. cp -t "$builddir" -a scripts
  136.  
  137. # add objtool for external module building and enabled VALIDATION_STACK option
  138. install -Dt "$builddir/tools/objtool" tools/objtool/objtool
  139.  
  140. # add xfs and shmem for aufs building
  141. mkdir -p "$builddir"/{fs/xfs,mm}
  142.  
  143. # ???
  144. mkdir "$builddir/.tmp_versions"
  145.  
  146. msg2 "Installing headers..."
  147. cp -t "$builddir" -a include
  148. cp -t "$builddir/arch/x86" -a arch/x86/include
  149. install -Dt "$builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
  150.  
  151. install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
  152. install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
  153.  
  154. # http://bugs.archlinux.org/task/13146
  155. install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
  156.  
  157. # http://bugs.archlinux.org/task/20402
  158. install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
  159. install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
  160. install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
  161.  
  162. msg2 "Installing KConfig files..."
  163. find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
  164.  
  165. msg2 "Removing unneeded architectures..."
  166. local arch
  167. for arch in "$builddir"/arch/*/; do
  168. [[ $arch = */x86/ ]] && continue
  169. echo "Removing $(basename "$arch")"
  170. rm -r "$arch"
  171. done
  172.  
  173. msg2 "Removing documentation..."
  174. rm -r "$builddir/Documentation"
  175.  
  176. msg2 "Removing broken symlinks..."
  177. find -L "$builddir" -type l -printf 'Removing %P\n' -delete
  178.  
  179. msg2 "Removing loose objects..."
  180. find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
  181.  
  182. msg2 "Stripping build tools..."
  183. local file
  184. while read -rd '' file; do
  185. case "$(file -bi "$file")" in
  186. application/x-sharedlib\;*) # Libraries (.so)
  187. strip -v $STRIP_SHARED "$file" ;;
  188. application/x-archive\;*) # Libraries (.a)
  189. strip -v $STRIP_STATIC "$file" ;;
  190. application/x-executable\;*) # Binaries
  191. strip -v $STRIP_BINARIES "$file" ;;
  192. application/x-pie-executable\;*) # Relocatable binaries
  193. strip -v $STRIP_SHARED "$file" ;;
  194. esac
  195. done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
  196.  
  197. msg2 "Adding symlink..."
  198. mkdir -p "$pkgdir/usr/src"
  199. ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase-$pkgver"
  200.  
  201. msg2 "Fixing permissions..."
  202. chmod -Rc u=rwX,go=rX "$pkgdir"
  203. }
  204.  
  205. _package-docs() {
  206. pkgdesc="Kernel hackers manual - HTML documentation that comes with the ${pkgbase/linux/Linux} kernel"
  207.  
  208. local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
  209.  
  210. cd $_srcname
  211.  
  212. msg2 "Installing documentation..."
  213. mkdir -p "$builddir"
  214. cp -t "$builddir" -a Documentation
  215.  
  216. msg2 "Adding symlink..."
  217. mkdir -p "$pkgdir/usr/share/doc"
  218. ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"
  219.  
  220. msg2 "Fixing permissions..."
  221. chmod -Rc u=rwX,go=rX "$pkgdir"
  222. }
  223.  
  224. pkgname=("$pkgbase" "$pkgbase-headers" "$pkgbase-docs")
  225. for _p in "${pkgname[@]}"; do
  226. eval "package_$_p() {
  227. $(declare -f "_package${_p#$pkgbase}")
  228. _package${_p#$pkgbase}
  229. }"
  230. done
  231.  
  232. # vim:set ts=8 sts=2 sw=2 et:
Advertisement
Add Comment
Please, Sign In to add comment