# Maintainer: André Silva # Maintainer: Márcio Silva _UNIFONT_VER='8.0.01' pkgbase='grub-git' pkgname+=('grub-am335x_bone-git' 'grub-udoo-git' 'grub-omap3_beagle-git' 'grub-omap3_beagle_xm-git' 'grub-omap3_beagle_xm_ab-git') pkgdesc='GNU GRand Unified Bootloader (2), (Parabola rebranded)' pkgver='r9296.92bbf25' pkgrel='1' url='https://www.gnu.org/software/grub/' arch=('armv7h') license=('GPL3') backup=('etc/default/grub' 'etc/grub.d/40_custom') install="grub.install" options=('!makeflags') depends=('sh' 'xz' 'gettext' 'device-mapper') makedepends=('git' 'rsync' 'xz' 'freetype2' 'ttf-dejavu' 'python' 'autogen' 'texinfo' 'help2man' 'gettext' 'device-mapper' 'fuse') optdepends=('freetype2: For grub-mkfont usage' 'fuse: For grub-mount usage' 'dosfstools: For grub-mkrescue FAT FS and EFI support' 'libisoburn: Provides xorriso for generating grub rescue iso using grub-mkrescue' 'os-prober: To detect other OSes when generating grub.cfg in BIOS systems' 'mtools: For grub-mkrescue FAT FS support') source=("grub-${pkgver}::git+git://git.sv.gnu.org/grub.git" "http://ftp.gnu.org/gnu/unifont/unifont-${_UNIFONT_VER}/unifont-${_UNIFONT_VER}.bdf.gz" "http://ftp.gnu.org/gnu/unifont/unifont-${_UNIFONT_VER}/unifont-${_UNIFONT_VER}.bdf.gz.sig" '0001-Fix-security-issue-when-reading-username-and-passwor.patch' 'grub-10_linux-20_linux_xen-detect-parabola-initramfs.patch' 'grub-add-GRUB_COLOR_variables.patch' '60_memtest86+' 'grub.default' 'grub-10_linux-20_linux_xen-detect-am335x_bone+am335x_boneblack-devicetree-file.patch' 'grub-10_linux-20_linux_xen-detect-omap3_beagle-devicetree-file.patch' 'grub-10_linux-20_linux_xen-detect-omap3_beagle_xm-devicetree-file.patch' 'grub-10_linux-20_linux_xen-detect-omap3_beagle_xm_ab-devicetree-file.patch' 'grub-10_linux-20_linux_xen-detect-udoo-devicetree-file.patch' 'grub-10_linux-20_linux_xen-rebrand-free-distros.patch') md5sums=('SKIP' '31cd5b872d38a3a3581ef1f7b2ef1216' 'SKIP' '9589ec46a04f9bb4d5da987340a4a324' '3a9bb9bafe0062388e11f72f0e80ba7e' 'e506ae4a9f9f7d1b765febfa84e10d48' 'be55eabc102f2c60b38ed35c203686d6' '8d1dd54ae4a1b550c097e056892ce953' 'a46695e19b588a53b8bac9e3b3c56096' '803f5b5f56ba6d74ca84aea67659116e' 'b2c20ce3aa7944636b3ea499b40f2160' '7e3245bdd30e291f44ab8a00b8a38f3e' '95b721dfe74f42df52b7ae94e0e7c067' 'e0133ad89ab3014210d4599f396a556e') validpgpkeys=('95D2E9AB8740D8046387FD151A09227B1F435A33') #Paul Hardy pkgver() { cd "${srcdir}/grub-${pkgver}" printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" } prepare() { cd "${srcdir}/grub-${pkgver}/" msg 'CVE-2015-8370' patch -Np1 -i "${srcdir}/0001-Fix-security-issue-when-reading-username-and-passwor.patch" msg 'Patch to detect of Parabola GNU/Linux-libre initramfs images by grub-mkconfig' patch -Np1 -i "${srcdir}/grub-10_linux-20_linux_xen-detect-parabola-initramfs.patch" msg 'Patch to enable GRUB_COLOR_* variables in grub-mkconfig' ## Based on http://lists.gnu.org/archive/html/grub-devel/2012-02/msg00021.html patch -Np1 -i "${srcdir}/grub-add-GRUB_COLOR_variables.patch" msg 'Fix DejaVuSans.ttf location so that grub-mkfont can create *.pf2 files for starfield theme' sed 's|/usr/share/fonts/dejavu|/usr/share/fonts/dejavu /usr/share/fonts/TTF|g' -i "${srcdir}/grub-${pkgver}/configure.ac" msg 'Rebranding for some free distros' patch -Np1 -i "${srcdir}/grub-10_linux-20_linux_xen-rebrand-free-distros.patch" msg "Fix mkinitcpio 'rw' FS#36275" sed 's| ro | rw |g' -i "${srcdir}/grub-${pkgver}/util/grub.d/10_linux.in" # msg 'autogen.sh requires python (2/3). since bzr is in makedepends, use python2 and no need to pull python3' # sed 's|python |python2 |g' -i "${srcdir}/grub-${pkgver}/autogen.sh" msg 'Pull in latest language files' ./linguas.sh msg 'Remove not working langs which need LC_ALL=C.UTF-8' sed -e 's#en@cyrillic en@greek##g' -i "${srcdir}/grub-${pkgver}/po/LINGUAS" msg 'Avoid problem with unifont during compile of grub, http://savannah.gnu.org/bugs/?40330 and https://bugs.archlinux.org/task/37847' cp "${srcdir}/unifont-${_UNIFONT_VER}.bdf" "${srcdir}/grub-${pkgver}/unifont.bdf" } _build_grub-uboot_am335x-bone() { msg "Copy the source for building the U-Boot (am335x-bone) part" cp -r "${srcdir}/grub-${pkgver}" "${srcdir}/grub-${pkgver}-uboot_am335x-bone" cd "${srcdir}/grub-${pkgver}-uboot_am335x-bone/" msg 'Patch to detect am335x-bone device tree blob file (dtb)' patch -Np1 -i "${srcdir}/grub-10_linux-20_linux_xen-detect-am335x_bone+am335x_boneblack-devicetree-file.patch" msg 'change memory adapted for am335x-bone support' sed -i '\|arm_uboot_ldflags| s|0x08000000|0x82000000| \|GRUB_KERNEL_ARM_UBOOT_LINK_ADDR| s|0x08000000|0x82000000| ' grub-core/Makefile.core.def \ include/grub/offsets.h #sed -i '\|LINUX_ADDRESS| s|start_of_ram [+] 0x8000|0x82000000| # \|LINUX_INITRD_ADDRESS| s|start_of_ram [+] 0x02000000|0x88080000| # \|LINUX_FDT_ADDRESS| s|LINUX_INITRD_ADDRESS [-] 0x10000|0x88000000| # ' include/grub/arm/linux.h sed -i '\|grub_arm_disable_caches_mmu|,+4 d ' grub-core/loader/arm/linux.c msg 'Unset all compiler FLAGS for U-Boot (am335x-bone) build' unset CFLAGS unset CPPFLAGS unset CXXFLAGS unset LDFLAGS unset MAKEFLAGS cd "${srcdir}/grub-${pkgver}-uboot_am335x-bone/" msg 'Run autogen.sh for U-Boot (am335x-bone) build' ./autogen.sh msg 'Run ./configure for U-Boot (am335x-bone) build' ./configure \ --with-platform='uboot' \ --target='arm' \ --disable-efiemu \ --enable-mm-debug \ --enable-nls \ --enable-device-mapper \ --enable-cache-stats \ --enable-boot-time \ --enable-grub-mkfont \ --enable-grub-mount \ --prefix='/usr' \ --bindir='/usr/bin' \ --sbindir='/usr/bin' \ --mandir='/usr/share/man' \ --infodir='/usr/share/info' \ --datarootdir='/usr/share' \ --sysconfdir='/etc' \ --program-prefix='' \ --with-bootdir='/boot' \ --with-grubdir='grub' \ --disable-silent-rules \ --disable-werror msg 'Run make for U-Boot (am335x-bone) build' make } _build_grub-uboot_omap3_beagle() { msg "Copy the source for building the U-Boot (omap3_beagle) part" cp -r "${srcdir}/grub-${pkgver}" "${srcdir}/grub-${pkgver}-uboot_omap3_beagle" cd "${srcdir}/grub-${pkgver}-uboot_omap3_beagle/" msg 'Patch to detect omap3_beagle device tree blob file (dtb)' patch -Np1 -i "${srcdir}/grub-10_linux-20_linux_xen-detect-omap3_beagle-devicetree-file.patch" msg 'change memory adapted for omap3_beagle support' sed -i '\|arm_uboot_ldflags| s|0x08000000|0x82000000| \|GRUB_KERNEL_ARM_UBOOT_LINK_ADDR| s|0x08000000|0x82000000| ' grub-core/Makefile.core.def \ include/grub/offsets.h #sed -i '\|LINUX_ADDRESS| s|start_of_ram [+] 0x8000|0x82000000| # \|LINUX_INITRD_ADDRESS| s|start_of_ram [+] 0x02000000|0x88080000| # \|LINUX_FDT_ADDRESS| s|LINUX_INITRD_ADDRESS [-] 0x10000|0x88000000| # ' include/grub/arm/linux.h sed -i '\|grub_arm_disable_caches_mmu|,+4 d ' grub-core/loader/arm/linux.c msg 'Unset all compiler FLAGS for U-Boot (omap3_beagle) build' unset CFLAGS unset CPPFLAGS unset CXXFLAGS unset LDFLAGS unset MAKEFLAGS cd "${srcdir}/grub-${pkgver}-uboot_omap3_beagle/" msg 'Run autogen.sh for U-Boot (omap3_beagle) build' ./autogen.sh msg 'Run ./configure for U-Boot (omap3_beagle) build' ./configure \ --with-platform='uboot' \ --target='arm' \ --disable-efiemu \ --enable-mm-debug \ --enable-nls \ --enable-device-mapper \ --enable-cache-stats \ --enable-boot-time \ --enable-grub-mkfont \ --enable-grub-mount \ --prefix='/usr' \ --bindir='/usr/bin' \ --sbindir='/usr/bin' \ --mandir='/usr/share/man' \ --infodir='/usr/share/info' \ --datarootdir='/usr/share' \ --sysconfdir='/etc' \ --program-prefix='' \ --with-bootdir='/boot' \ --with-grubdir='grub' \ --disable-silent-rules \ --disable-werror msg 'Run make for U-Boot (omap3_beagle) build' make } _build_grub-uboot_omap3_beagle_xm() { msg "Copy the source for building the U-Boot (omap3_beagle_xm) part" cp -r "${srcdir}/grub-${pkgver}" "${srcdir}/grub-${pkgver}-uboot_omap3_beagle_xm" cd "${srcdir}/grub-${pkgver}-uboot_omap3_beagle_xm/" msg 'Patch to detect omap3_beagle_xm device tree blob file (dtb)' patch -Np1 -i "${srcdir}/grub-10_linux-20_linux_xen-detect-omap3_beagle_xm-devicetree-file.patch" msg 'change memory adapted for omap3_beagle_xm support' sed -i '\|arm_uboot_ldflags| s|0x08000000|0x82000000| \|GRUB_KERNEL_ARM_UBOOT_LINK_ADDR| s|0x08000000|0x82000000| ' grub-core/Makefile.core.def \ include/grub/offsets.h #sed -i '\|LINUX_ADDRESS| s|start_of_ram [+] 0x8000|0x82000000| # \|LINUX_INITRD_ADDRESS| s|start_of_ram [+] 0x02000000|0x88080000| # \|LINUX_FDT_ADDRESS| s|LINUX_INITRD_ADDRESS [-] 0x10000|0x88000000| # ' include/grub/arm/linux.h sed -i '\|grub_arm_disable_caches_mmu|,+4 d ' grub-core/loader/arm/linux.c msg 'Unset all compiler FLAGS for U-Boot (omap3_beagle_xm) build' unset CFLAGS unset CPPFLAGS unset CXXFLAGS unset LDFLAGS unset MAKEFLAGS cd "${srcdir}/grub-${pkgver}-uboot_omap3_beagle_xm/" msg 'Run autogen.sh for U-Boot (omap3_beagle_xm) build' ./autogen.sh msg 'Run ./configure for U-Boot (omap3_beagle_xm) build' ./configure \ --with-platform='uboot' \ --target='arm' \ --disable-efiemu \ --enable-mm-debug \ --enable-nls \ --enable-device-mapper \ --enable-cache-stats \ --enable-boot-time \ --enable-grub-mkfont \ --enable-grub-mount \ --prefix='/usr' \ --bindir='/usr/bin' \ --sbindir='/usr/bin' \ --mandir='/usr/share/man' \ --infodir='/usr/share/info' \ --datarootdir='/usr/share' \ --sysconfdir='/etc' \ --program-prefix='' \ --with-bootdir='/boot' \ --with-grubdir='grub' \ --disable-silent-rules \ --disable-werror msg 'Run make for U-Boot (omap3_beagle_xm) build' make } _build_grub-uboot_omap3_beagle_xm_ab() { msg "Copy the source for building the U-Boot (omap3_beagle_xm_ab) part" cp -r "${srcdir}/grub-${pkgver}" "${srcdir}/grub-${pkgver}-uboot_omap3_beagle_xm_ab" cd "${srcdir}/grub-${pkgver}-uboot_omap3_beagle_xm_ab/" msg 'Patch to detect omap3_beagle_xm_ab device tree blob file (dtb)' patch -Np1 -i "${srcdir}/grub-10_linux-20_linux_xen-detect-omap3_beagle_xm_ab-devicetree-file.patch" msg 'change memory adapted for omap3_beagle_xm_ab support' sed -i '\|arm_uboot_ldflags| s|0x08000000|0x82000000| \|GRUB_KERNEL_ARM_UBOOT_LINK_ADDR| s|0x08000000|0x82000000| ' grub-core/Makefile.core.def \ include/grub/offsets.h #sed -i '\|LINUX_ADDRESS| s|start_of_ram [+] 0x8000|0x82000000| # \|LINUX_INITRD_ADDRESS| s|start_of_ram [+] 0x02000000|0x88080000| # \|LINUX_FDT_ADDRESS| s|LINUX_INITRD_ADDRESS [-] 0x10000|0x88000000| # ' include/grub/arm/linux.h sed -i '\|grub_arm_disable_caches_mmu|,+4 d ' grub-core/loader/arm/linux.c msg 'Unset all compiler FLAGS for U-Boot (omap3_beagle_xm_ab) build' unset CFLAGS unset CPPFLAGS unset CXXFLAGS unset LDFLAGS unset MAKEFLAGS cd "${srcdir}/grub-${pkgver}-uboot_omap3_beagle_xm_ab/" msg 'Run autogen.sh for U-Boot (omap3_beagle_xm_ab) build' ./autogen.sh msg 'Run ./configure for U-Boot (omap3_beagle_xm_ab) build' ./configure \ --with-platform='uboot' \ --target='arm' \ --disable-efiemu \ --enable-mm-debug \ --enable-nls \ --enable-device-mapper \ --enable-cache-stats \ --enable-boot-time \ --enable-grub-mkfont \ --enable-grub-mount \ --prefix='/usr' \ --bindir='/usr/bin' \ --sbindir='/usr/bin' \ --mandir='/usr/share/man' \ --infodir='/usr/share/info' \ --datarootdir='/usr/share' \ --sysconfdir='/etc' \ --program-prefix='' \ --with-bootdir='/boot' \ --with-grubdir='grub' \ --disable-silent-rules \ --disable-werror msg 'Run make for U-Boot (omap3_beagle_xm_ab) build' make } _build_grub-uboot_udoo() { msg "Copy the source for building the U-Boot (udoo) part" cp -r "${srcdir}/grub-${pkgver}" "${srcdir}/grub-${pkgver}-uboot_udoo" cd "${srcdir}/grub-${pkgver}-uboot_udoo/" msg 'Patch to detect udoo device tree blob file (dtb)' patch -Np1 -i "${srcdir}/grub-10_linux-20_linux_xen-detect-udoo-devicetree-file.patch" msg 'change memory adapted for udoo support' sed -i '\|arm_uboot_ldflags| s|0x08000000|0x12000000| \|GRUB_KERNEL_ARM_UBOOT_LINK_ADDR| s|0x08000000|0x12000000| ' grub-core/Makefile.core.def \ include/grub/offsets.h #sed -i '\|LINUX_ADDRESS| s|start_of_ram [+] 0x8000|0x12000000| # \|LINUX_INITRD_ADDRESS| s|start_of_ram [+] 0x02000000|0x12A00000| # \|LINUX_FDT_ADDRESS| s|LINUX_INITRD_ADDRESS [-] 0x10000|0x18000000| # ' include/grub/arm/linux.h sed -i '\|grub_arm_disable_caches_mmu|,+4 d ' grub-core/loader/arm/linux.c msg 'Unset all compiler FLAGS for U-Boot (udoo) build' unset CFLAGS unset CPPFLAGS unset CXXFLAGS unset LDFLAGS unset MAKEFLAGS cd "${srcdir}/grub-${pkgver}-uboot_udoo/" msg 'Run autogen.sh for U-Boot (udoo) build' ./autogen.sh msg 'Run ./configure for U-Boot (udoo) build' ./configure \ --with-platform='uboot' \ --target='arm' \ --disable-efiemu \ --enable-mm-debug \ --enable-nls \ --enable-device-mapper \ --enable-cache-stats \ --enable-boot-time \ --enable-grub-mkfont \ --enable-grub-mount \ --prefix='/usr' \ --bindir='/usr/bin' \ --sbindir='/usr/bin' \ --mandir='/usr/share/man' \ --infodir='/usr/share/info' \ --datarootdir='/usr/share' \ --sysconfdir='/etc' \ --program-prefix='' \ --with-bootdir='/boot' \ --with-grubdir='grub' \ --disable-silent-rules \ --disable-werror msg 'Run make for U-Boot (udoo) build' make } build() { cd "${srcdir}/grub-${pkgver}/" msg 'Build grub U-Boot for BeagleBone and BeagleBone Black (am335x-bone) stuff' _build_grub-uboot_am335x-bone msg 'Build grub U-Boot for BeagleBoard (omap3_beagle) stuff' _build_grub-uboot_omap3_beagle msg 'Build grub U-Boot for BeagleBoard-xM (omap3_beagle_xm) stuff' _build_grub-uboot_omap3_beagle_xm msg 'Build grub U-Boot for BeagleBoard-xM rev A/B (omap3_beagle_xm_ab) stuff' _build_grub-uboot_omap3_beagle_xm_ab msg 'Build grub U-Boot for UDOO (udoo) stuff' _build_grub-uboot_udoo } package_grub-am335x_bone-git() { pkgdesc='GNU GRand Unified Bootloader (2) for BeagleBone and BeagleBone Black (am335x-bone), (Parabola rebranded)' provides=('grub-am335x_bone') conflicts=('grub-am335x_bone') cd "${srcdir}/grub-${pkgver}-uboot_am335x-bone/" msg 'Package grub U-Boot stuff' msg 'Run make install for U-Boot build' make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install msg 'Remove gdb debugging related files for U-Boot build' rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.module || true rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.image || true rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/{kernel.exec,gdb_grub,gmodule.pl} || true msg 'Install /etc/default/grub (used by grub-mkconfig)' install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub" } package_grub-omap3_beagle-git() { pkgdesc='GNU GRand Unified Bootloader (2) for BeagleBoard (omap3_beagle), (Parabola rebranded)' provides=('grub-beagleboard' 'grub-omap3_beagle') conflicts=('grub-omap3_beagle') cd "${srcdir}/grub-${pkgver}-uboot_omap3_beagle/" msg 'Package grub U-Boot stuff' msg 'Run make install for U-Boot build' make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install msg 'Remove gdb debugging related files for U-Boot build' rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.module || true rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.image || true rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/{kernel.exec,gdb_grub,gmodule.pl} || true msg 'Install /etc/default/grub (used by grub-mkconfig)' install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub" } package_grub-omap3_beagle_xm-git() { pkgdesc='GNU GRand Unified Bootloader (2) for BeagleBoard-xM (omap3_beagle_xm), (Parabola rebranded)' provides=('grub-beagleboard' 'grub-omap3_beagle_xm') conflicts=('grub-omap3_beagle_xm') cd "${srcdir}/grub-${pkgver}-uboot_omap3_beagle_xm/" msg 'Package grub U-Boot stuff' msg 'Run make install for U-Boot build' make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install msg 'Remove gdb debugging related files for U-Boot build' rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.module || true rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.image || true rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/{kernel.exec,gdb_grub,gmodule.pl} || true msg 'Install /etc/default/grub (used by grub-mkconfig)' install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub" } package_grub-omap3_beagle_xm_ab-git() { pkgdesc='GNU GRand Unified Bootloader (2) for BeagleBoard-xM rev A/B (omap3_beagle_xm_ab), (Parabola rebranded)' provides=('grub-beagleboard' 'grub-omap3_beagle_xm_ab') conflicts=('grub-omap3_beagle_xm_ab') cd "${srcdir}/grub-${pkgver}-uboot_omap3_beagle_xm_ab/" msg 'Package grub U-Boot stuff' msg 'Run make install for U-Boot build' make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install msg 'Remove gdb debugging related files for U-Boot build' rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.module || true rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.image || true rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/{kernel.exec,gdb_grub,gmodule.pl} || true msg 'Install /etc/default/grub (used by grub-mkconfig)' install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub" } package_grub-udoo-git() { pkgdesc='GNU GRand Unified Bootloader (2) for UDOO (udoo), (Parabola rebranded)' provides=('grub-udoo') conflicts=('grub-udoo') cd "${srcdir}/grub-${pkgver}-uboot_udoo/" msg 'Package grub U-Boot stuff' msg 'Run make install for U-Boot build' make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install msg 'Remove gdb debugging related files for U-Boot build' rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.module || true rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.image || true rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/{kernel.exec,gdb_grub,gmodule.pl} || true msg 'Install /etc/default/grub (used by grub-mkconfig)' install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub" }