From 920bd67f88a034e167158ffeb67e8722967f79af Mon Sep 17 00:00:00 2001 From: "coadde [Márcio Alexandre Silva Delgado]" Date: Mon, 29 Feb 2016 15:30:37 -0300 Subject: grub: fix pkgbuild for arm --- libre/grub/PKGBUILD | 173 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 113 insertions(+), 60 deletions(-) (limited to 'libre/grub') diff --git a/libre/grub/PKGBUILD b/libre/grub/PKGBUILD index f39ebd2bc..74e2d487b 100644 --- a/libre/grub/PKGBUILD +++ b/libre/grub/PKGBUILD @@ -36,7 +36,7 @@ pkgname=('grub') 'grub-omap3_beagle_xm' 'grub-omap3_beagle_xm_ab') pkgdesc='GNU GRand Unified Bootloader (2), (Parabola rebranded)' pkgver='2.02.beta3' -pkgrel='1.parabola1' +pkgrel='1.parabola2' epoch='1' url='https://www.gnu.org/software/grub/' arch=('x86_64' 'i686' 'armv7h') @@ -142,17 +142,15 @@ prepare() { 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" - # DISABLED TEMPORARY, due fail to build. - msg "Add the grub-extra sources for BIOS build" - install -d "${srcdir}/grub-${_pkgver}/grub-extras" - cp -r "${srcdir}/grub-extras/915resolution" "${srcdir}/grub-${_pkgver}/grub-extras/915resolution" # failed in compilation - export GRUB_CONTRIB="${srcdir}/grub-${_pkgver}/grub-extras/" + msg "Add the grub-extra sources for BIOS build" + install -d "${srcdir}/grub-${_pkgver}/grub-extras" + cp -r "${srcdir}/grub-extras/915resolution" "${srcdir}/grub-${_pkgver}/grub-extras/915resolution" + export GRUB_CONTRIB="${srcdir}/grub-${_pkgver}/grub-extras/" } _build_grub-efi() { msg "Copy the source for building the ${_EFI_ARCH} EFI part" cp -r "${srcdir}/grub-${_pkgver}" "${srcdir}/grub-${_pkgver}-efi-${_EFI_ARCH}" - cd "${srcdir}/grub-${_pkgver}-efi-${_EFI_ARCH}/" msg "Unset all compiler FLAGS for ${_EFI_ARCH} EFI build" unset CFLAGS @@ -161,7 +159,7 @@ _build_grub-efi() { unset LDFLAGS unset MAKEFLAGS - cd "${srcdir}/grub-${_pkgver}-efi-${_EFI_ARCH}/" + cd "${srcdir}/grub-${_pkgver}-efi-${_EFI_ARCH}" msg 'Run autogen.sh for ${_EFI_ARCH} EFI build' ./autogen.sh @@ -198,7 +196,6 @@ _build_grub-efi() { _build_grub-xen() { msg "Copy the source for building the ${_XEN_ARCH} XEN part" cp -r "${srcdir}/grub-${_pkgver}" "${srcdir}/grub-${_pkgver}-xen-${_XEN_ARCH}" - cd "${srcdir}/grub-${_pkgver}-xen-${_XEN_ARCH}/" msg "Unset all compiler FLAGS for ${_XEN_ARCH} XEN build" unset CFLAGS @@ -207,7 +204,7 @@ _build_grub-xen() { unset LDFLAGS unset MAKEFLAGS - cd "${srcdir}/grub-${_pkgver}-xen-${_XEN_ARCH}/" + cd "${srcdir}/grub-${_pkgver}-xen-${_XEN_ARCH}" msg "Run autogen.sh for ${_XEN_ARCH} XEN build" ./autogen.sh @@ -251,7 +248,6 @@ _build_grub-bios() { msg 'Copy the source for building the BIOS part' cp -r "${srcdir}/grub-${_pkgver}" "${srcdir}/grub-${_pkgver}-bios" - cd "${srcdir}/grub-${_pkgver}-bios/" msg 'Unset all compiler FLAGS for BIOS build' unset CFLAGS @@ -260,7 +256,7 @@ _build_grub-bios() { unset LDFLAGS unset MAKEFLAGS - cd "${srcdir}/grub-${_pkgver}-bios/" + cd "${srcdir}/grub-${_pkgver}-bios" msg 'Run autogen.sh for BIOS build' ./autogen.sh @@ -297,7 +293,6 @@ _build_grub-bios() { _build_grub-qemu() { msg 'Copy the source for building the QEMU part' cp -r "${srcdir}/grub-${_pkgver}" "${srcdir}/grub-${_pkgver}-qemu" - cd "${srcdir}/grub-${_pkgver}-qemu/" msg 'Unset all compiler FLAGS for QEMU build' unset CFLAGS @@ -306,7 +301,7 @@ _build_grub-qemu() { unset LDFLAGS unset MAKEFLAGS - cd "${srcdir}/grub-${_pkgver}-qemu/" + cd "${srcdir}/grub-${_pkgver}-qemu" msg 'Run autogen.sh for QEMU build' ./autogen.sh @@ -343,7 +338,6 @@ _build_grub-qemu() { _build_grub-ieee1275() { msg 'Copy the source for building the IEEE1275 (OpenFirmware) part' cp -r "${srcdir}/grub-${_pkgver}" "${srcdir}/grub-${_pkgver}-ieee1275" - cd "${srcdir}/grub-${_pkgver}-ieee1275/" msg 'Unset all compiler FLAGS for IEEE1275 (OpenFirmware) build' unset CFLAGS @@ -352,7 +346,7 @@ _build_grub-ieee1275() { unset LDFLAGS unset MAKEFLAGS - cd "${srcdir}/grub-${_pkgver}-ieee1275/" + cd "${srcdir}/grub-${_pkgver}-ieee1275" msg 'Run autogen.sh for IEEE1275 (OpenFirmware) build' ./autogen.sh @@ -389,7 +383,6 @@ _build_grub-ieee1275() { _build_grub-libreboot() { msg 'Copy the source for building the Libreboot part' cp -r "${srcdir}/grub-${_pkgver}" "${srcdir}/grub-${_pkgver}-libreboot" - cd "${srcdir}/grub-${_pkgver}-libreboot/" msg 'Unset all compiler FLAGS for Libreboot build' unset CFLAGS @@ -398,7 +391,7 @@ _build_grub-libreboot() { unset LDFLAGS unset MAKEFLAGS - cd "${srcdir}/grub-${_pkgver}-libreboot/" + cd "${srcdir}/grub-${_pkgver}-libreboot" msg 'Run autogen.sh for Libreboot build' ./autogen.sh @@ -435,7 +428,6 @@ _build_grub-libreboot() { _build_grub-multiboot() { msg 'Copy the source for building the Multiboot part' cp -r "${srcdir}/grub-${_pkgver}" "${srcdir}/grub-${_pkgver}-multiboot" - cd "${srcdir}/grub-${_pkgver}-multiboot/" msg 'Unset all compiler FLAGS for Multiboot build' unset CFLAGS @@ -444,7 +436,7 @@ _build_grub-multiboot() { unset LDFLAGS unset MAKEFLAGS - cd "${srcdir}/grub-${_pkgver}-multiboot/" + cd "${srcdir}/grub-${_pkgver}-multiboot" msg 'Run autogen.sh for Multiboot build' ./autogen.sh @@ -489,7 +481,7 @@ _build_grub-emu() { unset LDFLAGS unset MAKEFLAGS - cd "${srcdir}/grub-${_pkgver}-emu/" + cd "${srcdir}/grub-${_pkgver}-emu" msg 'Run autogen.sh for emu build' ./autogen.sh @@ -524,17 +516,58 @@ _build_grub-emu() { make } -_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/" +_build_grub-uboot() { + msg "Copy the source for building the U-Boot part" + cp -r "${srcdir}/grub-${_pkgver}" "${srcdir}/grub-${_pkgver}-uboot" - 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 'Unset all compiler FLAGS for U-Boot build' + unset CFLAGS + unset CPPFLAGS + unset CXXFLAGS + unset LDFLAGS + unset MAKEFLAGS + + cd "${srcdir}/grub-${_pkgver}-uboot_am335x-bone" #sed -i '\|grub_arm_disable_caches_mmu|,+4 d # ' grub-core/loader/arm/linux.c + msg 'Run autogen.sh for U-Boot build' + ./autogen.sh + + msg 'Run ./configure for U-Boot 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 build' + make +} + +_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" + msg 'Unset all compiler FLAGS for U-Boot (am335x-bone) build' unset CFLAGS unset CPPFLAGS @@ -542,7 +575,13 @@ _build_grub-uboot_am335x-bone() { unset LDFLAGS unset MAKEFLAGS - cd "${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" + + #sed -i '\|grub_arm_disable_caches_mmu|,+4 d + # ' grub-core/loader/arm/linux.c msg 'Run autogen.sh for U-Boot (am335x-bone) build' ./autogen.sh @@ -579,13 +618,6 @@ _build_grub-uboot_am335x-bone() { _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" - - #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 @@ -594,7 +626,13 @@ _build_grub-uboot_omap3_beagle() { unset LDFLAGS unset MAKEFLAGS - cd "${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" + + #sed -i '\|grub_arm_disable_caches_mmu|,+4 d + # ' grub-core/loader/arm/linux.c msg 'Run autogen.sh for U-Boot (omap3_beagle) build' ./autogen.sh @@ -631,13 +669,6 @@ _build_grub-uboot_omap3_beagle() { _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" - - #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 @@ -646,7 +677,13 @@ _build_grub-uboot_omap3_beagle_xm() { unset LDFLAGS unset MAKEFLAGS - cd "${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" + + #sed -i '\|grub_arm_disable_caches_mmu|,+4 d + # ' grub-core/loader/arm/linux.c msg 'Run autogen.sh for U-Boot (omap3_beagle_xm) build' ./autogen.sh @@ -683,13 +720,6 @@ _build_grub-uboot_omap3_beagle_xm() { _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" - - #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 @@ -698,7 +728,13 @@ _build_grub-uboot_omap3_beagle_xm_ab() { unset LDFLAGS unset MAKEFLAGS - cd "${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" + + #sed -i '\|grub_arm_disable_caches_mmu|,+4 d + # ' grub-core/loader/arm/linux.c msg 'Run autogen.sh for U-Boot (omap3_beagle_xm_ab) build' ./autogen.sh @@ -735,13 +771,6 @@ _build_grub-uboot_omap3_beagle_xm_ab() { _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" - - #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 @@ -750,7 +779,13 @@ _build_grub-uboot_udoo() { unset LDFLAGS unset MAKEFLAGS - cd "${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" + + #sed -i '\|grub_arm_disable_caches_mmu|,+4 d + # ' grub-core/loader/arm/linux.c msg 'Run autogen.sh for U-Boot (udoo) build' ./autogen.sh @@ -824,6 +859,9 @@ build() { msg "Build grub ${_XEN_ARCH} XEN stuff" _build_grub-xen elif [[ "${CARCH}" = 'armv7h' ]]; then + msg 'Build grub U-Boot stuff' + _build_grub-uboot + msg 'Build grub U-Boot for BeagleBone and BeagleBone Black (am335x-bone) stuff' _build_grub-uboot_am335x-bone @@ -942,6 +980,18 @@ _package_grub-emu() { rm -f "${pkgdir}/usr/lib/grub/${_EMU_ARCH}-emu"/{kernel.exec,gdb_grub,gmodule.pl} || true } +_package_grub-uboot() { + cd "${srcdir}/grub-${_pkgver}-uboot/" + + 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 +} + package_grub() { optdepends+=('dosfstools: For grub-mkrescue FAT FS and EFI support' 'efibootmgr: For grub-install EFI support' @@ -997,6 +1047,9 @@ package_grub() { msg 'Install extra /etc/grub.d/ files' install -D -m0755 "${srcdir}/60_memtest86+" "${pkgdir}/etc/grub.d/60_memtest86+" + elif [[ "${CARCH}" = 'armv7h' ]]; then + msg 'Package grub U-Boot stuff' + _package_grub-uboot fi if [[ "${_GRUB_EMU_BUILD}" = '1' ]]; then -- cgit v1.2.3