PKGBUILD 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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=5.11.11
  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 kmod libelf pahole cpio perl tar xz
  17. xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick
  18. )
  19. options=('!strip')
  20. _srcname=linux-5.11
  21. source=(
  22. "https://linux-libre.fsfla.org/pub/linux-libre/releases/${_srcname##*-}-gnu/linux-libre-${_srcname##*-}-gnu.tar.xz"{,.sign}
  23. "https://linux-libre.fsfla.org/pub/linux-libre/releases/$pkgver-gnu/patch-${_srcname##*-}-gnu-$pkgver-gnu.xz"{,.sign}
  24. "https://repo.parabola.nu/other/linux-libre/logos/logo_linux_"{clut224.ppm,vga16.ppm,mono.pbm}{,.sig}
  25. config # the main kernel config files
  26. # maintain the TTY over USB disconnects
  27. # http://www.coreboot.org/EHCI_Gadget_Debug
  28. 0001-usb-serial-gadget-no-TTY-hangup-on-USB-disconnect-WI.patch
  29. # fix Atmel maXTouch touchscreen support
  30. # https://labs.parabola.nu/issues/877
  31. # http://www.fsfla.org/pipermail/linux-libre/2015-November/003202.html
  32. 0002-fix-Atmel-maXTouch-touchscreen-support.patch
  33. # Arch Linux patches
  34. 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
  35. 0002-iommu-amd-Don-t-initialise-remapping-irqdomain-if-IO.patch
  36. )
  37. validpgpkeys=(
  38. '474402C8C582DAFBE389C427BCB7CF877E7D47A7' # Alexandre Oliva
  39. '6DB9C4B4F0D8C0DC432CF6E4227CA7C556B2BA78' # David P.
  40. )
  41. sha512sums=('3a34006add9ea318b0c2863388925ba34d57d342535b00c9ebc61fbfc69ef206b64af21c35b101466508c4308b5da310743c8add74dd703e259612953104ae43'
  42. 'SKIP'
  43. 'b35fc1d243fa3fdfa2b50b8f01ccab297f958f497e58a104da18631fafe3923216f3f1e97b9c2bb9e719c8a7ae8cabe8198a1a82cb5e8e50488b64d7af4dc940'
  44. 'SKIP'
  45. '13cb5bc42542e7b8bb104d5f68253f6609e463b6799800418af33eb0272cc269aaa36163c3e6f0aacbdaaa1d05e2827a4a7c4a08a029238439ed08b89c564bb3'
  46. 'SKIP'
  47. '7a3716bfe3b9f546da309c7492f3e08f8f506813afeb1c737a474c83313d5c313cf4582b65215c2cfce3b74d9d1021c96e8badafe8f6e5b01fe28d2b5c61ae78'
  48. 'SKIP'
  49. '267295aa0cea65684968420c68b32f1a66a22d018b9d2b2c1ef14267bcf4cb68aaf7099d073cbfefe6c25c8608bdcbbd45f7ac8893fdcecbf1e621abdfe9ecc1'
  50. 'SKIP'
  51. 'ee91cdabc8c050ad74b619a19f1f1b6a96321b62fe3b4adcadd718e4c05cd97d0528ad48dda676f68e5d71c4c630ed117e668b6c63a267bf9c3aa2c68c7eebdf'
  52. '02af4dd2a007e41db0c63822c8ab3b80b5d25646af1906dc85d0ad9bb8bbf5236f8e381d7f91cf99ed4b0978c50aee37cb9567cdeef65b7ec3d91b882852b1af'
  53. 'b8fe56e14006ab866970ddbd501c054ae37186ddc065bb869cf7d18db8c0d455118d5bda3255fb66a0dde38b544655cfe9040ffe46e41d19830b47959b2fb168'
  54. '748d98aef69e93959eab6a7f20a7972aff50c577a079bba807b10fe9b3b98799b47215d76797360d336ba4c3c656d7eafe3e81f2a59a2b6888d1884071db6e95'
  55. 'da919328f8f7efd2c177a68ff864fdf1a76d777c142af4c90d3efc4a8419599e3479f8e0de0e8282599b9030c33a9e3b46548005d36c058ab08b51c03732bb45')
  56. _replacesarchkernel=("${_replacesarchkernel[@]/\%/${pkgbase#linux-libre}}")
  57. _replacesoldkernels=("${_replacesoldkernels[@]/\%/${pkgbase#linux-libre}}")
  58. _replacesoldmodules=("${_replacesoldmodules[@]/\%/${pkgbase#linux-libre}}")
  59. export KBUILD_BUILD_HOST=parabola
  60. export KBUILD_BUILD_USER=$pkgbase
  61. export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
  62. prepare() {
  63. cd $_srcname
  64. if [ "${_srcname##*-}" != "$pkgver" ]; then
  65. echo "Applying upstream patch..."
  66. patch -Np1 < "../patch-${_srcname##*-}-gnu-$pkgver-gnu"
  67. fi
  68. echo "Adding freedo as boot logo..."
  69. install -m644 -t drivers/video/logo \
  70. ../logo_linux_{clut224.ppm,vga16.ppm,mono.pbm}
  71. echo "Setting version..."
  72. scripts/setlocalversion --save-scmversion
  73. echo "-$pkgrel" > localversion.10-pkgrel
  74. echo "${pkgbase#linux-libre}" > localversion.20-pkgname
  75. local src
  76. for src in "${source[@]}"; do
  77. src="${src%%::*}"
  78. src="${src##*/}"
  79. [[ $src = *.patch ]] || continue
  80. echo "Applying patch $src..."
  81. patch -Np1 < "../$src"
  82. done
  83. echo "Setting config..."
  84. cp ../config .config
  85. make olddefconfig
  86. make -s kernelrelease > version
  87. echo "Prepared $pkgbase version $(<version)"
  88. }
  89. build() {
  90. cd $_srcname
  91. make all
  92. make htmldocs
  93. }
  94. _package() {
  95. pkgdesc="The $pkgdesc kernel and modules"
  96. depends=(coreutils kmod initramfs)
  97. optdepends=('crda: to set the correct wireless channels of your country'
  98. 'linux-libre-firmware: firmware images needed for some devices')
  99. provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE)
  100. provides+=("${_replacesarchkernel[@]/%/=${pkgver%.*}}" "LINUX-ABI_VERSION=${pkgver%.*}")
  101. conflicts=("${_replacesarchkernel[@]}" "${_replacesoldkernels[@]}" "${_replacesoldmodules[@]}")
  102. replaces=("${_replacesarchkernel[@]}" "${_replacesoldkernels[@]}" "${_replacesoldmodules[@]}")
  103. cd $_srcname
  104. local kernver="$(<version)"
  105. local modulesdir="$pkgdir/usr/lib/modules/$kernver"
  106. echo "Installing boot image..."
  107. # systemd expects to find the kernel here to allow hibernation
  108. # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
  109. install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
  110. # Used by mkinitcpio to name the kernel
  111. echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
  112. echo "Installing modules..."
  113. make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 modules_install
  114. # remove build and source links
  115. rm "$modulesdir"/{source,build}
  116. }
  117. _package-headers() {
  118. pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
  119. depends=(pahole)
  120. provides=("${_replacesarchkernel[@]/%/-headers=${pkgver%%_*}}")
  121. conflicts=("${_replacesarchkernel[@]/%/-headers}" "${_replacesoldkernels[@]/%/-headers}")
  122. replaces=("${_replacesarchkernel[@]/%/-headers}" "${_replacesoldkernels[@]/%/-headers}")
  123. cd $_srcname
  124. local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
  125. echo "Installing build files..."
  126. install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
  127. localversion.* version vmlinux
  128. install -Dt "$builddir/kernel" -m644 kernel/Makefile
  129. install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile
  130. install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile_32.cpu
  131. cp -t "$builddir" -a scripts
  132. # add xfs and shmem for aufs building
  133. mkdir -p "$builddir"/{fs/xfs,mm}
  134. echo "Installing headers..."
  135. cp -t "$builddir" -a include
  136. cp -t "$builddir/arch/x86" -a arch/x86/include
  137. install -Dt "$builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
  138. install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
  139. install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
  140. # http://bugs.archlinux.org/task/13146
  141. install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
  142. # http://bugs.archlinux.org/task/20402
  143. install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
  144. install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
  145. install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
  146. echo "Installing KConfig files..."
  147. find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
  148. echo "Removing unneeded architectures..."
  149. local arch
  150. for arch in "$builddir"/arch/*/; do
  151. [[ $arch = */x86/ ]] && continue
  152. echo "Removing $(basename "$arch")"
  153. rm -r "$arch"
  154. done
  155. echo "Removing documentation..."
  156. rm -r "$builddir/Documentation"
  157. echo "Removing broken symlinks..."
  158. find -L "$builddir" -type l -printf 'Removing %P\n' -delete
  159. echo "Removing loose objects..."
  160. find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
  161. echo "Stripping build tools..."
  162. local file
  163. while read -rd '' file; do
  164. case "$(file -bi "$file")" in
  165. application/x-sharedlib\;*) # Libraries (.so)
  166. strip -v $STRIP_SHARED "$file" ;;
  167. application/x-archive\;*) # Libraries (.a)
  168. strip -v $STRIP_STATIC "$file" ;;
  169. application/x-executable\;*) # Binaries
  170. strip -v $STRIP_BINARIES "$file" ;;
  171. application/x-pie-executable\;*) # Relocatable binaries
  172. strip -v $STRIP_SHARED "$file" ;;
  173. esac
  174. done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
  175. echo "Stripping vmlinux..."
  176. strip -v $STRIP_STATIC "$builddir/vmlinux"
  177. echo "Adding symlink..."
  178. mkdir -p "$pkgdir/usr/src"
  179. ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
  180. }
  181. _package-docs() {
  182. pkgdesc="Documentation for the $pkgdesc kernel"
  183. provides=("${_replacesarchkernel[@]/%/-docs=${pkgver%%_*}}")
  184. conflicts=("${_replacesarchkernel[@]/%/-docs}" "${_replacesoldkernels[@]/%/-docs}")
  185. replaces=("${_replacesarchkernel[@]/%/-docs}" "${_replacesoldkernels[@]/%/-docs}")
  186. cd $_srcname
  187. local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
  188. echo "Installing documentation..."
  189. local src dst
  190. while read -rd '' src; do
  191. dst="${src#Documentation/}"
  192. dst="$builddir/Documentation/${dst#output/}"
  193. install -Dm644 "$src" "$dst"
  194. done < <(find Documentation -name '.*' -prune -o ! -type d -print0)
  195. echo "Adding symlink..."
  196. mkdir -p "$pkgdir/usr/share/doc"
  197. ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"
  198. }
  199. pkgname=("$pkgbase" "$pkgbase-headers" "$pkgbase-docs")
  200. for _p in "${pkgname[@]}"; do
  201. eval "package_$_p() {
  202. $(declare -f "_package${_p#$pkgbase}")
  203. _package${_p#$pkgbase}
  204. }"
  205. done
  206. # vim:set ts=8 sts=2 sw=2 et: