PKGBUILD 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  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=2
  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. # On armv7h, the uboot4extlinux-* packages provide and use a extlinux.conf
  245. # file in /boot/extlinux/. This file is needed for the bootloader to find the
  246. # kernel, initramfs and devicetree. Because of that we need the kernel image
  247. # to also be installed in /boot for several reasons:
  248. #
  249. # - First the $modulesdir name contains the kernel version, and extlinux.conf
  250. # is supposed to be edited by hand by users. Users can't be expected to do
  251. # that at each kernel updates beause at some point they will forget and get
  252. # a mismatch between the kernel image and modules which often breaks boot.
  253. # In addition people know that the kernel image is in /boot. Having it in
  254. # $moduledir instead is not documented anywhere. And we don't have code that
  255. # can automatically generate an extlinux.conf.
  256. #
  257. # - Then we also need the kernel image in /boot to be able to use LVM rootfs
  258. # as this requires a separate /boot partition and u-boot can't read LVM.
  259. #
  260. # - Finally, doing the copy manually might be straigtforward in some cases,
  261. # as computers like the Lime 2 A20 are well supported, boot on a microSD or
  262. # other removable storage that can be read by a laptop/desktop computer and
  263. # even has a display that works at boot. But some of the supported ARM
  264. # computers have an internal eMMC and no display that works at boot (like
  265. # the TBS2910 or beaglebone black) and no way to export the internal storage
  266. # as an usb mass storage (because the ums command is not compiled in u-boot)
  267. # and sometimes even no way to connect a display at all (like the BegaleBone
  268. # green). So that makes the simple way of copying a file way more complex.
  269. # So it is a good idea not to break the boot if possible.
  270. if [ "$CARCH" = "armv7h" ]; then
  271. install -Dm644 "$(make -s image_name)" "$pkgdir/boot/vmlinuz-${pkgbase}"
  272. fi
  273. # Used by mkinitcpio to name the kernel
  274. echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
  275. echo "Installing modules..."
  276. ZSTD_CLEVEL=19 make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
  277. DEPMOD=/doesnt/exist modules_install # Suppress depmod
  278. # remove build link
  279. rm "$modulesdir"/build
  280. # licenses
  281. install -vDm 644 LICENSES/deprecated/{GPL-1.0,ISC,Linux-OpenIB,X11,Zlib} -t "$pkgdir/usr/share/licenses/$pkgname/"
  282. install -vDm 644 LICENSES/preferred/{BSD,MIT}* -t "$pkgdir/usr/share/licenses/$pkgname/"
  283. install -vDm 644 LICENSES/exceptions/* -t "$pkgdir/usr/share/licenses/$pkgname/"
  284. if [ "$CARCH" = "armv7h" ]; then
  285. echo "Installing device tree binaries..."
  286. make INSTALL_DTBS_PATH="$pkgdir/boot/dtbs/$pkgbase" dtbs_install
  287. # armv7h presets only work with ALL_kver=$(<version)
  288. backup+=("etc/mkinitcpio.d/$pkgbase.preset")
  289. echo "Installing mkinitcpio preset..."
  290. sed "s|%PKGBASE%|$pkgbase|g;s|%KERNVER%|$(<version)|g" ../linux-armv7h.preset \
  291. | install -Dm644 /dev/stdin "$pkgdir/etc/mkinitcpio.d/$pkgbase.preset"
  292. fi
  293. }
  294. _package-headers() {
  295. pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
  296. license=(
  297. BSD-3-Clause
  298. 'BSD-3-Clause OR GPL-2.0-only'
  299. GPL-1.0-or-later
  300. 'GPL-1.0-or-later WITH Linux-syscall-note'
  301. GPL-2.0-only
  302. 'GPL-2.0-only OR Apache-2.0'
  303. 'GPL-2.0-only OR BSD-2-Clause'
  304. 'GPL-2.0-only OR BSD-3-Clause'
  305. 'GPL-2.0-only OR CDDL-1.0'
  306. 'GPL-2.0-only OR Linux-OpenIB'
  307. 'GPL-2.0-only OR Linux-OpenIB OR BSD-2-Clause'
  308. 'GPL-2.0-only OR MIT'
  309. 'GPL-2.0-only OR MPL-1.1'
  310. 'GPL-2.0-only OR X11'
  311. 'GPL-2.0-only WITH Linux-syscall-note'
  312. '(GPL-2.0-only WITH Linux-syscall-note) AND MIT'
  313. '(GPL-2.0-only WITH Linux-syscall-note) OR BSD-2-Clause'
  314. '(GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause'
  315. '(GPL-2.0-only WITH Linux-syscall-note) OR CDDL-1.0'
  316. '(GPL-2.0-only WITH Linux-syscall-note) OR Linux-OpenIB'
  317. '(GPL-2.0-only WITH Linux-syscall-note) OR MIT'
  318. GPL-2.0-or-later
  319. 'GPL-2.0-or-later OR BSD-2-Clause'
  320. 'GPL-2.0-or-later OR BSD-3-Clause'
  321. 'GPL-2.0-or-later OR MIT'
  322. 'GPL-2.0-or-later WITH Linux-syscall-note'
  323. '(GPL-2.0-or-later WITH Linux-syscall-note) OR BSD-3-Clause'
  324. '(GPL-2.0-or-later WITH Linux-syscall-note) OR MIT'
  325. 'LGPL-2.0-or-later OR BSD-2-Clause'
  326. 'LGPL-2.0-or-later WITH Linux-syscall-note'
  327. ISC
  328. 'LGPL-2.0-or-later WITH Linux-syscall-note'
  329. 'LGPL-2.0-or-later OR BSD-2-Clause'
  330. LGPL-2.1-only
  331. 'LGPL-2.1-only OR BSD-2-Clause'
  332. 'LGPL-2.1-only OR MIT'
  333. 'LGPL-2.1-only WITH Linux-syscall-note'
  334. LGPL-2.1-or-later
  335. 'LGPL-2.1-or-later OR BSD-2-Clause'
  336. 'LGPL-2.1-or-later WITH Linux-syscall-note'
  337. MIT
  338. Zlib
  339. )
  340. depends=(pahole)
  341. provides+=("${_replacesarchkernel[@]/%/-headers=$pkgver}")
  342. conflicts+=("${_replacesarchkernel[@]/%/-headers}" "${_replacesoldkernels[@]/%/-headers}")
  343. replaces+=("${_replacesarchkernel[@]/%/-headers}" "${_replacesoldkernels[@]/%/-headers}")
  344. cd $_srcname
  345. local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
  346. echo "Installing build files..."
  347. install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
  348. localversion.* version vmlinux
  349. install -Dt "$builddir/kernel" -m644 kernel/Makefile
  350. install -Dt "$builddir/arch/$KARCH" -m644 arch/$KARCH/Makefile
  351. if [ "$CARCH" = "i686" ]; then
  352. install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile_32.cpu
  353. fi
  354. cp -t "$builddir" -a scripts
  355. # required when STACK_VALIDATION is enabled
  356. if [[ -e tools/objtool/objtool ]]; then
  357. install -Dt "$builddir/tools/objtool" tools/objtool/objtool
  358. fi
  359. # required when DEBUG_INFO_BTF_MODULES is enabled
  360. if [[ -e tools/bpf/resolve_btfids/resolve_btfids ]]; then
  361. install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
  362. fi
  363. echo "Installing headers..."
  364. cp -t "$builddir" -a include
  365. cp -t "$builddir/arch/$KARCH" -a arch/$KARCH/include
  366. install -Dt "$builddir/arch/$KARCH/kernel" -m644 arch/$KARCH/kernel/asm-offsets.s
  367. install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
  368. install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
  369. # https://bugs.archlinux.org/task/13146
  370. install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
  371. # https://bugs.archlinux.org/task/20402
  372. install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
  373. install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
  374. install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
  375. # https://bugs.archlinux.org/task/71392
  376. install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
  377. echo "Installing KConfig files..."
  378. find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
  379. echo "Removing unneeded architectures..."
  380. local arch
  381. for arch in "$builddir"/arch/*/; do
  382. [[ $arch = */$KARCH/ ]] && continue
  383. echo "Removing $(basename "$arch")"
  384. rm -r "$arch"
  385. done
  386. echo "Removing documentation..."
  387. rm -r "$builddir/Documentation"
  388. echo "Removing broken symlinks..."
  389. find -L "$builddir" -type l -printf 'Removing %P\n' -delete
  390. echo "Removing loose objects..."
  391. find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
  392. echo "Stripping build tools..."
  393. local file
  394. while read -rd '' file; do
  395. case "$(file -Sib "$file")" in
  396. application/x-sharedlib\;*) # Libraries (.so)
  397. strip -v $STRIP_SHARED "$file" ;;
  398. application/x-archive\;*) # Libraries (.a)
  399. strip -v $STRIP_STATIC "$file" ;;
  400. application/x-executable\;*) # Binaries
  401. strip -v $STRIP_BINARIES "$file" ;;
  402. application/x-pie-executable\;*) # Relocatable binaries
  403. strip -v $STRIP_SHARED "$file" ;;
  404. esac
  405. done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
  406. echo "Stripping vmlinux..."
  407. strip -v $STRIP_STATIC "$builddir/vmlinux"
  408. echo "Adding symlink..."
  409. mkdir -p "$pkgdir/usr/src"
  410. ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
  411. # licenses
  412. install -vDm 644 LICENSES/deprecated/{ISC,Linux-OpenIB,X11,Zlib} -t "$pkgdir/usr/share/licenses/$pkgname/"
  413. install -vDm 644 LICENSES/preferred/{BSD*,MIT} -t "$pkgdir/usr/share/licenses/$pkgname/"
  414. install -vDm 644 LICENSES/exceptions/* -t "$pkgdir/usr/share/licenses/$pkgname/"
  415. }
  416. _package-docs() {
  417. pkgdesc="Documentation for the $pkgdesc kernel"
  418. license=(
  419. BSD-3-Clause
  420. GFDL-1.1-no-invariants-or-later
  421. GPL-2.0-only
  422. 'GPL-2.0-only OR BSD-2-Clause'
  423. 'GPL-2.0-only OR BSD-3-Clause'
  424. 'GPL-2.0-only OR GFDL-1.1-no-invariants-or-later'
  425. 'GPL-2.0-only OR GFDL-1.2-no-invariants-only'
  426. 'GPL-2.0-only OR MIT'
  427. GPL-2.0-or-later
  428. 'GPL-2.0-or-later OR BSD-2-Clause'
  429. 'GPL-2.0-or-later OR CC-BY-4.0'
  430. 'GPL-2.0-or-later OR MIT'
  431. 'GPL-2.0-or-later OR X11'
  432. 'LGPL-2.1-only OR BSD-2-Clause'
  433. MIT
  434. )
  435. provides+=("${_replacesarchkernel[@]/%/-docs=$pkgver}")
  436. conflicts+=("${_replacesarchkernel[@]/%/-docs}" "${_replacesoldkernels[@]/%/-docs}")
  437. replaces+=("${_replacesarchkernel[@]/%/-docs}" "${_replacesoldkernels[@]/%/-docs}")
  438. cd $_srcname
  439. local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
  440. echo "Installing documentation..."
  441. local src dst
  442. while read -rd '' src; do
  443. dst="${src#Documentation/}"
  444. dst="$builddir/Documentation/${dst#output/}"
  445. install -Dm644 "$src" "$dst"
  446. done < <(find Documentation -name '.*' -prune -o ! -type d -print0)
  447. echo "Adding symlink..."
  448. mkdir -p "$pkgdir/usr/share/doc"
  449. ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"
  450. # licenses
  451. install -vDm 644 LICENSES/deprecated/X11 -t "$pkgdir/usr/share/licenses/$pkgname/"
  452. install -vDm 644 LICENSES/preferred/{BSD*,MIT} -t "$pkgdir/usr/share/licenses/$pkgname/"
  453. }
  454. pkgname=(
  455. "$pkgbase"
  456. "$pkgbase-headers"
  457. "$pkgbase-docs"
  458. )
  459. for _p in "${pkgname[@]}"; do
  460. eval "package_$_p() {
  461. $(declare -f "_package${_p#$pkgbase}")
  462. _package${_p#$pkgbase}
  463. }"
  464. done
  465. # vim:set ts=8 sts=2 sw=2 et: