PKGBUILD 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. # Maintainer (arch): Christian Hesse <mail@eworm.de>
  2. # Maintainer (arch): Ronald van Haren <ronald.archlinux.org>
  3. # Contributor: Tobias Powalowski <tpowa@archlinux.org>
  4. # Contributor: Keshav Amburay <(the ddoott ridikulus ddoott rat) (aatt) (gemmaeiil) (ddoott) (ccoomm)>
  5. # Contributor: André Silva <emulatorman@hyperbola.info>
  6. # Contributor: Márcio Silva <coadde@hyperbola.info>
  7. # Contributor: Omar Vega Ramos <ovruni@gnu.org.pe>
  8. # Maintainer: Luke T. Shumaker <lukeshu@parabola.nu>
  9. # parabola changes and rationale:
  10. # - Branded for Parabola, not Arch
  11. # - Support more arches
  12. # - Add more platforms:
  13. # + Arch starts with:
  14. # * --with-platform=pc (x86 BIOS)
  15. # * --with-platform=efi (UEFI, x86 and ARM; if
  16. # _IA32_EFI_IN_ARCH_X86=1 then the x86_64
  17. # package contains both 32bit and 64bit
  18. # builds)
  19. # * --with-platform=emu (if _GRUB_EMU_BUILD=1, user-mode, x86 and ARM)
  20. # + Parabola additions, since
  21. # "grub: add armv7h support (U-Boot and UEFI)"
  22. # (2015-09-26, Márcio Alexandre Silva Delgado <coadde@parabola.nu>)
  23. # * --with-platform=uboot (ARM)
  24. # * --with-platform=emu (enabled _GRUB_EMU_BUILD=1, fixed dependencies)
  25. # + Parabola additions, since
  26. # "grub: rm unused grub-extras in U-Boot, fix msg on U-Boot build; add IEEE1275 (OpenFirmware) and Libreboot support"
  27. # (2015-09-26, Márcio Alexandre Silva Delgado <coadde@parabola.nu>)
  28. # * --with-platform=ieee1275 (OpenFirmware, x86-only)
  29. # * --with-platform=coreboot (Libreboot, x86-only)
  30. # + Parabola additions, since
  31. # "grub: add QEMU, XEN and Multiboot support"
  32. # (2015-09-27, Márcio Alexandre Silva Delgado <coadde@parabola.nu>)
  33. # * --with-platform=xen (if _XEN=1, x86-only; if
  34. # _IA32_XEN_IN_ARCH_X86=1 then the x86_64
  35. # package contains both 32bit and 64bit
  36. # builds)
  37. # * --with-platform=qemu (a separate -kernel file for Qemu, x86-only)
  38. # * --with-platform=multiboot (x86-only)
  39. ## "1" to enable Xen support, "0" to disable
  40. _XEN="0"
  41. ## "1" to enable IA32-EFI build in Arch x86_64, "0" to disable
  42. _IA32_EFI_IN_ARCH_X64="1"
  43. ## "1" to enable IA32-XEN build in Arch x86_64, "0" to disable
  44. _IA32_XEN_IN_ARCH_X64="1"
  45. ## "1" to enable EMU build, "0" to disable
  46. _GRUB_EMU_BUILD="1"
  47. [[ "${CARCH}" == 'armv7h' ]] && _EFI_ARCH='arm'
  48. [[ "${CARCH}" == 'x86_64' ]] && _EFI_ARCH='x86_64'
  49. [[ "${CARCH}" == 'i686' ]] && _EFI_ARCH='i386'
  50. [[ "${CARCH}" == 'x86_64' ]] && _XEN_ARCH='x86_64'
  51. [[ "${CARCH}" == 'i686' ]] && _XEN_ARCH='i386'
  52. [[ "${CARCH}" == 'armv7h' ]] && _EMU_ARCH='arm'
  53. [[ "${CARCH}" == 'x86_64' ]] && _EMU_ARCH='x86_64'
  54. [[ "${CARCH}" == 'i686' ]] && _EMU_ARCH='i386'
  55. pkgbase='grub'
  56. pkgname=('grub')
  57. if [[ $CARCH == armv7h ]]; then
  58. pkgname+=(
  59. 'grub-am335x_bone'
  60. 'grub-udoo'
  61. 'grub-omap3_beagle'
  62. 'grub-omap3_beagle_xm'
  63. 'grub-omap3_beagle_xm_ab'
  64. )
  65. fi
  66. pkgdesc='GNU GRand Unified Bootloader (2)'
  67. pkgdesc+=', (Parabola rebranded)'
  68. epoch=2
  69. _pkgver=2.12
  70. _unifont_ver='15.1.04'
  71. pkgver=${_pkgver/-/}
  72. pkgrel=2
  73. pkgrel+=.parabola1
  74. url='https://www.gnu.org/software/grub/'
  75. arch=('x86_64')
  76. arch+=('i686')
  77. arch+=('armv7h')
  78. license=('GPL-3.0-or-later')
  79. backup=('etc/default/grub'
  80. 'etc/grub.d/40_custom')
  81. install="${pkgname}.install"
  82. options=('!makeflags')
  83. conflicts=('grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}" 'grub-legacy')
  84. conflicts+=('grub-parabola')
  85. replaces=('grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}")
  86. replaces+=('grub-parabola')
  87. provides=('grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}")
  88. if [[ "${CARCH}" = 'armv7h' ]]; then
  89. conflicts=('grub-common' 'grub-emu' "grub-efi-${_EFI_ARCH}")
  90. replaces=('grub-common' 'grub-emu' "grub-efi-${_EFI_ARCH}")
  91. provides=('grub-common' 'grub-emu' "grub-efi-${_EFI_ARCH}")
  92. fi
  93. makedepends=('git' 'rsync' 'xz' 'freetype2' 'ttf-dejavu' 'python' 'autogen'
  94. 'texinfo' 'help2man' 'gettext' 'device-mapper' 'fuse3')
  95. depends=('sh' 'xz' 'gettext' 'device-mapper')
  96. optdepends=('freetype2: For grub-mkfont usage'
  97. 'fuse3: For grub-mount usage'
  98. #'dosfstools: For grub-mkrescue FAT FS and EFI support' # drop 'and EFI' from the device-specific arm-uboot packages
  99. 'lzop: For grub-mkrescue LZO support'
  100. #'efibootmgr: For grub-install EFI support' # drop from the device-specific arm-uboot packages
  101. #'libisoburn: Provides xorriso for generating grub rescue iso using grub-mkrescue' # drop from the device-specific arm-uboot packages
  102. 'os-prober: To detect other OSes when generating grub.cfg in BIOS systems'
  103. 'mtools: For grub-mkrescue FAT FS support')
  104. if [[ "${CARCH}" = 'x86_64' ]] && [[ "${_XEN}" = '1' ]]; then
  105. makedepends+=('xen')
  106. fi
  107. if [[ "${_GRUB_EMU_BUILD}" == "1" ]]; then
  108. makedepends+=('sdl')
  109. #optdepends+=('sdl: For grub-emu SDL support') # drop from the device-specific arm-uboot packages
  110. fi
  111. validpgpkeys=('E53D497F3FA42AD8C9B4D1E835A93B74E82E4209' # Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
  112. 'BE5C23209ACDDACEB20DB0A28C8189F1988C2166' # Daniel Kiper <dkiper@net-space.pl>
  113. '95D2E9AB8740D8046387FD151A09227B1F435A33') # Paul Hardy <unifoundry@unifoundry.com>
  114. # For grub-linguas-*.tar
  115. _linguas_ver=20231125 # Get this date from the output of `rsync translationproject.org::tp/latest/grub`
  116. validpgpkeys+=('99195DD3BB6FE10A2F36ED8445698744D4FFBFC9') # Luke Shumaker
  117. source=("git+https://git.savannah.gnu.org/git/grub.git#tag=grub-${_pkgver}?signed"
  118. 'git+https://git.savannah.gnu.org/git/gnulib.git'
  119. "https://ftp.gnu.org/gnu/unifont/unifont-${_unifont_ver}/unifont-${_unifont_ver}.bdf.gz"{,.sig}
  120. "https://repo.parabola.nu/other/grub/grub-linguas-${_linguas_ver}.tar.xz"{,.sig}
  121. '0001-00_header-add-GRUB_COLOR_-variables.patch'
  122. '0002-10_linux-20_linux_xen-detect-parabola-initramfs.patch'
  123. '0003-support-dropins-for-default-configuration.patch'
  124. '0004-10_linux-20_linux_xen-rebrand-free-distros.patch'
  125. 'grub.default'
  126. 'sbat.csv')
  127. source_armv7h=(
  128. '1000-am335x_bone--10_linux-20_linux_xen-detect-devicetree-file.patch'
  129. '1000-omap3_beagle--10_linux-20_linux_xen-detect-devicetree-file.patch'
  130. '1000-omap3_beagle_xm--10_linux-20_linux_xen-detect-devicetree-file.patch'
  131. '1000-omap3_beagle_xm_ab--10_linux-20_linux_xen-detect-devicetree-file.patch'
  132. '1000-udoo--10_linux-20_linux_xen-detect-devicetree-file.patch')
  133. sha256sums=('SKIP'
  134. 'SKIP'
  135. '88e00954b10528407e62e97ce6eaa88c847ebfd9a464cafde6bf55c7e4eeed54'
  136. 'SKIP'
  137. '0d6cde9ef6e24a5c4f22cc731f64345e2e4cdc363dc00cef20e162a7946faaaa'
  138. 'SKIP'
  139. 'c25a09792ad97ca93ff385f1821b8c071b28d0ee86c1c4af9365cc00dc5b2b12'
  140. '1dd3df0838f9aa737beb0298b855bc93b07d8f3926460ccb8b8f30f5fece3abf'
  141. 'a096658d0f48a8b8d0d526d679c2106d0a5bf2a5afb6f2ca7e37f1f2ac33fd85'
  142. '281a5225d68be7c230ff2d8175d920bf507439f3fc42cbe866fc31530a1465d3'
  143. 'c7c38d62c1238671a09094ceb71befc3fe3873f18343ef0a6f3089d9576dbd43'
  144. '50cab883c2412bb583c0521ed34e75aa080ccfc50826ab9d02a4db250ae5c05e')
  145. sha256sums_armv7h=('0f2e9abaf872e1e18dfe0cd1da42bdc4f49d3956f97a01c39b82c0e3016c1a32'
  146. 'c0d84384db273d9fd6ea2aab2a9d8ba36402daf8daf591dcba329cfa02253c87'
  147. 'ef105dcc067c673e543d4d5384aa7bf6b93e9eca96fec4323ab69a91ec079f56'
  148. 'f5fb1673536d56a88b3d1aaec75501e4d0acca081ac658d1059ec276f9e062c6'
  149. 'd8911a513166d2db337b9449542e0ad0e91b114f92dc4b876d88d77d23829a1d')
  150. _backports=(
  151. )
  152. _reverts=(
  153. )
  154. _configure_options=(
  155. PACKAGE_VERSION="${epoch}:${pkgver}-${pkgrel}"
  156. FREETYPE="pkg-config freetype2"
  157. BUILD_FREETYPE="pkg-config freetype2"
  158. --enable-nls
  159. --enable-device-mapper
  160. --enable-cache-stats
  161. --enable-grub-mkfont
  162. --enable-grub-mount
  163. --prefix="/usr"
  164. --bindir="/usr/bin"
  165. --sbindir="/usr/bin"
  166. --mandir="/usr/share/man"
  167. --infodir="/usr/share/info"
  168. --datarootdir="/usr/share"
  169. --sysconfdir="/etc"
  170. --program-prefix=""
  171. --with-bootdir="/boot"
  172. --with-grubdir="grub"
  173. --disable-silent-rules
  174. --disable-werror
  175. )
  176. mksource=("${source[0]}")
  177. mksha256sums=('SKIP')
  178. mksource() {
  179. cd "$srcdir/grub"
  180. ./linguas.sh # rsync from translationproject.org::tp/latest/grub
  181. git ls-files -z | xargs -0 git rm -f --
  182. rm -rf .git
  183. export SOURCE_DATE_EPOCH="$(stat --format='%Y' po/*.po|sort|tail -n1)"
  184. }
  185. prepare() {
  186. cd "${srcdir}/grub/"
  187. echo "Apply backports..."
  188. local _c
  189. for _c in "${_backports[@]}"; do
  190. git log --oneline -1 "${_c}"
  191. git cherry-pick -n "${_c}"
  192. done
  193. echo "Apply reverts..."
  194. local _c
  195. for _c in "${_reverts[@]}"; do
  196. git log --oneline -1 "${_c}"
  197. git revert -n "${_c}"
  198. done
  199. echo "Patch to enable GRUB_COLOR_* variables in grub-mkconfig..."
  200. ## Based on http://lists.gnu.org/archive/html/grub-devel/2012-02/msg00021.html
  201. patch -Np1 -i "${srcdir}/0001-00_header-add-GRUB_COLOR_-variables.patch"
  202. echo "Patch to detect of Parabola GNU/Linux-libre initramfs images by grub-mkconfig..."
  203. patch -Np1 -i "${srcdir}/0002-10_linux-20_linux_xen-detect-parabola-initramfs.patch"
  204. echo "Patch to support dropins for default configuration..."
  205. patch -Np1 -i "${srcdir}/0003-support-dropins-for-default-configuration.patch"
  206. echo "Fix DejaVuSans.ttf location so that grub-mkfont can create *.pf2 files for starfield theme..."
  207. sed 's|/usr/share/fonts/dejavu|/usr/share/fonts/dejavu /usr/share/fonts/TTF|g' -i "configure.ac"
  208. echo "Rebranding for some free distros..."
  209. patch -Np1 -i "${srcdir}/0004-10_linux-20_linux_xen-rebrand-free-distros.patch"
  210. echo "Fix mkinitcpio 'rw' FS#36275..."
  211. sed 's| ro | rw |g' -i "util/grub.d/10_linux.in"
  212. # linguas.sh rsync's from translationproject.org; this will
  213. # fail with libremakepkg because networking is turned off.
  214. # Instead, we do this in mksource().
  215. #echo "Pull in latest language files..."
  216. #./linguas.sh
  217. echo "Avoid problem with unifont during compile of grub..."
  218. # http://savannah.gnu.org/bugs/?40330 and https://bugs.archlinux.org/task/37847
  219. gzip -cd "${srcdir}/unifont-${_unifont_ver}.bdf.gz" > "unifont.bdf"
  220. echo "Run bootstrap..."
  221. ./bootstrap \
  222. --gnulib-srcdir="${srcdir}/gnulib/" \
  223. --no-git
  224. echo "Make translations reproducible..."
  225. sed -i '1i /^PO-Revision-Date:/ d' po/*.sed
  226. }
  227. # Usage: _build_grub DIRSUFFIX 'Human Description' CPU-PLATFORM CONFIG_OPTIONS...
  228. _build_grub() {
  229. local bld_name="$1"
  230. local bld_desc="$2"
  231. local bld_cpu="${3%-*}"
  232. local bld_plat="${3#*-}"
  233. local bld_configure_options=("${@:4}")
  234. echo "Build grub ${bld_desc} stuff..."
  235. echo "Copy the source for building the ${bld_desc} part..."
  236. cp -r "${srcdir}/grub/" "${srcdir}/grub-${bld_name}/"
  237. cd "${srcdir}/grub-${bld_name}/"
  238. echo "Unset all compiler FLAGS for ${bld_desc} build..."
  239. unset CFLAGS
  240. unset CPPFLAGS
  241. unset CXXFLAGS
  242. unset LDFLAGS
  243. unset MAKEFLAGS
  244. echo "Run ./configure for ${bld_desc} build..."
  245. ./configure \
  246. --with-platform="${bld_plat}" \
  247. --target="${bld_cpu}" \
  248. "${bld_configure_options[@]}"
  249. echo "Make info pages reproducible..."
  250. touch -d "@${SOURCE_DATE_EPOCH}" $(find -name '*.texi')
  251. echo "Run make for ${bld_desc} build..."
  252. make
  253. }
  254. _build_grub-bios() {
  255. echo "Set ARCH dependent variables for bios build..."
  256. local _EFIEMU
  257. if [[ "${CARCH}" == 'x86_64' ]]; then
  258. _EFIEMU="--enable-efiemu"
  259. else
  260. _EFIEMU="--disable-efiemu"
  261. fi
  262. _build_grub 'bios' 'bios' \
  263. 'i386-pc' \
  264. "${_EFIEMU}" \
  265. --enable-boot-time \
  266. "${_configure_options[@]}"
  267. }
  268. _build_grub-efi() {
  269. _build_grub "efi-${_EFI_ARCH}" "${_EFI_ARCH} efi" \
  270. "${_EFI_ARCH}-efi" \
  271. --disable-efiemu \
  272. --enable-boot-time \
  273. "${_configure_options[@]}"
  274. }
  275. _build_grub-emu() {
  276. _build_grub 'emu' 'emu' \
  277. "${_EMU_ARCH}-emu" \
  278. --enable-grub-emu-usb=no \
  279. --enable-grub-emu-sdl=no \
  280. --disable-grub-emu-pci \
  281. "${_configure_options[@]}"
  282. }
  283. _build_grub-xen() {
  284. _build_grub "xen-${_XEN_ARCH}" "${_XEN_ARCH} XEN" \
  285. "${_XEN_ARCH}-xen" \
  286. --disable-efiemu \
  287. --enable-boot-time \
  288. "${_configure_options[@]}"
  289. }
  290. _build_grub-qemu() {
  291. _build_grub 'qemu' 'QEMU' \
  292. 'i386-qemu' \
  293. --disable-efiemu \
  294. --enable-boot-time \
  295. "${_configure_options[@]}"
  296. }
  297. _build_grub-ieee1275() {
  298. _build_grub 'ieee1275' 'IEEE1275 (OpenFirmware)' \
  299. 'i386-ieee1275' \
  300. --disable-efiemu \
  301. --enable-boot-time \
  302. "${_configure_options[@]}"
  303. }
  304. _build_grub-libreboot() {
  305. _build_grub 'libreboot' 'Libreboot' \
  306. 'i386-coreboot' \
  307. --disable-efiemu \
  308. --enable-boot-time \
  309. "${_configure_options[@]}"
  310. }
  311. _build_grub-multiboot() {
  312. _build_grub 'multiboot' 'Multiboot' \
  313. 'i386-multiboot' \
  314. --disable-efiemu \
  315. --enable-boot-time \
  316. "${_configure_options[@]}"
  317. }
  318. _build_grub-uboot() {
  319. _build_grub 'uboot' 'U-Boot' \
  320. 'arm-uboot' \
  321. --disable-efiemu \
  322. --enable-boot-time \
  323. "${_configure_options[@]}"
  324. }
  325. build() {
  326. cd "${srcdir}/grub/"
  327. # All-CPU platforms ####################################################
  328. _build_grub-efi
  329. if [[ "${CARCH}" == "x86_64" ]] && [[ "${_IA32_EFI_IN_ARCH_X64}" == "1" ]]; then
  330. _EFI_ARCH="i386" _build_grub-efi
  331. fi
  332. if [[ "${_GRUB_EMU_BUILD}" == "1" ]]; then
  333. _build_grub-emu
  334. fi
  335. # CPU-specific platforms ###############################################
  336. case "$CARCH" in
  337. x86_64|i686)
  338. _build_grub-bios
  339. _build_grub-qemu
  340. _build_grub-ieee1275
  341. _build_grub-libreboot
  342. _build_grub-multiboot
  343. if [[ "${_XEN}" = '1' ]]; then
  344. _build_grub-xen
  345. if [[ "${CARCH}" = 'x86_64' ]] && [[ "${_IA32_XEN_IN_ARCH_X64}" = '1' ]]; then
  346. _XEN_ARCH='i386' _build_grub-xen
  347. fi
  348. fi
  349. ;;
  350. armv7h)
  351. _build_grub-uboot
  352. ;;
  353. esac
  354. }
  355. # Usage: _package_grub DIRSUFFIX 'Human Description' CPU-PLATFORM
  356. _package_grub() {
  357. local bld_name="$1"
  358. local bld_desc="$2"
  359. local bld_cpuplat="$3"
  360. echo "Package grub ${bld_desc} stuff..."
  361. cd "${srcdir}/grub-${bld_name}/"
  362. echo "Run make install for ${bld_desc} build..."
  363. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  364. echo "Remove gdb debugging related files for ${bld_desc} build..."
  365. rm -f "${pkgdir}/usr/lib/grub/${bld_cpuplat}"/*.module || true
  366. rm -f "${pkgdir}/usr/lib/grub/${bld_cpuplat}"/*.image || true
  367. rm -f "${pkgdir}/usr/lib/grub/${bld_cpuplat}"/{kernel.exec,gdb_grub,gmodule.pl} || true
  368. }
  369. _package_grub-bios() {
  370. _package_grub 'bios' 'bios' \
  371. 'i386-pc'
  372. }
  373. _package_grub-efi() {
  374. _package_grub "efi-${_EFI_ARCH}" "${_EFI_ARCH} efi" \
  375. "${_EFI_ARCH}-efi"
  376. sed -e "s/%PKGVER%/${epoch}:${pkgver}-${pkgrel}/" -e "s/%CARCH%/${CARCH}/" < "${srcdir}/sbat.csv" > "${pkgdir}/usr/share/grub/sbat.csv"
  377. }
  378. _package_grub-emu() {
  379. _package_grub 'emu' 'emu' \
  380. "${_EMU_ARCH}-emu"
  381. }
  382. _package_grub-xen() {
  383. _package_grub "xen-${_XEN_ARCH}" "${_XEN_ARCH} XEN" \
  384. "${_XEN_ARCH}-xen"
  385. }
  386. _package_grub-qemu() {
  387. _package_grub 'qemu' 'QEMU' \
  388. 'i386-qemu'
  389. }
  390. _package_grub-ieee1275() {
  391. _package_grub 'ieee1275' 'IEEE1275 (OpenFirmware)' \
  392. 'i386-ieee1275'
  393. }
  394. _package_grub-libreboot() {
  395. _package_grub 'libreboot' 'Libreboot' \
  396. 'i386-coreboot'
  397. }
  398. _package_grub-multiboot() {
  399. _package_grub 'multiboot' 'Multiboot' \
  400. 'i386-multiboot'
  401. }
  402. _package_grub-uboot() {
  403. _package_grub 'uboot' 'U-Boot' \
  404. 'arm-uboot'
  405. }
  406. package_grub() {
  407. optdepends+=('dosfstools: For grub-mkrescue FAT FS and EFI support'
  408. 'efibootmgr: For grub-install EFI support'
  409. 'libisoburn: Provides xorriso for generating grub rescue iso using grub-mkrescue')
  410. if [[ "${_GRUB_EMU_BUILD}" = '1' ]]; then
  411. optdepends+=('sdl: For grub-emu SDL support')
  412. fi
  413. cd "${srcdir}/grub/"
  414. # All-CPU platforms ####################################################
  415. _package_grub-efi
  416. if [[ "${CARCH}" == "x86_64" ]] && [[ "${_IA32_EFI_IN_ARCH_X64}" == "1" ]]; then
  417. _EFI_ARCH="i386" _package_grub-efi
  418. fi
  419. if [[ "${_GRUB_EMU_BUILD}" == "1" ]]; then
  420. _package_grub-emu
  421. fi
  422. # CPU-specific platforms ###############################################
  423. case "$CARCH" in
  424. x86_64|i686)
  425. _package_grub-bios
  426. _package_grub-qemu
  427. _package_grub-ieee1275
  428. _package_grub-libreboot
  429. _package_grub-multiboot
  430. if [[ "${_XEN}" = '1' ]]; then
  431. _package_grub-xen
  432. if [[ "${CARCH}" = 'x86_64' ]] && [[ "${_IA32_XEN_IN_ARCH_X64}" = '1' ]]; then
  433. _XEN_ARCH='i386' _package_grub-xen
  434. fi
  435. fi
  436. ;;
  437. armv7h)
  438. _package_grub-uboot
  439. ;;
  440. esac
  441. # Common ###############################################################
  442. echo "Install /etc/default/grub (used by grub-mkconfig)..."
  443. install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
  444. }
  445. _package_grub-uboot-dev() {
  446. local devname=$1
  447. local devdesc=$2
  448. pkgdesc="GNU GRand Unified Bootloader (2) for $devdesc ($devname), (Parabola rebranded)"
  449. optdepends+=('dosfstools: For grub-mkrescue FAT FS')
  450. echo "Copy the source for packaging the U-Boot ($devname) part..."
  451. cp -a "${srcdir}/grub-uboot/" "${srcdir}/grub-uboot_$devname/"
  452. cd "${srcdir}/grub-uboot_$devname/"
  453. echo "Patch to detect $devname device tree blob file (dtb)..."
  454. patch -Np1 -i "${srcdir}/1000-${pkgname#grub-}--10_linux-20_linux_xen-detect-devicetree-file.patch"
  455. _package_grub "uboot_$devname" "$devdesc" 'arm-uboot'
  456. echo 'Install /etc/default/grub (used by grub-mkconfig)...'
  457. install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
  458. }
  459. package_grub-am335x_bone() {
  460. _package_grub-uboot-dev 'am335x-bone' 'BeagleBone and BeagleBone Black'
  461. }
  462. package_grub-omap3_beagle() {
  463. provides+=('grub-beagleboard')
  464. _package_grub-uboot-dev "${pkgname#grub-}" 'BeagleBoard'
  465. }
  466. package_grub-omap3_beagle_xm() {
  467. provides+=('grub-beagleboard')
  468. _package_grub-uboot-dev "${pkgname#grub-}" 'BeagleBoard-xM'
  469. }
  470. package_grub-omap3_beagle_xm_ab() {
  471. provides+=('grub-beagleboard')
  472. _package_grub-uboot-dev "${pkgname#grub-}" 'BeagleBoard-xM rev A/B'
  473. }
  474. package_grub-udoo() {
  475. _package_grub-uboot-dev "${pkgname#grub-}" 'UDOO'
  476. }