PKGBUILD 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. # Maintainer: David P. <megver83@parabola.nu>
  2. # Contributor: André Silva <emulatorman@hyperbola.info>
  3. # Contributor: Márcio Silva <coadde@hyperbola.info>
  4. # Based on linux-pae package
  5. _replacesarchkernel=('linux%') # '%' gets replaced with kernel suffix
  6. _replacesoldkernels=() # '%' gets replaced with kernel suffix
  7. _replacesoldmodules=() # '%' gets replaced with kernel suffix
  8. pkgbase=linux-libre-pae
  9. pkgver=6.7.4
  10. pkgrel=1
  11. pkgdesc='Linux-libre PAE (physical address extension)'
  12. url='https://linux-libre.fsfla.org/'
  13. arch=(i686)
  14. license=(GPL2)
  15. makedepends=(
  16. bc
  17. cpio
  18. gettext
  19. libelf
  20. pahole
  21. perl
  22. python
  23. tar
  24. xz
  25. # htmldocs
  26. #graphviz
  27. #imagemagick
  28. #python-sphinx
  29. #texlive-latexextra
  30. )
  31. options=('!strip')
  32. _srcname=linux-6.7
  33. source=(
  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/$pkgver-gnu/patch-${_srcname##*-}-gnu-$pkgver-gnu.xz"{,.sign}
  36. "https://repo.parabola.nu/other/linux-libre/logos/logo_linux_"{clut224.ppm,vga16.ppm,mono.pbm}{,.sig}
  37. config # the main kernel config files
  38. # maintain the TTY over USB disconnects
  39. # http://www.coreboot.org/EHCI_Gadget_Debug
  40. 0001-usb-serial-gadget-no-TTY-hangup-on-USB-disconnect-WI.patch
  41. # fix Atmel maXTouch touchscreen support
  42. # https://labs.parabola.nu/issues/877
  43. # http://www.fsfla.org/pipermail/linux-libre/2015-November/003202.html
  44. 0002-fix-Atmel-maXTouch-touchscreen-support.patch
  45. # Arch Linux patches
  46. # https://github.com/archlinux/linux
  47. 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
  48. 0002-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch
  49. 0003-arch-Kconfig-Default-to-maximum-amount-of-ASLR-bits.patch
  50. # avoid using zstd compression in ultra mode (exhausts virtual memory)
  51. no-ultra-zstd.patch
  52. )
  53. validpgpkeys=(
  54. 474402C8C582DAFBE389C427BCB7CF877E7D47A7 # Alexandre Oliva
  55. 6DB9C4B4F0D8C0DC432CF6E4227CA7C556B2BA78 # David P.
  56. )
  57. sha256sums=('eb43c7dfe646d607ce7f010fa77789260db46fad1086dcd5c7f8df0bee9c14b0'
  58. 'SKIP'
  59. 'ed1227ef770e37e3df3e760b908497f8492c2902c2e9063737690cf70d94c14c'
  60. 'SKIP'
  61. 'bfd4a7f61febe63c880534dcb7c31c5b932dde6acf991810b41a939a93535494'
  62. 'SKIP'
  63. '6de8a8319271809ffdb072b68d53d155eef12438e6d04ff06a5a4db82c34fa8a'
  64. 'SKIP'
  65. '13bd7a8d9ed6b6bc971e4cd162262c5a20448a83796af39ce394d827b0e5de74'
  66. 'SKIP'
  67. '8a8b10cbb3acb6904cf90f462c1c3fd41b2a2f8f31e42fe4f18c8b4df17347f5'
  68. '0376bd5efa31d4e2a9d52558777cebd9f0941df8e1adab916c868bf0c05f2fc3'
  69. '351fd96be8cd5ebd0435c0a8a978673fc023e3b1026085e67f86d815b2285e25'
  70. '994b27f23073a6e04bf8a61cd2eb9d2511b8eb0e81ed7828d4c3880f1e1f5061'
  71. 'e66f241a67f2aeda3fd61ef56c6fa40f414f3b89b5e700cfb7680384f2be7f63'
  72. 'f36b1b3109d035139cfff75962a81c870fcb73fc3f81bb958e34a9e60af4fa3a'
  73. 'd32270be5fd9c3e3ba50f3aef33f6cfcb85be0c8216f03b777287cc621fdff28')
  74. b2sums=('45471cdf9e8fc37e384bdcfc2d22b113850daf62a5bea70a1dc6ea402fd2f924bc21cb0275f7e22532092e20af6de7fc2bc7f2056321d29fd29e5cb0e7e80f87'
  75. 'SKIP'
  76. 'e7e8c9e4bae48c6c15ce3d5b50694ae8560a48731263445c81284c5e798eb8d77ef032dc22d3dcbe8b47029f53518cbe559d8194b92d0c8bec76bb3acf9f708c'
  77. 'SKIP'
  78. '73fee2ae5cb1ffd3e6584e56da86a8b1ff6c713aae54d77c0dab113890fc673dc5f300eb9ed93fb367b045ece8fa80304ff277fe61665eccf7b7ce24f0c045eb'
  79. 'SKIP'
  80. 'd02a1153a4285b32c774dca4560fe37907ccf30b8e487a681b717ed95ae9bed5988875c0a118938e5885ae9d2857e53a6f216b732b6fa3368e3c5fe08c86382c'
  81. 'SKIP'
  82. '580911af9431c066bbc072fd22d5e2ef65f12d8358cec5ff5a4f1b7deebb86cef6b5c1ad631f42350af72c51d44d2093c71f761234fb224a8b9dbb3b64b8201d'
  83. 'SKIP'
  84. 'e18118ef69486e8839926c92a3f5f3842e6561065781c8e182a29167cd8d80e9198cb1def3611ad54c0b696d6e634ec4631c49b9449c05718790ed0fb1491eec'
  85. 'c2214154c36900e311531bfe68184f31639f5c50fed23bc3803a7f18439b7ff258552a39f02fed0ea92f10744e17a6c55cef0ef1a98187f978fe480fb3dddc14'
  86. '0c7ceba7cd90087db3296610a07886f337910bad265a32c052d3a703e6eb8e53f355ab9948d72d366408d968d8ee7435084dd89bef5ed0b69355fd884c2cd468'
  87. '6f1d4a50cbfc5777d481596593b4d137fcd35b5b2af6ad610147ae28e5918800f917f7d65544c97b67005ad7c171b36c205c748e24a5d44fea23ed53460bd2bc'
  88. '3b9a9e60af14d82d82e9645b55cd8f1f5827da1b15226c1cd8022c0a426c1d4d66981c2be2ef422cd7401aa74d3e610ebe9f4e76e0b506cebe758bc27464145a'
  89. 'a8b01480b16f062bf465149494387f6f4eabc3289dc7596c4dbfe4a4a963f60d717f86cead9dc37d1fea9c9213cd6d2663648f3fc8d197c09d006ac2dc0c4511'
  90. '165ab9dd8cedeaae5327accc1581c19cf0be55f923b03feb889cad3351b74c7c4cd3d3c206938e5152bfe1d947513dea8f630f8f5544099ec13d16d254725c40')
  91. _replacesarchkernel=("${_replacesarchkernel[@]/\%/${pkgbase#linux-libre}}")
  92. _replacesoldkernels=("${_replacesoldkernels[@]/\%/${pkgbase#linux-libre}}")
  93. _replacesoldmodules=("${_replacesoldmodules[@]/\%/${pkgbase#linux-libre}}")
  94. export KBUILD_BUILD_HOST=parabola
  95. export KBUILD_BUILD_USER=$pkgbase
  96. export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
  97. prepare() {
  98. cd $_srcname
  99. if [ "${_srcname##*-}" != "$pkgver" ]; then
  100. echo "Applying upstream patch..."
  101. patch -Np1 < "../patch-${_srcname##*-}-gnu-$pkgver-gnu"
  102. fi
  103. echo "Adding freedo as boot logo..."
  104. install -m644 -t drivers/video/logo \
  105. ../logo_linux_{clut224.ppm,vga16.ppm,mono.pbm}
  106. echo "Setting version..."
  107. echo "-$pkgrel" > localversion.10-pkgrel
  108. echo "${pkgbase#linux-libre}" > localversion.20-pkgname
  109. local src
  110. for src in "${source[@]}"; do
  111. src="${src%%::*}"
  112. src="${src##*/}"
  113. src="${src%.zst}"
  114. [[ $src = *.patch ]] || continue
  115. echo "Applying patch $src..."
  116. patch -Np1 < "../$src"
  117. done
  118. echo "Setting config..."
  119. cp ../config .config
  120. make olddefconfig
  121. diff -u ../config .config || :
  122. make -s kernelrelease > version
  123. echo "Prepared $pkgbase version $(<version)"
  124. }
  125. build() {
  126. cd $_srcname
  127. make all
  128. # temporarily disabled documentation due to sphinx_rtd_theme (FS32#163)
  129. #make htmldocs
  130. }
  131. _package() {
  132. pkgdesc="The $pkgdesc kernel and modules"
  133. depends=(
  134. coreutils
  135. initramfs
  136. kmod
  137. )
  138. optdepends=(
  139. 'wireless-regdb: to set the correct wireless channels of your country'
  140. 'linux-libre-firmware: firmware images needed for some devices'
  141. )
  142. provides=(
  143. KSMBD-MODULE
  144. VIRTUALBOX-GUEST-MODULES
  145. WIREGUARD-MODULE
  146. )
  147. replaces=(
  148. )
  149. provides+=("${_replacesarchkernel[@]/%/=${pkgver%.*}}" "LINUX-ABI_VERSION=${pkgver%.*}")
  150. conflicts=("${_replacesarchkernel[@]}" "${_replacesoldkernels[@]}" "${_replacesoldmodules[@]}")
  151. replaces=("${_replacesarchkernel[@]}" "${_replacesoldkernels[@]}" "${_replacesoldmodules[@]}")
  152. cd $_srcname
  153. local modulesdir="$pkgdir/usr/lib/modules/$(<version)"
  154. echo "Installing boot image..."
  155. # systemd expects to find the kernel here to allow hibernation
  156. # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
  157. install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
  158. # Used by mkinitcpio to name the kernel
  159. echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
  160. echo "Installing modules..."
  161. ZSTD_CLEVEL=19 make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
  162. DEPMOD=/doesnt/exist modules_install # Suppress depmod
  163. # remove build link
  164. rm "$modulesdir"/build
  165. }
  166. _package-headers() {
  167. pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
  168. depends=(pahole)
  169. provides=("${_replacesarchkernel[@]/%/-headers=${pkgver%%_*}}")
  170. conflicts=("${_replacesarchkernel[@]/%/-headers}" "${_replacesoldkernels[@]/%/-headers}")
  171. replaces=("${_replacesarchkernel[@]/%/-headers}" "${_replacesoldkernels[@]/%/-headers}")
  172. cd $_srcname
  173. local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
  174. echo "Installing build files..."
  175. install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
  176. localversion.* version vmlinux
  177. install -Dt "$builddir/kernel" -m644 kernel/Makefile
  178. install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile
  179. install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile_32.cpu
  180. cp -t "$builddir" -a scripts
  181. # required when STACK_VALIDATION is enabled
  182. if [[ -e tools/objtool/objtool ]]; then
  183. install -Dt "$builddir/tools/objtool" tools/objtool/objtool
  184. fi
  185. # required when DEBUG_INFO_BTF_MODULES is enabled
  186. if [[ -e tools/bpf/resolve_btfids/resolve_btfids ]]; then
  187. install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
  188. fi
  189. echo "Installing headers..."
  190. cp -t "$builddir" -a include
  191. cp -t "$builddir/arch/x86" -a arch/x86/include
  192. install -Dt "$builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
  193. install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
  194. install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
  195. # https://bugs.archlinux.org/task/13146
  196. install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
  197. # https://bugs.archlinux.org/task/20402
  198. install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
  199. install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
  200. install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
  201. # https://bugs.archlinux.org/task/71392
  202. install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
  203. echo "Installing KConfig files..."
  204. find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
  205. echo "Removing unneeded architectures..."
  206. local arch
  207. for arch in "$builddir"/arch/*/; do
  208. [[ $arch = */x86/ ]] && continue
  209. echo "Removing $(basename "$arch")"
  210. rm -r "$arch"
  211. done
  212. echo "Removing documentation..."
  213. rm -r "$builddir/Documentation"
  214. echo "Removing broken symlinks..."
  215. find -L "$builddir" -type l -printf 'Removing %P\n' -delete
  216. echo "Removing loose objects..."
  217. find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
  218. echo "Stripping build tools..."
  219. local file
  220. while read -rd '' file; do
  221. case "$(file -Sib "$file")" in
  222. application/x-sharedlib\;*) # Libraries (.so)
  223. strip -v $STRIP_SHARED "$file" ;;
  224. application/x-archive\;*) # Libraries (.a)
  225. strip -v $STRIP_STATIC "$file" ;;
  226. application/x-executable\;*) # Binaries
  227. strip -v $STRIP_BINARIES "$file" ;;
  228. application/x-pie-executable\;*) # Relocatable binaries
  229. strip -v $STRIP_SHARED "$file" ;;
  230. esac
  231. done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
  232. echo "Stripping vmlinux..."
  233. strip -v $STRIP_STATIC "$builddir/vmlinux"
  234. echo "Adding symlink..."
  235. mkdir -p "$pkgdir/usr/src"
  236. ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
  237. }
  238. _package-docs() {
  239. pkgdesc="Documentation for the $pkgdesc kernel"
  240. provides=("${_replacesarchkernel[@]/%/-docs=${pkgver%%_*}}")
  241. conflicts=("${_replacesarchkernel[@]/%/-docs}" "${_replacesoldkernels[@]/%/-docs}")
  242. replaces=("${_replacesarchkernel[@]/%/-docs}" "${_replacesoldkernels[@]/%/-docs}")
  243. cd $_srcname
  244. local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
  245. echo "Installing documentation..."
  246. local src dst
  247. while read -rd '' src; do
  248. dst="${src#Documentation/}"
  249. dst="$builddir/Documentation/${dst#output/}"
  250. install -Dm644 "$src" "$dst"
  251. done < <(find Documentation -name '.*' -prune -o ! -type d -print0)
  252. echo "Adding symlink..."
  253. mkdir -p "$pkgdir/usr/share/doc"
  254. ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"
  255. }
  256. pkgname=(
  257. "$pkgbase"
  258. "$pkgbase-headers"
  259. "$pkgbase-docs"
  260. )
  261. for _p in "${pkgname[@]}"; do
  262. eval "package_$_p() {
  263. $(declare -f "_package${_p#$pkgbase}")
  264. _package${_p#$pkgbase}
  265. }"
  266. done
  267. # vim:set ts=8 sts=2 sw=2 et: