PKGBUILD 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. # Maintainer: David P. <megver83@parabola.nu>
  2. # Contributor: André Silva <emulatorman@hyperbola.info>
  3. # Contributor: Márcio Silva <coadde@hyperbola.info>
  4. # Contributor: fauno <fauno@parabola.nu>
  5. # Contributor: Sorin-Mihai Vârgolici <smv@yobicore.org>
  6. # Contributor: Michał Masłowski <mtjm@mtjm.eu>
  7. # Contributor: Luke R. <g4jc@openmailbox.org>
  8. # Contributor: Andreas Grapentin <andreas@grapentin.org>
  9. # Based on linux package
  10. _replacesarchkernel=('linux%') # '%' gets replaced with kernel suffix
  11. _replacesoldkernels=() # '%' gets replaced with kernel suffix
  12. _replacesoldmodules=() # '%' gets replaced with kernel suffix
  13. pkgbase=linux-libre
  14. pkgver=6.7.4
  15. pkgrel=2
  16. pkgdesc='Linux-libre'
  17. url='https://linux-libre.fsfla.org/'
  18. arch=(i686 x86_64 armv7h)
  19. license=(GPL2)
  20. makedepends=(
  21. bc
  22. cpio
  23. gettext
  24. libelf
  25. pahole
  26. perl
  27. python
  28. tar
  29. xz
  30. # htmldocs
  31. graphviz
  32. imagemagick
  33. python-sphinx
  34. texlive-latexextra
  35. )
  36. makedepends_armv7h=(uboot-tools vboot-utils dtc) # required by linux-libre-chromebook
  37. options=('!strip')
  38. _srcname=linux-6.7
  39. source=(
  40. "https://linux-libre.fsfla.org/pub/linux-libre/releases/${_srcname##*-}-gnu/linux-libre-${_srcname##*-}-gnu.tar.xz"{,.sign}
  41. "https://linux-libre.fsfla.org/pub/linux-libre/releases/$pkgver-gnu/patch-${_srcname##*-}-gnu-$pkgver-gnu.xz"{,.sign}
  42. "https://repo.parabola.nu/other/linux-libre/logos/logo_linux_"{clut224.ppm,vga16.ppm,mono.pbm}{,.sig}
  43. config.i686 config.x86_64 config.armv7h # the main kernel config files
  44. linux-armv7h.preset # armv7h preset file for mkinitcpio ramdisk
  45. "kernel"{.its,.keyblock,_data_key.vbprivk} # files for signing veyron Chromebook kernels
  46. # maintain the TTY over USB disconnects
  47. # http://www.coreboot.org/EHCI_Gadget_Debug
  48. 0001-usb-serial-gadget-no-TTY-hangup-on-USB-disconnect-WI.patch
  49. # fix Atmel maXTouch touchscreen support
  50. # https://labs.parabola.nu/issues/877
  51. # http://www.fsfla.org/pipermail/linux-libre/2015-November/003202.html
  52. 0002-fix-Atmel-maXTouch-touchscreen-support.patch
  53. # Arch Linux patches
  54. # https://github.com/archlinux/linux
  55. 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
  56. 0002-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch
  57. 0003-arch-Kconfig-Default-to-maximum-amount-of-ASLR-bits.patch
  58. )
  59. source_i686=(
  60. # avoid using zstd compression in ultra mode (exhausts virtual memory)
  61. no-ultra-zstd.patch
  62. )
  63. source_armv7h=(
  64. # Arch Linux ARM patches
  65. # https://github.com/archlinuxarm/PKGBUILDs/tree/master/core/linux-armv7
  66. 0001-ARM-atags-add-support-for-Marvell-s-u-boot.patch
  67. 0002-ARM-atags-fdt-retrieve-MAC-addresses-from-Marvell-bo.patch
  68. 0003-fix-mvsdio-eMMC-timing.patch
  69. 0004-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch
  70. #0005-set-default-cubietruck-led-triggers.patch
  71. #0006-exynos4412-odroid-set-higher-minimum-buck2-regulator.patch
  72. #0007-USB-Armory-MkII-support.patch
  73. # ChromiumOS patch
  74. # https://labs.parabola.nu/issues/2372
  75. 0001-CHROMIUM-block-partitions-efi-Add-support-for-IGNORE.patch
  76. )
  77. validpgpkeys=(
  78. 474402C8C582DAFBE389C427BCB7CF877E7D47A7 # Alexandre Oliva
  79. 6DB9C4B4F0D8C0DC432CF6E4227CA7C556B2BA78 # David P.
  80. )
  81. sha256sums=('eb43c7dfe646d607ce7f010fa77789260db46fad1086dcd5c7f8df0bee9c14b0'
  82. 'SKIP'
  83. 'ed1227ef770e37e3df3e760b908497f8492c2902c2e9063737690cf70d94c14c'
  84. 'SKIP'
  85. 'bfd4a7f61febe63c880534dcb7c31c5b932dde6acf991810b41a939a93535494'
  86. 'SKIP'
  87. '6de8a8319271809ffdb072b68d53d155eef12438e6d04ff06a5a4db82c34fa8a'
  88. 'SKIP'
  89. '13bd7a8d9ed6b6bc971e4cd162262c5a20448a83796af39ce394d827b0e5de74'
  90. 'SKIP'
  91. '0e4aed294e60fc9ac397cff327a8b549e672d423bf71e4a2e53c62d36c60701c'
  92. 'b2b69216aeb072ae8c40256c253a68c40a98f91d3ee544747c5e381eb7f311b8'
  93. 'b66961f28d8e01d4c0cb6bf9df6cc3edc89c7a3369f44bb718ff6a1d77f6fd74'
  94. 'ca1708abbd2f8960c278722dc81a7c635973d92872386ad9e2fff10b86836e98'
  95. '523d52a6fc9df4c43c8401f17cd796ebd281845d05358c9564a64d8c5a63f028'
  96. '4e708c9ec43ac4a5d718474c9431ba6b6da3e64a9dda6afd2853a9e9e3079ffb'
  97. 'bc9e707a86e55a93f423e7bcdae4a25fd470b868e53829b91bbe2ccfbc6da27b'
  98. '0376bd5efa31d4e2a9d52558777cebd9f0941df8e1adab916c868bf0c05f2fc3'
  99. '351fd96be8cd5ebd0435c0a8a978673fc023e3b1026085e67f86d815b2285e25'
  100. '994b27f23073a6e04bf8a61cd2eb9d2511b8eb0e81ed7828d4c3880f1e1f5061'
  101. 'e66f241a67f2aeda3fd61ef56c6fa40f414f3b89b5e700cfb7680384f2be7f63'
  102. 'f36b1b3109d035139cfff75962a81c870fcb73fc3f81bb958e34a9e60af4fa3a')
  103. sha256sums_i686=('d32270be5fd9c3e3ba50f3aef33f6cfcb85be0c8216f03b777287cc621fdff28')
  104. sha256sums_armv7h=('ef4661a32234fe12bda28e698400c78c11491387df83ee554c53afb4dba244da'
  105. 'd3a4b7c7a3d3b4d69369b85630eef33b21cfbcffc23adbdc3cfa837610912287'
  106. '2bce52fa4ae4d34ca171d3aa100302a920c231275fc3ba9141af8b2f68cf67d1'
  107. '12d5706b00d2939b92130a4dc41d060f5e1fea75424b902ebceca72e427dc3b9'
  108. 'f4d4b44adc4b47b18bac33aa2c46b458c1b7ceb277416eff59054b6d7687c6da')
  109. b2sums=('45471cdf9e8fc37e384bdcfc2d22b113850daf62a5bea70a1dc6ea402fd2f924bc21cb0275f7e22532092e20af6de7fc2bc7f2056321d29fd29e5cb0e7e80f87'
  110. 'SKIP'
  111. 'e7e8c9e4bae48c6c15ce3d5b50694ae8560a48731263445c81284c5e798eb8d77ef032dc22d3dcbe8b47029f53518cbe559d8194b92d0c8bec76bb3acf9f708c'
  112. 'SKIP'
  113. '73fee2ae5cb1ffd3e6584e56da86a8b1ff6c713aae54d77c0dab113890fc673dc5f300eb9ed93fb367b045ece8fa80304ff277fe61665eccf7b7ce24f0c045eb'
  114. 'SKIP'
  115. 'd02a1153a4285b32c774dca4560fe37907ccf30b8e487a681b717ed95ae9bed5988875c0a118938e5885ae9d2857e53a6f216b732b6fa3368e3c5fe08c86382c'
  116. 'SKIP'
  117. '580911af9431c066bbc072fd22d5e2ef65f12d8358cec5ff5a4f1b7deebb86cef6b5c1ad631f42350af72c51d44d2093c71f761234fb224a8b9dbb3b64b8201d'
  118. 'SKIP'
  119. '196423ae81a8c359db0c70888b3117d126594699ddbf3033c69c5c2aba02d20f7349a48b9d8095c7d398024b10ef1f89f12b59421074cd57ac74d9462b0457d0'
  120. '6389814bc853747652d366753e69c007a7499ac62e0052c81f83b78f151a186b2b25409c5e08ee027e1a262767476b07d6812779056719a80caf70b7e1dd5621'
  121. '5760e0879cf71dfc1c9bdd557829f28437909e701fa566cc3575a52785c81ac70d634ec929833ac01aea111bbae6ba402add738dc86623b32bcc3b523d43f60f'
  122. 'af69176b1117b94e56b043e97b0bd5873a2974a6a2fd52b102d0ffdca440ff68cfb241d6c4d4ef453cc8c220c236b739bad232e53fd500ce7672fa6e5ba87383'
  123. '9336fb5d1f98a77144673750b0f924b15b60e98e4bba0d13d1b1a5c977f14538f97143147081c94e0d8555b5dbd246fe0a410c7146a9b0866f3728176548fb0a'
  124. 'eeed12b2ab60c3d3aad598a1d44b4f23560d818e8fe1ef143f857c8e176652df53501b192ade7d4d915d425fff818b2a232d46bae0d3a0f46b8959e614e0ede2'
  125. 'aaa4e28a31967cc3a7fe25a86ba35fdfa210cd8b1a9cc96298349cbf01d60cdf146ee519d6803d05b175873f1b3367e47194a178db7ed97c802e59b38f8c303c'
  126. 'c2214154c36900e311531bfe68184f31639f5c50fed23bc3803a7f18439b7ff258552a39f02fed0ea92f10744e17a6c55cef0ef1a98187f978fe480fb3dddc14'
  127. '0c7ceba7cd90087db3296610a07886f337910bad265a32c052d3a703e6eb8e53f355ab9948d72d366408d968d8ee7435084dd89bef5ed0b69355fd884c2cd468'
  128. '6f1d4a50cbfc5777d481596593b4d137fcd35b5b2af6ad610147ae28e5918800f917f7d65544c97b67005ad7c171b36c205c748e24a5d44fea23ed53460bd2bc'
  129. '3b9a9e60af14d82d82e9645b55cd8f1f5827da1b15226c1cd8022c0a426c1d4d66981c2be2ef422cd7401aa74d3e610ebe9f4e76e0b506cebe758bc27464145a'
  130. 'a8b01480b16f062bf465149494387f6f4eabc3289dc7596c4dbfe4a4a963f60d717f86cead9dc37d1fea9c9213cd6d2663648f3fc8d197c09d006ac2dc0c4511')
  131. b2sums_i686=('165ab9dd8cedeaae5327accc1581c19cf0be55f923b03feb889cad3351b74c7c4cd3d3c206938e5152bfe1d947513dea8f630f8f5544099ec13d16d254725c40')
  132. b2sums_armv7h=('73ecc5862c6b4aef7b163c1992004273fbf791b82c75a8602e3def311f682f2b866124c0bfde90d03c7c76bb8b5853bdb9daad6ee2ab0908f4145cda476b8286'
  133. '15f7b70b5d153e9336006aba873a78f94d91b8df5e1939041f12e678bb9cfbdda2e362001068a07c044ce606cf0d4d2e625002df9c569c914f7ac248d4d3e8ad'
  134. '6219cec826bc543000ab87cf35dcc713f0635519cf79e75888b213a5e2d1f728e59e70df7fd842dda6e40494bf9cafa9f87368cb75b338c5a157a0adcf583512'
  135. '66d6cff292962c4c8bbea62b2240c4c53c0c514f9e99864be9244cb846c505e1bedd800ca1347b80883543035d20573b06796e5bacbace6e829880695ffca781'
  136. '741ad7ffc9e8200657315fc4111066b2477cde35ecdc5e73976457f17106f80d148d86bf97b92c523fef1cc5a26ddb867d16330f592f2aa4d886be596bedc8df')
  137. _replacesarchkernel=("${_replacesarchkernel[@]/\%/${pkgbase#linux-libre}}")
  138. _replacesoldkernels=("${_replacesoldkernels[@]/\%/${pkgbase#linux-libre}}")
  139. _replacesoldmodules=("${_replacesoldmodules[@]/\%/${pkgbase#linux-libre}}")
  140. case "$CARCH" in
  141. i686|x86_64) KARCH=x86;;
  142. armv7h) KARCH=arm;;
  143. esac
  144. export KBUILD_BUILD_HOST=parabola
  145. export KBUILD_BUILD_USER=$pkgbase
  146. export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
  147. prepare() {
  148. cd $_srcname
  149. if [ "${_srcname##*-}" != "$pkgver" ]; then
  150. echo "Applying upstream patch..."
  151. patch -Np1 < "../patch-${_srcname##*-}-gnu-$pkgver-gnu"
  152. fi
  153. echo "Adding freedo as boot logo..."
  154. install -m644 -t drivers/video/logo \
  155. ../logo_linux_{clut224.ppm,vga16.ppm,mono.pbm}
  156. echo "Setting version..."
  157. echo "-$pkgrel" > localversion.10-pkgrel
  158. echo "${pkgbase#linux-libre}" > localversion.20-pkgname
  159. local source=("${source[@]}")
  160. case "$CARCH" in
  161. "armv7h")
  162. source+=("${source_armv7h[@]}") ;;
  163. "i686")
  164. source+=("${source_i686[@]}") ;;
  165. esac
  166. local src
  167. for src in "${source[@]}"; do
  168. src="${src%%::*}"
  169. src="${src##*/}"
  170. src="${src%.zst}"
  171. [[ $src = *.patch ]] || continue
  172. echo "Applying patch $src..."
  173. patch -Np1 < "../$src"
  174. done
  175. echo "Setting config..."
  176. cp ../config.$CARCH .config
  177. make olddefconfig
  178. diff -u ../config.$CARCH .config || :
  179. make -s kernelrelease > version
  180. echo "Prepared $pkgbase version $(<version)"
  181. }
  182. build() {
  183. cd $_srcname
  184. make all
  185. # temporarily disabled documentation due to sphinx_rtd_theme (FS32#163)
  186. if [ "$CARCH" != "i686" ]; then
  187. make htmldocs
  188. fi
  189. }
  190. _package() {
  191. pkgdesc="The $pkgdesc kernel and modules"
  192. depends=(
  193. coreutils
  194. initramfs
  195. kmod
  196. )
  197. optdepends=(
  198. 'wireless-regdb: to set the correct wireless channels of your country'
  199. 'linux-libre-firmware: firmware images needed for some devices'
  200. )
  201. provides=(
  202. KSMBD-MODULE
  203. VIRTUALBOX-GUEST-MODULES
  204. WIREGUARD-MODULE
  205. )
  206. replaces=(
  207. virtualbox-guest-modules-arch
  208. wireguard-arch
  209. )
  210. provides+=("${_replacesarchkernel[@]/%/=$pkgver}" "LINUX-ABI_VERSION=$pkgver")
  211. conflicts+=("${_replacesarchkernel[@]}" "${_replacesoldkernels[@]}" "${_replacesoldmodules[@]}")
  212. replaces+=("${_replacesarchkernel[@]}" "${_replacesoldkernels[@]}" "${_replacesoldmodules[@]}")
  213. cd $_srcname
  214. local modulesdir="$pkgdir/usr/lib/modules/$(<version)"
  215. echo "Installing boot image..."
  216. # systemd expects to find the kernel here to allow hibernation
  217. # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
  218. install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
  219. # On armv7h, the uboot4extlinux-* packages provide and use a extlinux.conf
  220. # file in /boot/extlinux/. This file is needed for the bootloader to find the
  221. # kernel, initramfs and devicetree. Because of that we need the kernel image
  222. # to also be installed in /boot for several reasons:
  223. #
  224. # - First the $modulesdir name contains the kernel version, and extlinux.conf
  225. # is supposed to be edited by hand by users. Users can't be expected to do
  226. # that at each kernel updates beause at some point they will forget and get
  227. # a mismatch between the kernel image and modules which often breaks boot.
  228. # In addition people know that the kernel image is in /boot. Having it in
  229. # $moduledir instead is not documented anywhere. And we don't have code that
  230. # can automatically generate an extlinux.conf.
  231. #
  232. # - Then we also need the kernel image in /boot to be able to use LVM rootfs
  233. # as this requires a separate /boot partition and u-boot can't read LVM.
  234. #
  235. # - Finally, doing the copy manually might be straigtforward in some cases,
  236. # as computers like the Lime 2 A20 are well supported, boot on a microSD or
  237. # other removable storage that can be read by a laptop/desktop computer and
  238. # even has a display that works at boot. But some of the supported ARM
  239. # computers have an internal eMMC and no display that works at boot (like
  240. # the TBS2910 or beaglebone black) and no way to export the internal storage
  241. # as an usb mass storage (because the ums command is not compiled in u-boot)
  242. # and sometimes even no way to connect a display at all (like the BegaleBone
  243. # green). So that makes the simple way of copying a file way more complex.
  244. # So it is a good idea not to break the boot if possible.
  245. if [ "$CARCH" = "armv7h" ]; then
  246. install -Dm644 "$(make -s image_name)" "$pkgdir/boot/vmlinuz-${pkgbase}"
  247. fi
  248. # Used by mkinitcpio to name the kernel
  249. echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
  250. echo "Installing modules..."
  251. ZSTD_CLEVEL=19 make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
  252. DEPMOD=/doesnt/exist modules_install # Suppress depmod
  253. # remove build link
  254. rm "$modulesdir"/build
  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. depends=(pahole)
  268. provides=("${_replacesarchkernel[@]/%/-headers=$pkgver}")
  269. conflicts=("${_replacesarchkernel[@]/%/-headers}" "${_replacesoldkernels[@]/%/-headers}")
  270. replaces=("${_replacesarchkernel[@]/%/-headers}" "${_replacesoldkernels[@]/%/-headers}")
  271. cd $_srcname
  272. local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
  273. echo "Installing build files..."
  274. install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
  275. localversion.* version vmlinux
  276. install -Dt "$builddir/kernel" -m644 kernel/Makefile
  277. install -Dt "$builddir/arch/$KARCH" -m644 arch/$KARCH/Makefile
  278. if [ "$CARCH" = "i686" ]; then
  279. install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile_32.cpu
  280. fi
  281. cp -t "$builddir" -a scripts
  282. # required when STACK_VALIDATION is enabled
  283. if [[ -e tools/objtool/objtool ]]; then
  284. install -Dt "$builddir/tools/objtool" tools/objtool/objtool
  285. fi
  286. # required when DEBUG_INFO_BTF_MODULES is enabled
  287. if [[ -e tools/bpf/resolve_btfids/resolve_btfids ]]; then
  288. install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
  289. fi
  290. echo "Installing headers..."
  291. cp -t "$builddir" -a include
  292. cp -t "$builddir/arch/$KARCH" -a arch/$KARCH/include
  293. install -Dt "$builddir/arch/$KARCH/kernel" -m644 arch/$KARCH/kernel/asm-offsets.s
  294. install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
  295. install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
  296. # https://bugs.archlinux.org/task/13146
  297. install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
  298. # https://bugs.archlinux.org/task/20402
  299. install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
  300. install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
  301. install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
  302. # https://bugs.archlinux.org/task/71392
  303. install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
  304. echo "Installing KConfig files..."
  305. find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
  306. echo "Removing unneeded architectures..."
  307. local arch
  308. for arch in "$builddir"/arch/*/; do
  309. [[ $arch = */$KARCH/ ]] && continue
  310. echo "Removing $(basename "$arch")"
  311. rm -r "$arch"
  312. done
  313. echo "Removing documentation..."
  314. rm -r "$builddir/Documentation"
  315. echo "Removing broken symlinks..."
  316. find -L "$builddir" -type l -printf 'Removing %P\n' -delete
  317. echo "Removing loose objects..."
  318. find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
  319. echo "Stripping build tools..."
  320. local file
  321. while read -rd '' file; do
  322. case "$(file -Sib "$file")" in
  323. application/x-sharedlib\;*) # Libraries (.so)
  324. strip -v $STRIP_SHARED "$file" ;;
  325. application/x-archive\;*) # Libraries (.a)
  326. strip -v $STRIP_STATIC "$file" ;;
  327. application/x-executable\;*) # Binaries
  328. strip -v $STRIP_BINARIES "$file" ;;
  329. application/x-pie-executable\;*) # Relocatable binaries
  330. strip -v $STRIP_SHARED "$file" ;;
  331. esac
  332. done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
  333. echo "Stripping vmlinux..."
  334. strip -v $STRIP_STATIC "$builddir/vmlinux"
  335. echo "Adding symlink..."
  336. mkdir -p "$pkgdir/usr/src"
  337. ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
  338. }
  339. _package-docs() {
  340. pkgdesc="Documentation for the $pkgdesc kernel"
  341. provides=("${_replacesarchkernel[@]/%/-docs=$pkgver}")
  342. conflicts=("${_replacesarchkernel[@]/%/-docs}" "${_replacesoldkernels[@]/%/-docs}")
  343. replaces=("${_replacesarchkernel[@]/%/-docs}" "${_replacesoldkernels[@]/%/-docs}")
  344. cd $_srcname
  345. local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
  346. echo "Installing documentation..."
  347. local src dst
  348. while read -rd '' src; do
  349. dst="${src#Documentation/}"
  350. dst="$builddir/Documentation/${dst#output/}"
  351. install -Dm644 "$src" "$dst"
  352. done < <(find Documentation -name '.*' -prune -o ! -type d -print0)
  353. echo "Adding symlink..."
  354. mkdir -p "$pkgdir/usr/share/doc"
  355. ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"
  356. }
  357. _package-chromebook() {
  358. pkgdesc="$pkgdesc kernel sign for Veyron Chromebooks"
  359. depends=(linux-libre=$pkgver)
  360. provides=("${_replacesarchkernel[@]/%/-armv7-chromebook=$pkgver}")
  361. conflicts=("${_replacesarchkernel[@]/%/-armv7-chromebook}" "${_replacesoldkernels[@]/%/-armv7-chromebook}")
  362. replaces=("${_replacesarchkernel[@]/%/-armv7-chromebook}" "${_replacesoldkernels[@]/%/-armv7-chromebook}")
  363. install=$pkgbase-chromebook.install
  364. cd $_srcname
  365. cp ../kernel.its .
  366. mkimage -D "-I dts -O dtb -p 2048" -f kernel.its kernel.signed
  367. dd if=/dev/zero of=bootloader.bin bs=512 count=1
  368. echo 'console=tty0 init=/sbin/init root=PARTUUID=%U/PARTNROFF=1 rootwait rw noinitrd' > cmdline
  369. echo "Creating kernel sign..."
  370. vbutil_kernel \
  371. --pack vmlinux.kpart \
  372. --version 1 \
  373. --vmlinuz kernel.signed \
  374. --arch arm \
  375. --keyblock ../kernel.keyblock \
  376. --signprivate ../kernel_data_key.vbprivk \
  377. --config cmdline \
  378. --bootloader bootloader.bin
  379. echo "Installing kernel sign..."
  380. mkdir -p "$pkgdir/boot"
  381. cp vmlinux.kpart "$pkgdir/boot"
  382. }
  383. pkgname=(
  384. "$pkgbase"
  385. "$pkgbase-headers"
  386. "$pkgbase-docs"
  387. )
  388. [ "$CARCH" = "armv7h" ] && pkgname+=("$pkgbase-chromebook")
  389. for _p in "${pkgname[@]}"; do
  390. eval "package_$_p() {
  391. $(declare -f "_package${_p#$pkgbase}")
  392. _package${_p#$pkgbase}
  393. }"
  394. done
  395. # vim:set ts=8 sts=2 sw=2 et: