PKGBUILD 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. # Maintainer: David P. <megver83@parabola.nu>
  2. # Based on linux-rt package
  3. _replacesarchkernel=('linux%') # '%' gets replaced with kernel suffix
  4. _replacesoldkernels=() # '%' gets replaced with kernel suffix
  5. _replacesoldmodules=() # '%' gets replaced with kernel suffix
  6. pkgbase=linux-libre-rt
  7. _kver=6.6.5
  8. _rtver=16
  9. pkgver=$_kver.$_rtver.realtime1
  10. pkgrel=1
  11. pkgdesc='Linux-libre RT'
  12. url='https://linux-libre.fsfla.org/'
  13. arch=(i686 x86_64 armv7h)
  14. makedepends=(
  15. bc
  16. cpio
  17. gettext
  18. libelf
  19. pahole
  20. perl
  21. python
  22. tar
  23. xz
  24. # htmldocs
  25. graphviz
  26. imagemagick
  27. python-sphinx
  28. texlive-latexextra
  29. )
  30. options=('!strip')
  31. _srcname=linux-6.6
  32. source=(
  33. "https://cdn.kernel.org/pub/linux/kernel/projects/rt/${_srcname##*-}/older/patch-$_kver-rt$_rtver.patch"{.xz,.sign}
  34. "https://linux-libre.fsfla.org/pub/linux-libre/releases/${_srcname##*-}-gnu/linux-libre-${_srcname##*-}-gnu.tar.xz"{,.sign}
  35. "https://linux-libre.fsfla.org/pub/linux-libre/releases/$_kver-gnu/patch-${_srcname##*-}-gnu-$_kver-gnu.xz"{,.sign}
  36. "https://repo.parabola.nu/other/linux-libre/logos/logo_linux_"{clut224.ppm,vga16.ppm,mono.pbm}{,.sig}
  37. config.i686 config.x86_64 config.armv7h # the main kernel config files
  38. linux-armv7h.preset # armv7h preset file for mkinitcpio ramdisk
  39. # maintain the TTY over USB disconnects
  40. # http://www.coreboot.org/EHCI_Gadget_Debug
  41. 0001-usb-serial-gadget-no-TTY-hangup-on-USB-disconnect-WI.patch
  42. # fix Atmel maXTouch touchscreen support
  43. # https://labs.parabola.nu/issues/877
  44. # http://www.fsfla.org/pipermail/linux-libre/2015-November/003202.html
  45. 0002-fix-Atmel-maXTouch-touchscreen-support.patch
  46. # Arch Linux patches
  47. # https://gitlab.archlinux.org/archlinux/packaging/upstream/linux-rt
  48. 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
  49. 0002-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch
  50. 0003-HID-amd_sfh-Check-that-sensors-are-enabled-before-se.patch
  51. 0004-Revert-wifi-cfg80211-fix-CQM-for-non-range-use.patch
  52. 0005-Set-distribution-specific-version.patch
  53. )
  54. source_i686=(
  55. # avoid using zstd compression in ultra mode (exhausts virtual memory)
  56. no-ultra-zstd.patch
  57. )
  58. source_armv7h=(
  59. # Arch Linux ARM patches
  60. 0001-ARM-atags-add-support-for-Marvell-s-u-boot.patch
  61. 0002-ARM-atags-fdt-retrieve-MAC-addresses-from-Marvell-bo.patch
  62. 0003-fix-mvsdio-eMMC-timing.patch
  63. 0004-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch
  64. #0005-set-default-cubietruck-led-triggers.patch
  65. #0006-exynos4412-odroid-set-higher-minimum-buck2-regulator.patch
  66. #0007-USB-Armory-MkII-support.patch
  67. )
  68. validpgpkeys=(
  69. 474402C8C582DAFBE389C427BCB7CF877E7D47A7 # Alexandre Oliva
  70. 6DB9C4B4F0D8C0DC432CF6E4227CA7C556B2BA78 # David P.
  71. 64254695FFF0AA4466CC19E67B96E8162A8CF5D1 # Sebastian Andrzej Siewior
  72. )
  73. sha256sums=('08c112c9365ee852763c0bb73d6ae5dfd0a2091275fcfe298a137515e5a8c74b'
  74. 'SKIP'
  75. 'd71785bdb694fefaa4f183e5dd2ffc453c179db6f9427cc37e1ed046f0073ccf'
  76. 'SKIP'
  77. '23bb9ff3579fa125486fbcf1cc1eda8d3d9e87238ea152c8a12f740b5c9d00de'
  78. 'SKIP'
  79. 'bfd4a7f61febe63c880534dcb7c31c5b932dde6acf991810b41a939a93535494'
  80. 'SKIP'
  81. '6de8a8319271809ffdb072b68d53d155eef12438e6d04ff06a5a4db82c34fa8a'
  82. 'SKIP'
  83. '13bd7a8d9ed6b6bc971e4cd162262c5a20448a83796af39ce394d827b0e5de74'
  84. 'SKIP'
  85. 'e3eb78843cd229c84c4e225a5bf7b79395a5917f745c977c064449b9c7ee05e8'
  86. 'db0a4f014c072efdbda4ade6ac47cab2a3c75a4821b2bb18c2c55f21dd33d541'
  87. 'd5a8adaa3c3cbc7143ae25ebb7eb207e55f6273312496f73085139d7c2ebfdfc'
  88. 'ca1708abbd2f8960c278722dc81a7c635973d92872386ad9e2fff10b86836e98'
  89. '0376bd5efa31d4e2a9d52558777cebd9f0941df8e1adab916c868bf0c05f2fc3'
  90. '351fd96be8cd5ebd0435c0a8a978673fc023e3b1026085e67f86d815b2285e25'
  91. '9be2358b18d9715f8d525edeec5ec011ad7d6e8d7b5360cfcd0854912ad7f47e'
  92. '68a4845043f442d65ea87992b96bca9997bf3eca2644611c65ef62eb6e889ed7'
  93. '412fc11fd909e7b22daecf7a5f3df13e2a6e681e814e83e57cb624402d33c31c'
  94. 'fbcadedb198711a3ea838db17d582efb455a4dab644f4d6552375f35112b368c'
  95. '02b32a95dd171c76f0246368cc68b837ac36aff307f6323659f5136fe018ff5f')
  96. sha256sums_i686=('d32270be5fd9c3e3ba50f3aef33f6cfcb85be0c8216f03b777287cc621fdff28')
  97. sha256sums_armv7h=('ef4661a32234fe12bda28e698400c78c11491387df83ee554c53afb4dba244da'
  98. 'd3a4b7c7a3d3b4d69369b85630eef33b21cfbcffc23adbdc3cfa837610912287'
  99. '2bce52fa4ae4d34ca171d3aa100302a920c231275fc3ba9141af8b2f68cf67d1'
  100. '12d5706b00d2939b92130a4dc41d060f5e1fea75424b902ebceca72e427dc3b9')
  101. b2sums=('eea23d87f4e42c6b67fd02b17c3f7adfad84294d559a0df661e64c339ca5d6f9c50bfa985755da1a83812d03d3db882cac1767e433e7878eb39fe4482280dd70'
  102. 'SKIP'
  103. 'e3e753fed07258f34e2e44e1acd4be0c22a3c58a3ae4856b518a4f99358f5bf6e8f38e41f422d9a434b33b0d7ee972e93ac7d37c9734949d6db263afe4c4f47c'
  104. 'SKIP'
  105. 'c845ccf80eed695bbb9efab5d13742c04f102348617ee784929fc04530b46e374ee17e44985012b1a5472ea8de4b8a47f79d5f1863885b13901d901e46b2fee2'
  106. 'SKIP'
  107. '73fee2ae5cb1ffd3e6584e56da86a8b1ff6c713aae54d77c0dab113890fc673dc5f300eb9ed93fb367b045ece8fa80304ff277fe61665eccf7b7ce24f0c045eb'
  108. 'SKIP'
  109. 'd02a1153a4285b32c774dca4560fe37907ccf30b8e487a681b717ed95ae9bed5988875c0a118938e5885ae9d2857e53a6f216b732b6fa3368e3c5fe08c86382c'
  110. 'SKIP'
  111. '580911af9431c066bbc072fd22d5e2ef65f12d8358cec5ff5a4f1b7deebb86cef6b5c1ad631f42350af72c51d44d2093c71f761234fb224a8b9dbb3b64b8201d'
  112. 'SKIP'
  113. 'b130326fbe2481955ec240af39bcd89c8c20e10c86fe869c8455c8c47957d3ba232267cd42183b5261c82d010589f84b5d7a71f653d3b2b99654c04a8856ecca'
  114. '20adf14ffbc1cfeb3893d95c63b30143cf8b001543f0b9a8367b3cc8e520f6cfcc6c30d0fb83a4214e76728aa0ffe0488bae373791668bfcaf8e18f7462e6374'
  115. '40e9266a1802002a0eb3e30ee82409a46f70eb6fd6bb2e1f5c44e21483db058a4b94b1a09ffe41ea7d0ce341d2c0ebe33db226ee341df01fdf056675e6d034a6'
  116. 'af69176b1117b94e56b043e97b0bd5873a2974a6a2fd52b102d0ffdca440ff68cfb241d6c4d4ef453cc8c220c236b739bad232e53fd500ce7672fa6e5ba87383'
  117. 'c2214154c36900e311531bfe68184f31639f5c50fed23bc3803a7f18439b7ff258552a39f02fed0ea92f10744e17a6c55cef0ef1a98187f978fe480fb3dddc14'
  118. '0c7ceba7cd90087db3296610a07886f337910bad265a32c052d3a703e6eb8e53f355ab9948d72d366408d968d8ee7435084dd89bef5ed0b69355fd884c2cd468'
  119. 'a54310fda8f1bc0dc68aa2b90c1d64086e61d74171224d784c658a00ce3aa464c4e3398482dd2f4ee21069a8854f1315b7101dd41f3d6a94d5b2b4c0e0ad63dc'
  120. '5050a1cbf5ddb45df001554eaa8c8aa65ce9d75af4220c8b74cb515f4ce0201468eea7840bfaf8dbda7c05bfdfa5df5b7ab498416cd890c8d18ecc3a375c0b42'
  121. '65df2e904af1f839125d00758022be03838b32b1f48585ff9726f5deb01422542b902deac2cbe9f48ac242b7a1056440109f199b9a9698f5746ebb6874133538'
  122. '88109f36e8e535a0232625ecb446f5b05f1698f495ed4c405397077fdb80cd584c0417bf0a3403fe6aa89be7ed9f8f972822fba6ac5a35b4f77f2aa92b732932'
  123. 'e13ed69f4e5e090acbd3ad618fcba69ce14fd7b4f7949653d15d5e305511b2b47d12bf02904860e2af20fc453632d249550f5eea765bf969fdf668871b7d3ca2')
  124. b2sums_i686=('165ab9dd8cedeaae5327accc1581c19cf0be55f923b03feb889cad3351b74c7c4cd3d3c206938e5152bfe1d947513dea8f630f8f5544099ec13d16d254725c40')
  125. b2sums_armv7h=('73ecc5862c6b4aef7b163c1992004273fbf791b82c75a8602e3def311f682f2b866124c0bfde90d03c7c76bb8b5853bdb9daad6ee2ab0908f4145cda476b8286'
  126. '15f7b70b5d153e9336006aba873a78f94d91b8df5e1939041f12e678bb9cfbdda2e362001068a07c044ce606cf0d4d2e625002df9c569c914f7ac248d4d3e8ad'
  127. '6219cec826bc543000ab87cf35dcc713f0635519cf79e75888b213a5e2d1f728e59e70df7fd842dda6e40494bf9cafa9f87368cb75b338c5a157a0adcf583512'
  128. '66d6cff292962c4c8bbea62b2240c4c53c0c514f9e99864be9244cb846c505e1bedd800ca1347b80883543035d20573b06796e5bacbace6e829880695ffca781')
  129. _replacesarchkernel=("${_replacesarchkernel[@]/\%/${pkgbase#linux-libre}}")
  130. _replacesoldkernels=("${_replacesoldkernels[@]/\%/${pkgbase#linux-libre}}")
  131. _replacesoldmodules=("${_replacesoldmodules[@]/\%/${pkgbase#linux-libre}}")
  132. case "$CARCH" in
  133. i686|x86_64) KARCH=x86;;
  134. armv7h) KARCH=arm;;
  135. esac
  136. export KBUILD_BUILD_HOST=parabola
  137. export KBUILD_BUILD_USER=$pkgbase
  138. export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
  139. prepare() {
  140. cd $_srcname
  141. if [ "${_srcname##*-}" != "$_kver" ]; then
  142. echo "Applying upstream patch..."
  143. patch -Np1 < "../patch-${_srcname##*-}-gnu-$_kver-gnu"
  144. fi
  145. echo "Adding freedo as boot logo..."
  146. install -m644 -t drivers/video/logo \
  147. ../logo_linux_{clut224.ppm,vga16.ppm,mono.pbm}
  148. echo "Setting version..."
  149. echo "-$pkgrel" > localversion.10-pkgrel
  150. echo "${pkgbase#linux-libre}" > localversion.20-pkgname
  151. sed '/^EXTRAVERSION =/s/= .*/=/' -i Makefile
  152. local source=("${source[@]}")
  153. case "$CARCH" in
  154. "armv7h")
  155. source+=("${source_armv7h[@]}") ;;
  156. "i686")
  157. source+=("${source_i686[@]}") ;;
  158. esac
  159. local src
  160. for src in "${source[@]}"; do
  161. src="${src%%::*}"
  162. src="${src##*/}"
  163. # allow to pick up the RT patch
  164. src="${src//patch.xz/patch}"
  165. [[ $src = *.patch ]] || continue
  166. echo "Applying patch $src..."
  167. patch -Np1 < "../$src"
  168. done
  169. echo "Setting config..."
  170. cp ../config.$CARCH .config
  171. make olddefconfig
  172. diff -u ../config.$CARCH .config || :
  173. make -s kernelrelease > version
  174. echo "Prepared $pkgbase version $(<version)"
  175. }
  176. build() {
  177. cd $_srcname
  178. make all
  179. # temporarily disabled documentation due to sphinx_rtd_theme (FS32#163)
  180. if [ "$CARCH" != "i686" ]; then
  181. make htmldocs
  182. fi
  183. }
  184. _package() {
  185. pkgdesc="The $pkgdesc kernel and modules"
  186. license=(
  187. 'Apache-2.0 OR MIT'
  188. 'BSD-2-Clause OR GPL-2.0-or-later'
  189. BSD-3-Clause
  190. 'BSD-3-Clause OR GPL-2.0-only'
  191. 'BSD-3-Clause OR GPL-2.0-or-later'
  192. BSD-3-Clause-Clear
  193. GPL-1.0-or-later
  194. 'GPL-1.0-or-later OR BSD-3-Clause'
  195. GPL-2.0-only
  196. 'GPL-2.0-only OR Apache-2.0'
  197. 'GPL-2.0-only OR BSD-2-Clause'
  198. 'GPL-2.0-only OR BSD-3-Clause'
  199. 'GPL-2.0-only OR CDDL-1.0'
  200. 'GPL-2.0-only OR Linux-OpenIB'
  201. 'GPL-2.0-only OR MIT'
  202. 'GPL-2.0-only OR MPL-1.1'
  203. 'GPL-2.0-only OR X11'
  204. 'GPL-2.0-only WITH Linux-syscall-note'
  205. GPL-2.0-or-later
  206. 'GPL-2.0-or-later OR BSD-2-Clause'
  207. 'GPL-2.0-or-later OR BSD-3-Clause'
  208. 'GPL-2.0-or-later OR MIT'
  209. 'GPL-2.0-or-later OR X11'
  210. 'GPL-2.0-or-later WITH GCC-exception-2.0'
  211. ISC
  212. LGPL-2.0-or-later
  213. 'LGPL-2.1-only'
  214. 'LGPL-2.1-only OR BSD-2-Clause'
  215. LGPL-2.1-or-later
  216. MIT
  217. MPL-1.1
  218. X11
  219. Zlib
  220. )
  221. depends=(
  222. coreutils
  223. initramfs
  224. kmod
  225. )
  226. optdepends=(
  227. 'wireless-regdb: to set the correct wireless channels of your country'
  228. 'linux-libre-firmware: firmware images needed for some devices'
  229. )
  230. provides=(
  231. KSMBD-MODULE
  232. VIRTUALBOX-GUEST-MODULES
  233. WIREGUARD-MODULE
  234. )
  235. provides+=("${_replacesarchkernel[@]/%/=$pkgver}" "LINUX-ABI_VERSION=$pkgver")
  236. conflicts+=("${_replacesarchkernel[@]}" "${_replacesoldkernels[@]}" "${_replacesoldmodules[@]}")
  237. replaces+=("${_replacesarchkernel[@]}" "${_replacesoldkernels[@]}" "${_replacesoldmodules[@]}")
  238. cd $_srcname
  239. local modulesdir="$pkgdir/usr/lib/modules/$(<version)"
  240. echo "Installing boot image..."
  241. # systemd expects to find the kernel here to allow hibernation
  242. # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
  243. install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
  244. # Used by mkinitcpio to name the kernel
  245. echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
  246. echo "Installing modules..."
  247. ZSTD_CLEVEL=19 make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
  248. DEPMOD=/doesnt/exist modules_install # Suppress depmod
  249. # remove build link
  250. rm "$modulesdir"/build
  251. # licenses
  252. install -vDm 644 LICENSES/deprecated/{GPL-1.0,ISC,Linux-OpenIB,X11,Zlib} -t "$pkgdir/usr/share/licenses/$pkgname/"
  253. install -vDm 644 LICENSES/preferred/{BSD,MIT}* -t "$pkgdir/usr/share/licenses/$pkgname/"
  254. install -vDm 644 LICENSES/exceptions/* -t "$pkgdir/usr/share/licenses/$pkgname/"
  255. if [ "$CARCH" = "armv7h" ]; then
  256. echo "Installing device tree binaries..."
  257. make INSTALL_DTBS_PATH="$pkgdir/boot/dtbs/$pkgbase" dtbs_install
  258. # armv7h presets only work with ALL_kver=$(<version)
  259. backup+=("etc/mkinitcpio.d/$pkgbase.preset")
  260. echo "Installing mkinitcpio preset..."
  261. sed "s|%PKGBASE%|$pkgbase|g;s|%KERNVER%|$(<version)|g" ../linux-armv7h.preset \
  262. | install -Dm644 /dev/stdin "$pkgdir/etc/mkinitcpio.d/$pkgbase.preset"
  263. fi
  264. }
  265. _package-headers() {
  266. pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
  267. license=(
  268. BSD-3-Clause
  269. 'BSD-3-Clause OR GPL-2.0-only'
  270. GPL-1.0-or-later
  271. 'GPL-1.0-or-later WITH Linux-syscall-note'
  272. GPL-2.0-only
  273. 'GPL-2.0-only OR Apache-2.0'
  274. 'GPL-2.0-only OR BSD-2-Clause'
  275. 'GPL-2.0-only OR BSD-3-Clause'
  276. 'GPL-2.0-only OR CDDL-1.0'
  277. 'GPL-2.0-only OR Linux-OpenIB'
  278. 'GPL-2.0-only OR Linux-OpenIB OR BSD-2-Clause'
  279. 'GPL-2.0-only OR MIT'
  280. 'GPL-2.0-only OR MPL-1.1'
  281. 'GPL-2.0-only OR X11'
  282. 'GPL-2.0-only WITH Linux-syscall-note'
  283. '(GPL-2.0-only WITH Linux-syscall-note) AND MIT'
  284. '(GPL-2.0-only WITH Linux-syscall-note) OR BSD-2-Clause'
  285. '(GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause'
  286. '(GPL-2.0-only WITH Linux-syscall-note) OR CDDL-1.0'
  287. '(GPL-2.0-only WITH Linux-syscall-note) OR Linux-OpenIB'
  288. '(GPL-2.0-only WITH Linux-syscall-note) OR MIT'
  289. GPL-2.0-or-later
  290. 'GPL-2.0-or-later OR BSD-2-Clause'
  291. 'GPL-2.0-or-later OR BSD-3-Clause'
  292. 'GPL-2.0-or-later OR MIT'
  293. 'GPL-2.0-or-later WITH Linux-syscall-note'
  294. '(GPL-2.0-or-later WITH Linux-syscall-note) OR BSD-3-Clause'
  295. '(GPL-2.0-or-later WITH Linux-syscall-note) OR MIT'
  296. 'LGPL-2.0-or-later OR BSD-2-Clause'
  297. 'LGPL-2.0-or-later WITH Linux-syscall-note'
  298. ISC
  299. 'LGPL-2.0-or-later WITH Linux-syscall-note'
  300. 'LGPL-2.0-or-later OR BSD-2-Clause'
  301. LGPL-2.1-only
  302. 'LGPL-2.1-only OR BSD-2-Clause'
  303. 'LGPL-2.1-only OR MIT'
  304. 'LGPL-2.1-only WITH Linux-syscall-note'
  305. LGPL-2.1-or-later
  306. 'LGPL-2.1-or-later OR BSD-2-Clause'
  307. 'LGPL-2.1-or-later WITH Linux-syscall-note'
  308. MIT
  309. Zlib
  310. )
  311. depends=(pahole)
  312. provides+=("${_replacesarchkernel[@]/%/-headers=$pkgver}")
  313. conflicts+=("${_replacesarchkernel[@]/%/-headers}" "${_replacesoldkernels[@]/%/-headers}")
  314. replaces+=("${_replacesarchkernel[@]/%/-headers}" "${_replacesoldkernels[@]/%/-headers}")
  315. cd $_srcname
  316. local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
  317. echo "Installing build files..."
  318. install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
  319. localversion.* version vmlinux
  320. install -Dt "$builddir/kernel" -m644 kernel/Makefile
  321. install -Dt "$builddir/arch/$KARCH" -m644 arch/$KARCH/Makefile
  322. if [ "$CARCH" = "i686" ]; then
  323. install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile_32.cpu
  324. fi
  325. cp -t "$builddir" -a scripts
  326. # required when STACK_VALIDATION is enabled
  327. if [[ -e tools/objtool/objtool ]]; then
  328. install -Dt "$builddir/tools/objtool" tools/objtool/objtool
  329. fi
  330. # required when DEBUG_INFO_BTF_MODULES is enabled
  331. if [[ -e tools/bpf/resolve_btfids/resolve_btfids ]]; then
  332. install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
  333. fi
  334. echo "Installing headers..."
  335. cp -t "$builddir" -a include
  336. cp -t "$builddir/arch/$KARCH" -a arch/$KARCH/include
  337. install -Dt "$builddir/arch/$KARCH/kernel" -m644 arch/$KARCH/kernel/asm-offsets.s
  338. install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
  339. install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
  340. # https://bugs.archlinux.org/task/13146
  341. install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
  342. # https://bugs.archlinux.org/task/20402
  343. install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
  344. install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
  345. install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
  346. # https://bugs.archlinux.org/task/71392
  347. install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
  348. echo "Installing KConfig files..."
  349. find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
  350. echo "Removing unneeded architectures..."
  351. local arch
  352. for arch in "$builddir"/arch/*/; do
  353. [[ $arch = */$KARCH/ ]] && continue
  354. echo "Removing $(basename "$arch")"
  355. rm -r "$arch"
  356. done
  357. echo "Removing documentation..."
  358. rm -r "$builddir/Documentation"
  359. echo "Removing broken symlinks..."
  360. find -L "$builddir" -type l -printf 'Removing %P\n' -delete
  361. echo "Removing loose objects..."
  362. find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
  363. echo "Stripping build tools..."
  364. local file
  365. while read -rd '' file; do
  366. case "$(file -Sib "$file")" in
  367. application/x-sharedlib\;*) # Libraries (.so)
  368. strip -v $STRIP_SHARED "$file" ;;
  369. application/x-archive\;*) # Libraries (.a)
  370. strip -v $STRIP_STATIC "$file" ;;
  371. application/x-executable\;*) # Binaries
  372. strip -v $STRIP_BINARIES "$file" ;;
  373. application/x-pie-executable\;*) # Relocatable binaries
  374. strip -v $STRIP_SHARED "$file" ;;
  375. esac
  376. done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
  377. echo "Stripping vmlinux..."
  378. strip -v $STRIP_STATIC "$builddir/vmlinux"
  379. echo "Adding symlink..."
  380. mkdir -p "$pkgdir/usr/src"
  381. ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
  382. # licenses
  383. install -vDm 644 LICENSES/deprecated/{ISC,Linux-OpenIB,X11,Zlib} -t "$pkgdir/usr/share/licenses/$pkgname/"
  384. install -vDm 644 LICENSES/preferred/{BSD*,MIT} -t "$pkgdir/usr/share/licenses/$pkgname/"
  385. install -vDm 644 LICENSES/exceptions/* -t "$pkgdir/usr/share/licenses/$pkgname/"
  386. }
  387. _package-docs() {
  388. pkgdesc="Documentation for the $pkgdesc kernel"
  389. license=(
  390. BSD-3-Clause
  391. GFDL-1.1-no-invariants-or-later
  392. GPL-2.0-only
  393. 'GPL-2.0-only OR BSD-2-Clause'
  394. 'GPL-2.0-only OR BSD-3-Clause'
  395. 'GPL-2.0-only OR GFDL-1.1-no-invariants-or-later'
  396. 'GPL-2.0-only OR GFDL-1.2-no-invariants-only'
  397. 'GPL-2.0-only OR MIT'
  398. GPL-2.0-or-later
  399. 'GPL-2.0-or-later OR BSD-2-Clause'
  400. 'GPL-2.0-or-later OR CC-BY-4.0'
  401. 'GPL-2.0-or-later OR MIT'
  402. 'GPL-2.0-or-later OR X11'
  403. 'LGPL-2.1-only OR BSD-2-Clause'
  404. MIT
  405. )
  406. provides+=("${_replacesarchkernel[@]/%/-docs=$pkgver}")
  407. conflicts+=("${_replacesarchkernel[@]/%/-docs}" "${_replacesoldkernels[@]/%/-docs}")
  408. replaces+=("${_replacesarchkernel[@]/%/-docs}" "${_replacesoldkernels[@]/%/-docs}")
  409. cd $_srcname
  410. local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
  411. echo "Installing documentation..."
  412. local src dst
  413. while read -rd '' src; do
  414. dst="${src#Documentation/}"
  415. dst="$builddir/Documentation/${dst#output/}"
  416. install -Dm644 "$src" "$dst"
  417. done < <(find Documentation -name '.*' -prune -o ! -type d -print0)
  418. echo "Adding symlink..."
  419. mkdir -p "$pkgdir/usr/share/doc"
  420. ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"
  421. # licenses
  422. install -vDm 644 LICENSES/deprecated/X11 -t "$pkgdir/usr/share/licenses/$pkgname/"
  423. install -vDm 644 LICENSES/preferred/{BSD*,MIT} -t "$pkgdir/usr/share/licenses/$pkgname/"
  424. }
  425. pkgname=(
  426. "$pkgbase"
  427. "$pkgbase-headers"
  428. "$pkgbase-docs"
  429. )
  430. for _p in "${pkgname[@]}"; do
  431. eval "package_$_p() {
  432. $(declare -f "_package${_p#$pkgbase}")
  433. _package${_p#$pkgbase}
  434. }"
  435. done
  436. # vim:set ts=8 sts=2 sw=2 et: