From bac5f331851616131367dc5e07836e29f6e947e1 Mon Sep 17 00:00:00 2001 From: "coadde [Márcio Alexandre Silva Delgado]" Date: Sat, 26 Sep 2015 14:47:11 -0300 Subject: grub: add armv7h support (U-Boot and UEFI) --- libre/grub/PKGBUILD | 113 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 101 insertions(+), 12 deletions(-) (limited to 'libre/grub/PKGBUILD') diff --git a/libre/grub/PKGBUILD b/libre/grub/PKGBUILD index eaedf77ad..06938c8ad 100644 --- a/libre/grub/PKGBUILD +++ b/libre/grub/PKGBUILD @@ -7,7 +7,7 @@ ## "1" to enable IA32-EFI build in Arch x86_64, "0" to disable _IA32_EFI_IN_ARCH_X64="1" -## "1" to enable EMU build, "0" to disable +## "1" to enable EMU build (x86_64 and i686 only), "0" to disable _GRUB_EMU_BUILD="0" _pkgver="2.02" @@ -15,6 +15,7 @@ _GRUB_GIT_TAG="grub-2.02-beta2" _UNIFONT_VER="6.3.20131217" +[[ "${CARCH}" == "armv7h" ]] && _EFI_ARCH="arm" [[ "${CARCH}" == "x86_64" ]] && _EFI_ARCH="x86_64" [[ "${CARCH}" == "i686" ]] && _EFI_ARCH="i386" @@ -24,10 +25,10 @@ _UNIFONT_VER="6.3.20131217" pkgname="grub" pkgdesc="GNU GRand Unified Bootloader (2), (Parabola rebranded)" pkgver=2.02.beta2 -pkgrel=5.parabola1 +pkgrel=5.parabola2 epoch="1" url="https://www.gnu.org/software/grub/" -arch=('x86_64' 'i686') +arch=('x86_64' 'i686' 'armv7h') license=('GPL3') backup=('etc/default/grub' 'etc/grub.d/40_custom') install="${pkgname}.install" @@ -37,6 +38,12 @@ conflicts=('grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}" 'grub-le replaces=('grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}" 'grub-parabola') provides=('grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}") +if [[ "${CARCH}" == "armv7h" ]]; then + conflicts=('uboot-'{beagleboard,boundary,chiliboard,cubox-i,cubox,kirkwood,odroid-c1,odroid-xu3,droid,olinuxino,oxnas,pandaboard,sunxi,trimslice,udoo,usbarmory,wandboard,zedboard}) + replaces=('uboot-'{beagleboard,boundary,chiliboard,cubox-i,cubox,kirkwood,odroid-c1,odroid-xu3,droid,olinuxino,oxnas,pandaboard,sunxi,trimslice,udoo,usbarmory,wandboard,zedboard}) + provides=('uboot-'{beagleboard,boundary,chiliboard,cubox-i,cubox,kirkwood,odroid-c1,odroid-xu3,droid,olinuxino,oxnas,pandaboard,sunxi,trimslice,udoo,usbarmory,wandboard,zedboard}) +fi + makedepends=('git' 'rsync' 'xz' 'freetype2' 'ttf-dejavu' 'python' 'autogen' 'texinfo' 'help2man' 'gettext' 'device-mapper' 'fuse') depends=('sh' 'xz' 'gettext' 'device-mapper') @@ -48,7 +55,7 @@ optdepends=('freetype2: For grub-mkfont usage' 'os-prober: To detect other OSes when generating grub.cfg in BIOS systems' 'mtools: For grub-mkrescue FAT FS support') -if [[ "${_GRUB_EMU_BUILD}" == "1" ]]; then +if [[ "${_GRUB_EMU_BUILD}" == "1" ]] && [[ "${CARCH}" != "armv7h" ]]; then makedepends+=('libusbx' 'sdl') optdepends+=('libusbx: For grub-emu USB support' 'sdl: For grub-emu SDL support') @@ -167,7 +174,61 @@ _build_grub-common_and_bios() { --infodir="/usr/share/info" \ --datarootdir="/usr/share" \ --sysconfdir="/etc" \ - --program-prefix="" \ + --program-prefix="" \ + --with-bootdir="/boot" \ + --with-grubdir="grub" \ + --disable-silent-rules \ + --disable-werror + echo + + msg "Run make for bios build" + make + echo +} + +_build_grub-common_and_uboot() { + + msg "Copy the source for building the U-Boot part" + cp -r "${srcdir}/grub-${_pkgver}" "${srcdir}/grub-${_pkgver}-uboot" + cd "${srcdir}/grub-${_pkgver}-uboot/" + + msg "Add the grub-extra sources for U-Boot build" + install -d "${srcdir}/grub-${_pkgver}-uboot/grub-extras" + export GRUB_CONTRIB="${srcdir}/grub-${_pkgver}-uboot/grub-extras/" + + msg "Unset all compiler FLAGS for bios build" + unset CFLAGS + unset CPPFLAGS + unset CXXFLAGS + unset LDFLAGS + unset MAKEFLAGS + + cd "${srcdir}/grub-${_pkgver}-uboot/" + + msg "Run autogen.sh for bios build" + ./autogen.sh + echo + + msg "Run ./configure for bios 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 \ @@ -285,8 +346,13 @@ build() { cd "${srcdir}/grub-${_pkgver}/" - msg "Build grub bios stuff" - _build_grub-common_and_bios + if [[ "${CARCH}" == "x86_64" ]] || [[ "${CARCH}" == "i686" ]]; then + msg "Build grub bios stuff" + _build_grub-common_and_bios + elif [[ "${CARCH}" == "armv7h" ]]; then + msg "Build grub U-Boot stuff" + _build_grub-common_and_uboot + fi echo msg "Build grub ${_EFI_ARCH} efi stuff" @@ -299,7 +365,7 @@ build() { echo fi - if [[ "${_GRUB_EMU_BUILD}" == "1" ]]; then + if [[ "${_GRUB_EMU_BUILD}" == "1" ]] && [[ "${CARCH}" != "armv7h" ]]; then msg "Build grub emu stuff" _build_grub-emu echo @@ -327,6 +393,25 @@ _package_grub-common_and_bios() { install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub" +} + +_package_grub-common_and_uboot() { + + cd "${srcdir}/grub-${_pkgver}-uboot/" + + msg "Run make install for U-Boot build" + make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install + echo + + msg "Remove gdb debugging related files for bios 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-efi() { @@ -372,13 +457,17 @@ package() { echo fi - if [[ "${_GRUB_EMU_BUILD}" == "1" ]]; then + if [[ "${_GRUB_EMU_BUILD}" == "1" ]] && [[ "${CARCH}" != "armv7h" ]]; then msg "Package grub emu stuff" _package_grub-emu echo fi - msg "Package grub bios stuff" - _package_grub-common_and_bios - + if [[ "${CARCH}" == "x86_64" ]] || [[ "${CARCH}" == "i686" ]]; then + msg "Package grub bios stuff" + _package_grub-common_and_bios + elif [[ "${CARCH}" == "armv7h" ]] + msg "Package grub U-Boot stuff" + _package_grub-common_and_uboot + fi } -- cgit v1.2.3