Guest User

Untitled

a guest
Mar 28th, 2019
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.17 KB | None | 0 0
  1. # Based on the file created for Arch Linux by:
  2. # Tobias Powalowski <[email protected]>
  3. # Thomas Baechler <[email protected]>
  4.  
  5. # Maintainer: Bernhard Landauer <[email protected]
  6. # Maintainer: Philip Müller <[email protected]>
  7.  
  8. pkgbase=linux50-rt
  9. pkgname=("$pkgbase" "$pkgbase-headers")
  10. _basekernel=5.0
  11. _sub=3
  12. _rtpatchver=rt1
  13. _basever=${pkgbase//linux}
  14. _kernelname=-MANJARO
  15. _pkgver=${_basekernel}.${_sub}
  16. pkgver=${_pkgver}_${_rtpatchver}
  17. pkgrel=2
  18. arch=('x86_64')
  19. url="https://www.kernel.org/"
  20. license=('GPL2')
  21. makedepends=('bc'
  22. 'docbook-xsl'
  23. 'elfutils'
  24. 'git'
  25. 'inetutils'
  26. 'kmod'
  27. 'xmlto')
  28. options=('!strip')
  29. source=("$url/pub/linux/kernel/v5.x/linux-${_basekernel}.tar.xz"
  30. # upstream patch
  31. "$url/pub/linux/kernel/v5.x/patch-${_pkgver}.xz"
  32. # rt-config
  33. 'config.rt'
  34. "${pkgbase}.preset" # standard config files for mkinitcpio ramdisk
  35. '60-linux.hook' # pacman hook for depmod
  36. '90-linux.hook' # pacman hook for initramfs regeneration
  37. # ARCH Patches
  38. '0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch'
  39. # MANJARO Patches
  40.  
  41. # Bootsplash
  42. '0001-bootsplash.patch'
  43. '0002-bootsplash.patch'
  44. '0003-bootsplash.patch'
  45. '0004-bootsplash.patch'
  46. '0005-bootsplash.patch'
  47. '0006-bootsplash.patch'
  48. '0007-bootsplash.patch'
  49. '0008-bootsplash.patch'
  50. '0009-bootsplash.patch'
  51. '0010-bootsplash.patch'
  52. '0011-bootsplash.patch'
  53. '0012-bootsplash.patch'
  54. '0013-bootsplash.patch'
  55. # RT Patch
  56. $url/pub/linux/kernel/projects/rt/${_basekernel}/older/patch-${_pkgver}-${_rtpatchver}.patch.xz
  57. #{,sign}
  58. # 'fix-race-in-PRT-wait-for-completion-simple-wait-code_Nvidia-RT-160319.patch'
  59. )
  60. sha256sums=('437b141a6499159f5a7282d5eb4b2be055f8e862ccce44d7464e8759c31a2e43'
  61. '802edfe24f3557bd8eeabe56c70721b2bf1e9d5c9d853a4fa78b0c1b08af56de'
  62. '95447df23b31fab77b537555f05b53992b9a976e9e09e0716b8650fd6f958e60'
  63. '0fb6d51e5d8cd1dc737104c2d1487a38ff7cb50b1f8cce74e1776caa2d51490b'
  64. 'ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21'
  65. '057ef44a8f5a7ef10efbc7d96bf72f651e87a0c1d063b07d922c74232e5e7941'
  66. '37b86ca3de148a34258e3176dbf41488d9dbd19e93adbd22a062b3c41332ce85'
  67. 'a504f6cf84094e08eaa3cc5b28440261797bf4f06f04993ee46a20628ff2b53c'
  68. 'e096b127a5208f56d368d2cb938933454d7200d70c86b763aa22c38e0ddb8717'
  69. '8c1c880f2caa9c7ae43281a35410203887ea8eae750fe8d360d0c8bf80fcc6e0'
  70. '1144d51e5eb980fceeec16004f3645ed04a60fac9e0c7cf88a15c5c1e7a4b89e'
  71. 'dd4b69def2efacf4a6c442202ad5cb93d492c03886d7c61de87696e5a83e2846'
  72. '028b07f0c954f70ca37237b62e04103e81f7c658bb8bd65d7d3c2ace301297dc'
  73. 'c8b0cb231659d33c3cfaed4b1f8d7c8305ab170bdd4c77fce85270d7b6a68000'
  74. '8dbb5ab3cb99e48d97d4e2f2e3df5d0de66f3721b4f7fd94a708089f53245c77'
  75. 'a7aefeacf22c600fafd9e040a985a913643095db7272c296b77a0a651c6a140a'
  76. 'e9f22cbb542591087d2d66dc6dc912b1434330ba3cd13d2df741d869a2c31e89'
  77. '27471eee564ca3149dd271b0817719b5565a9594dc4d884fe3dc51a5f03832bc'
  78. '60e295601e4fb33d9bf65f198c54c7eb07c0d1e91e2ad1e0dd6cd6e142cb266d'
  79. '035ea4b2a7621054f4560471f45336b981538a40172d8f17285910d4e0e0b3ef'
  80. '5d374c5fb282d3689b680ba07f457dd5b1455c645cf6e1c17f8fbb7028cd2110')
  81. validpgpkeys=('64254695FFF0AA4466CC19E67B96E8162A8CF5D1' # Sebastian Andrzej Siewior
  82. '4FE5E3262872E4CC')
  83.  
  84. prepare() {
  85. cd "linux-${_basekernel}"
  86.  
  87. # add upstream patch
  88. patch -p1 -i "../patch-${_pkgver}"
  89.  
  90. # Add RT patch
  91. msg "realtime patch..."
  92. patch -p1 -i "../patch-${_pkgver}-${_rtpatchver}.patch"
  93.  
  94. # fix X hanging on certain NVIDIA cards
  95. # msg "NVIDIA race in PRT patch..."
  96. # patch -p1 -i '../fix-race-in-PRT-wait-for-completion-simple-wait-code_Nvidia-RT-160319.patch'
  97.  
  98. # disable USER_NS for non-root users by default
  99. patch -Np1 -i '../0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch'
  100.  
  101. # Add bootsplash - http://lkml.iu.edu/hypermail/linux/kernel/1710.3/01542.html
  102. patch -Np1 -i "${srcdir}/0001-bootsplash.patch"
  103. patch -Np1 -i "${srcdir}/0002-bootsplash.patch"
  104. patch -Np1 -i "${srcdir}/0003-bootsplash.patch"
  105. patch -Np1 -i "${srcdir}/0004-bootsplash.patch"
  106. patch -Np1 -i "${srcdir}/0005-bootsplash.patch"
  107. patch -Np1 -i "${srcdir}/0006-bootsplash.patch"
  108. patch -Np1 -i "${srcdir}/0007-bootsplash.patch"
  109. patch -Np1 -i "${srcdir}/0008-bootsplash.patch"
  110. patch -Np1 -i "${srcdir}/0009-bootsplash.patch"
  111. patch -Np1 -i "${srcdir}/0010-bootsplash.patch"
  112. patch -Np1 -i "${srcdir}/0011-bootsplash.patch"
  113. patch -Np1 -i "${srcdir}/0012-bootsplash.patch"
  114. # add binary files
  115. git apply -p1 < "${srcdir}/0013-bootsplash.patch"
  116.  
  117. cat '../config.rt' > ./.config
  118.  
  119. if [ "${_kernelname}" != "" ]; then
  120. sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
  121. sed -i "s|CONFIG_LOCALVERSION_AUTO=.*|CONFIG_LOCALVERSION_AUTO=n|" ./.config
  122. fi
  123.  
  124. # set extraversion to pkgrel
  125. sed -ri "s|^(EXTRAVERSION =).*|\1 |" Makefile
  126.  
  127. # don't run depmod on 'make install'. We'll do this ourselves in packaging
  128. sed -i '2iexit 0' scripts/depmod.sh
  129.  
  130. # get kernel version
  131. make prepare
  132.  
  133. # rewrite configuration
  134. yes "" | make config >/dev/null
  135. }
  136.  
  137. build() {
  138. cd "${srcdir}/linux-${_basekernel}"
  139.  
  140. # build!
  141. make ${MAKEFLAGS} LOCALVERSION= bzImage modules
  142. }
  143.  
  144. package_linux50-rt() {
  145. pkgdesc="The ${pkgbase/linux/Linux} kernel and modules"
  146. depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=0.7')
  147. optdepends=('crda: to set the correct wireless channels of your country')
  148. provides=("linux=${pkgver}")
  149. backup=("etc/mkinitcpio.d/${pkgbase}.preset")
  150. install=${pkgname}.install
  151.  
  152. cd "${srcdir}/linux-${_basekernel}"
  153.  
  154. # get kernel version
  155. _kernver="$(make LOCALVERSION= kernelrelease)"
  156.  
  157. mkdir -p "${pkgdir}"/{boot,usr/lib/modules}
  158. make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}/usr" modules_install
  159. cp arch/x86/boot/bzImage "${pkgdir}/boot/vmlinuz-${_basekernel}-rt-x86_64"
  160.  
  161. # add kernel version
  162. echo "${_pkgver}-${_rtpatchver}-${pkgrel}-MANJARO x64" > "${pkgdir}/boot/linux-${_basever}-x86_64.kver"
  163.  
  164. # make room for external modules
  165. local _extramodules="extramodules-${_basekernel}-rt${_kernelname:--MANJARO}"
  166. ln -s "../${_extramodules}" "${pkgdir}/usr/lib/modules/${_kernver}/extramodules"
  167.  
  168. # add real version for building modules and running depmod from hook
  169. echo "${_kernver}" |
  170. install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules/${_extramodules}/version"
  171.  
  172. # remove build and source links
  173. rm "${pkgdir}"/usr/lib/modules/${_kernver}/{source,build}
  174.  
  175. # now we call depmod...
  176. depmod -b "${pkgdir}/usr" -F System.map "${_kernver}"
  177.  
  178. # add vmlinux
  179. install -Dt "${pkgdir}/usr/lib/modules/${_kernver}/build" -m644 vmlinux
  180.  
  181. # sed expression for following substitutions
  182. local _subst="
  183. s|%PKGBASE%|${pkgbase}|g
  184. s|%BASEKERNEL%|${_basekernel}|g
  185. s|%ARCH%|x86_64|g
  186. s|%KERNVER%|${_kernver}|g
  187. s|%EXTRAMODULES%|${_extramodules}|g
  188. "
  189.  
  190. # hack to allow specifying an initially nonexisting install file
  191. sed "${_subst}" "${startdir}/${install}" > "${startdir}/${install}.pkg"
  192. true && install=${install}.pkg
  193.  
  194. # install mkinitcpio preset file
  195. sed "${_subst}" ${srcdir}/${pkgbase}.preset |
  196. install -Dm644 /dev/stdin "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
  197.  
  198. # install pacman hooks
  199. sed "${_subst}" ${srcdir}/60-linux.hook |
  200. install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/60-${pkgbase}.hook"
  201. sed "${_subst}" ${srcdir}/90-linux.hook |
  202. install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/90-${pkgbase}.hook"
  203. }
  204.  
  205. package_linux50-rt-headers() {
  206. pkgdesc="Header files and scripts for building modules for ${pkgbase/linux/Linux} kernel"
  207. provides=("linux-headers=$pkgver")
  208.  
  209. cd "${srcdir}/linux-${_basekernel}"
  210. local _builddir="${pkgdir}/usr/lib/modules/${_kernver}/build"
  211.  
  212. install -Dt "${_builddir}" -m644 Makefile .config Module.symvers
  213. install -Dt "${_builddir}/kernel" -m644 kernel/Makefile
  214.  
  215. mkdir "${_builddir}/.tmp_versions"
  216.  
  217. cp -t "${_builddir}" -a include scripts
  218.  
  219. install -Dt "${_builddir}/arch/x86" -m644 "arch/x86/Makefile"
  220. install -Dt "${_builddir}/arch/x86/kernel" -m644 "arch/x86/kernel/asm-offsets.s"
  221.  
  222. cp -t "${_builddir}/arch/x86" -a "arch/x86/include"
  223.  
  224. install -Dt "${_builddir}/drivers/md" -m644 drivers/md/*.h
  225. install -Dt "${_builddir}/net/mac80211" -m644 net/mac80211/*.h
  226.  
  227. # http://bugs.archlinux.org/task/13146
  228. install -Dt "${_builddir}/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
  229.  
  230. # http://bugs.archlinux.org/task/20402
  231. install -Dt "${_builddir}/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
  232. install -Dt "${_builddir}/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
  233. install -Dt "${_builddir}/drivers/media/tuners" -m644 drivers/media/tuners/*.h
  234.  
  235. # add xfs and shmem for aufs building
  236. mkdir -p "${_builddir}"/{fs/xfs,mm}
  237.  
  238. # copy in Kconfig files
  239. find . -name Kconfig\* -exec install -Dm644 {} "${_builddir}/{}" \;
  240.  
  241. # add objtool for external module building and enabled VALIDATION_STACK option
  242. install -Dt "${_builddir}/tools/objtool" tools/objtool/objtool
  243.  
  244. # remove unneeded architectures
  245. local _arch
  246. for _arch in "${_builddir}"/arch/*/; do
  247. [[ ${_arch} == */x86/ ]] && continue
  248. rm -r "${_arch}"
  249. done
  250.  
  251. # remove files already in linux-docs package
  252. rm -r "${_builddir}/Documentation"
  253.  
  254. # Fix permissions
  255. chmod -R u=rwX,go=rX "${_builddir}"
  256.  
  257. # strip scripts directory
  258. local _binary _strip
  259. while read -rd '' _binary; do
  260. case "$(file -bi "${_binary}")" in
  261. *application/x-sharedlib*) _strip="${STRIP_SHARED}" ;; # Libraries (.so)
  262. *application/x-archive*) _strip="${STRIP_STATIC}" ;; # Libraries (.a)
  263. *application/x-executable*) _strip="${STRIP_BINARIES}" ;; # Binaries
  264. *) continue ;;
  265. esac
  266. /usr/bin/strip ${_strip} "${_binary}"
  267. done < <(find "${_builddir}/scripts" -type f -perm -u+w -print0 2>/dev/null)
  268. }
Advertisement
Add Comment
Please, Sign In to add comment