Advertisement
Guest User

Untitled

a guest
Apr 19th, 2020
832
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.27 KB | None | 0 0
  1. # Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
  2.  
  3. pkgbase=linux-milo
  4. pkgver=5.6.5.arch3
  5. pkgrel=1
  6. pkgdesc='Linux'
  7. _srctag=v${pkgver%.*}-${pkgver##*.}
  8. url="https://git.archlinux.org/linux.git/log/?h=$_srctag"
  9. arch=(x86_64)
  10. license=(GPL2)
  11. makedepends=(
  12. bc kmod libelf
  13. xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick
  14. git
  15. )
  16. options=('!strip')
  17. _srcname=archlinux-linux
  18. source=(
  19. "$_srcname::git+https://git.archlinux.org/linux.git?signed#tag=$_srctag"
  20. config # the main kernel config file
  21. sphinx-workaround.patch
  22. )
  23. validpgpkeys=(
  24. 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
  25. '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
  26. '8218F88849AAC522E94CF470A5E9288C4FA415FA' # Jan Alexander Steffens (heftig)
  27. )
  28. sha256sums=('SKIP'
  29. 'dfd3310bc2d3c4adbaba5e4f2260a8a110706993be1c3e02a5ddfe88bf0c63ce'
  30. '8cb21e0b3411327b627a9dd15b8eb773295a0d2782b1a41b2a8839d1b2f5778c')
  31.  
  32. export KBUILD_BUILD_HOST=archlinux
  33. export KBUILD_BUILD_USER=$pkgbase
  34. export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
  35.  
  36. prepare() {
  37. cd $_srcname
  38.  
  39. echo "Setting version..."
  40. scripts/setlocalversion --save-scmversion
  41. echo "-$pkgrel" > localversion.10-pkgrel
  42. echo "${pkgbase#linux}" > localversion.20-pkgname
  43.  
  44. local src
  45. git revert 6c3a44ed3c553c324845744f30bcd1d3b07d61fd
  46. for src in "${source[@]}"; do
  47. src="${src%%::*}"
  48. src="${src##*/}"
  49. [[ $src = *.patch ]] || continue
  50. echo "Applying patch $src..."
  51. patch -Np1 < "../$src"
  52. done
  53.  
  54. echo "Setting config..."
  55. cp ../config .config
  56. make olddefconfig
  57.  
  58. make -s kernelrelease > version
  59. echo "Prepared $pkgbase version $(<version)"
  60. }
  61.  
  62. build() {
  63. cd $_srcname
  64. make all
  65. make htmldocs
  66. }
  67.  
  68. _package() {
  69. pkgdesc="The $pkgdesc kernel and modules"
  70. depends=(coreutils kmod initramfs)
  71. optdepends=('crda: to set the correct wireless channels of your country'
  72. 'linux-firmware: firmware images needed for some devices')
  73. provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE)
  74. replaces=(virtualbox-guest-modules-arch wireguard-arch)
  75.  
  76. cd $_srcname
  77. local kernver="$(<version)"
  78. local modulesdir="$pkgdir/usr/lib/modules/$kernver"
  79.  
  80. echo "Installing boot image..."
  81. # systemd expects to find the kernel here to allow hibernation
  82. # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
  83. install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
  84.  
  85. # Used by mkinitcpio to name the kernel
  86. echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
  87.  
  88. echo "Installing modules..."
  89. make INSTALL_MOD_PATH="$pkgdir/usr" modules_install
  90.  
  91. # remove build and source links
  92. rm "$modulesdir"/{source,build}
  93. }
  94.  
  95. _package-headers() {
  96. pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
  97.  
  98. cd $_srcname
  99. local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
  100.  
  101. echo "Installing build files..."
  102. install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
  103. localversion.* version vmlinux
  104. install -Dt "$builddir/kernel" -m644 kernel/Makefile
  105. install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile
  106. cp -t "$builddir" -a scripts
  107.  
  108. # add objtool for external module building and enabled VALIDATION_STACK option
  109. install -Dt "$builddir/tools/objtool" tools/objtool/objtool
  110.  
  111. # add xfs and shmem for aufs building
  112. mkdir -p "$builddir"/{fs/xfs,mm}
  113.  
  114. echo "Installing headers..."
  115. cp -t "$builddir" -a include
  116. cp -t "$builddir/arch/x86" -a arch/x86/include
  117. install -Dt "$builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
  118.  
  119. install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
  120. install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
  121.  
  122. # http://bugs.archlinux.org/task/13146
  123. install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
  124.  
  125. # http://bugs.archlinux.org/task/20402
  126. install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
  127. install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
  128. install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
  129.  
  130. echo "Installing KConfig files..."
  131. find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
  132.  
  133. echo "Removing unneeded architectures..."
  134. local arch
  135. for arch in "$builddir"/arch/*/; do
  136. [[ $arch = */x86/ ]] && continue
  137. echo "Removing $(basename "$arch")"
  138. rm -r "$arch"
  139. done
  140.  
  141. echo "Removing documentation..."
  142. rm -r "$builddir/Documentation"
  143.  
  144. echo "Removing broken symlinks..."
  145. find -L "$builddir" -type l -printf 'Removing %P\n' -delete
  146.  
  147. echo "Removing loose objects..."
  148. find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
  149.  
  150. echo "Stripping build tools..."
  151. local file
  152. while read -rd '' file; do
  153. case "$(file -bi "$file")" in
  154. application/x-sharedlib\;*) # Libraries (.so)
  155. strip -v $STRIP_SHARED "$file" ;;
  156. application/x-archive\;*) # Libraries (.a)
  157. strip -v $STRIP_STATIC "$file" ;;
  158. application/x-executable\;*) # Binaries
  159. strip -v $STRIP_BINARIES "$file" ;;
  160. application/x-pie-executable\;*) # Relocatable binaries
  161. strip -v $STRIP_SHARED "$file" ;;
  162. esac
  163. done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
  164.  
  165. echo "Adding symlink..."
  166. mkdir -p "$pkgdir/usr/src"
  167. ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
  168. }
  169.  
  170. _package-docs() {
  171. pkgdesc="Documentation for the $pkgdesc kernel"
  172.  
  173. cd $_srcname
  174. local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
  175.  
  176. echo "Installing documentation..."
  177. local src dst
  178. while read -rd '' src; do
  179. dst="${src#Documentation/}"
  180. dst="$builddir/Documentation/${dst#output/}"
  181. install -Dm644 "$src" "$dst"
  182. done < <(find Documentation -name '.*' -prune -o ! -type d -print0)
  183.  
  184. echo "Adding symlink..."
  185. mkdir -p "$pkgdir/usr/share/doc"
  186. ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"
  187. }
  188.  
  189. pkgname=("$pkgbase" "$pkgbase-headers" "$pkgbase-docs")
  190. for _p in "${pkgname[@]}"; do
  191. eval "package_$_p() {
  192. $(declare -f "_package${_p#$pkgbase}")
  193. _package${_p#$pkgbase}
  194. }"
  195. done
  196.  
  197. # vim:set ts=8 sts=2 sw=2 et:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement