diff options
author | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2015-09-27 01:08:03 -0300 |
---|---|---|
committer | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2015-09-27 15:40:47 -0300 |
commit | 4204505a22ecdc7afbfd9ce7d0e3244e213c5eb1 (patch) | |
tree | 6f1bdfeba0346aed62ade5d72a7e3d66a222b28e /libre/grub/PKGBUILD | |
parent | 5803ed2eb98a7490cc5cc26bacecfcc3cc5855f7 (diff) |
grub: add QEMU, XEN and Multiboot support
Diffstat (limited to 'libre/grub/PKGBUILD')
-rw-r--r-- | libre/grub/PKGBUILD | 342 |
1 files changed, 286 insertions, 56 deletions
diff --git a/libre/grub/PKGBUILD b/libre/grub/PKGBUILD index a95b1d22a..4d686cd11 100644 --- a/libre/grub/PKGBUILD +++ b/libre/grub/PKGBUILD @@ -7,6 +7,9 @@ ## "1" to enable IA32-EFI build in Arch x86_64, "0" to disable _IA32_EFI_IN_ARCH_X64="1" +## "1" to enable IA32-XEN build in Arch x86_64, "0" to disable +_IA32_XEN_IN_ARCH_X64="1" + ## "1" to enable EMU build (x86_64 and i686 only), "0" to disable _GRUB_EMU_BUILD="0" @@ -19,6 +22,9 @@ _UNIFONT_VER="6.3.20131217" [[ "${CARCH}" == "x86_64" ]] && _EFI_ARCH="x86_64" [[ "${CARCH}" == "i686" ]] && _EFI_ARCH="i386" +[[ "${CARCH}" == "x86_64" ]] && _XEN_ARCH="x86_64" +[[ "${CARCH}" == "i686" ]] && _XEN_ARCH="i386" + [[ "${CARCH}" == "x86_64" ]] && _EMU_ARCH="x86_64" [[ "${CARCH}" == "i686" ]] && _EMU_ARCH="i386" @@ -55,6 +61,9 @@ optdepends=('freetype2: For grub-mkfont usage' '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') +if [[ "${CARCH}" == "i686" ]]; then + optdepends+=('linux-libre-xen: For XEN server host support') +fi if [[ "${_GRUB_EMU_BUILD}" == "1" ]] && [[ "${CARCH}" != "armv7h" ]]; then makedepends+=('libusbx' 'sdl') @@ -89,7 +98,6 @@ _pkgver() { } prepare() { - cd "${srcdir}/grub-${_pkgver}/" msg "Patch to detect of Parabola GNU/Linux-libre initramfs images by grub-mkconfig" @@ -123,28 +131,26 @@ 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" - } _build_grub-common_and_bios() { - - msg "Set ARCH dependent variables for bios build" + msg "Set ARCH dependent variables for BIOS build" if [[ "${CARCH}" == 'x86_64' ]]; then _EFIEMU="--enable-efiemu" else _EFIEMU="--disable-efiemu" fi - msg "Copy the source for building the bios part" + msg "Copy the source for building the BIOS part" cp -r "${srcdir}/grub-${_pkgver}" "${srcdir}/grub-${_pkgver}-bios" cd "${srcdir}/grub-${_pkgver}-bios/" - msg "Add the grub-extra sources for bios build" + msg "Add the grub-extra sources for BIOS build" install -d "${srcdir}/grub-${_pkgver}-bios/grub-extras" cp -r "${srcdir}/grub-extras/915resolution" "${srcdir}/grub-${_pkgver}-bios/grub-extras/915resolution" export GRUB_CONTRIB="${srcdir}/grub-${_pkgver}-bios/grub-extras/" - msg "Unset all compiler FLAGS for bios build" + msg "Unset all compiler FLAGS for BIOS build" unset CFLAGS unset CPPFLAGS unset CXXFLAGS @@ -153,11 +159,11 @@ _build_grub-common_and_bios() { cd "${srcdir}/grub-${_pkgver}-bios/" - msg "Run autogen.sh for bios build" + msg "Run autogen.sh for BIOS build" ./autogen.sh echo - msg "Run ./configure for bios build" + msg "Run ./configure for BIOS build" ./configure \ --with-platform="pc" \ --target="i386" \ @@ -183,13 +189,12 @@ _build_grub-common_and_bios() { --disable-werror echo - msg "Run make for bios build" + 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/" @@ -238,8 +243,61 @@ _build_grub-common_and_uboot() { echo } -_build_grub-ieee1275() { +_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 "Add the grub-extra sources for QEMU build" + install -d "${srcdir}/grub-${_pkgver}-qemu/grub-extras" + cp -r "${srcdir}/grub-extras/915resolution" "${srcdir}/grub-${_pkgver}-qemu/grub-extras/915resolution" + export GRUB_CONTRIB="${srcdir}/grub-${_pkgver}-qemu/grub-extras/" + + msg "Unset all compiler FLAGS for QEMU build" + unset CFLAGS + unset CPPFLAGS + unset CXXFLAGS + unset LDFLAGS + unset MAKEFLAGS + + cd "${srcdir}/grub-${_pkgver}-qemu/" + + msg "Run autogen.sh for QEMU build" + ./autogen.sh + echo + + msg "Run ./configure for QEMU build" + ./configure \ + --with-platform="qemu" \ + --target="i386" \ + --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 + echo + msg "Run make for QEMU build" + make + echo +} + +_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/" @@ -294,7 +352,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/" @@ -348,13 +405,66 @@ _build_grub-libreboot() { echo } -_build_grub-efi() { +_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 "Add the grub-extra sources for Multiboot build" + install -d "${srcdir}/grub-${_pkgver}-multiboot/grub-extras" + cp -r "${srcdir}/grub-extras/915resolution" "${srcdir}/grub-${_pkgver}-multiboot/grub-extras/915resolution" + export GRUB_CONTRIB="${srcdir}/grub-${_pkgver}-multiboot/grub-extras/" + + msg "Unset all compiler FLAGS for Multiboot build" + unset CFLAGS + unset CPPFLAGS + unset CXXFLAGS + unset LDFLAGS + unset MAKEFLAGS + + cd "${srcdir}/grub-${_pkgver}-multiboot/" + + msg "Run autogen.sh for Multiboot build" + ./autogen.sh + echo - msg "Copy the source for building the ${_EFI_ARCH} efi part" + msg "Run ./configure for Multiboot build" + ./configure \ + --with-platform="multiboot" \ + --target="i386" \ + --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 + echo + + msg "Run make for Multiboot build" + make + echo +} + +_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" + msg "Unset all compiler FLAGS for ${_EFI_ARCH} EFI build" unset CFLAGS unset CPPFLAGS unset CXXFLAGS @@ -363,11 +473,11 @@ _build_grub-efi() { cd "${srcdir}/grub-${_pkgver}-efi-${_EFI_ARCH}/" - msg "Run autogen.sh for ${_EFI_ARCH} efi build" + msg "Run autogen.sh for ${_EFI_ARCH} EFI build" ./autogen.sh echo - msg "Run ./configure for ${_EFI_ARCH} efi build" + msg "Run ./configure for ${_EFI_ARCH} EFI build" ./configure \ --with-platform="efi" \ --target="${_EFI_ARCH}" \ @@ -393,14 +503,61 @@ _build_grub-efi() { --disable-werror echo - msg "Run make for ${_EFI_ARCH} efi build" + msg "Run make for ${_EFI_ARCH} EFI build" make echo +} + +_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 + unset CPPFLAGS + unset CXXFLAGS + unset LDFLAGS + unset MAKEFLAGS + + cd "${srcdir}/grub-${_pkgver}-xen-${_XEN_ARCH}/" + + msg "Run autogen.sh for ${_XEN_ARCH} XEN build" + ./autogen.sh + echo + + msg "Run ./configure for ${_XEN_ARCH} XEN build" + ./configure \ + --with-platform="xen" \ + --target="${_XEN_ARCH}" \ + --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 + echo + + msg "Run make for ${_XEN_ARCH} XEN build" + make + echo } _build_grub-emu() { - msg "Copy the source for building the emu part" cp -r "${srcdir}/grub-${_pkgver}/" "${srcdir}/grub-${_pkgver}-emu/" @@ -447,34 +604,57 @@ _build_grub-emu() { msg "Run make for emu build" make echo - } build() { - cd "${srcdir}/grub-${_pkgver}/" if [[ "${CARCH}" == "x86_64" ]] || [[ "${CARCH}" == "i686" ]]; then - msg "Build grub bios stuff" + msg "Build grub BIOS stuff" _build_grub-common_and_bios + echo + + msg "Build grub QEMU stuff" + _build_grub-qemu + echo + msg "Build grub IEEE1275 (OpenFirmware) stuff" _build_grub-ieee1275 - msg "Build Libreboot stuff" + echo + + msg "Build grub Libreboot stuff" _build_grub-libreboot + echo + + msg "Build grub Multiboot stuff" + _build_grub-multiboot + echo + + msg "Build grub ${_XEN_ARCH} XEN stuff" + _build_grub-xen + echo + + if [[ "${CARCH}" == "x86_64" ]] && [[ "${_IA32_XEN_IN_ARCH_X64}" == "1" ]]; then + msg "Build grub i386 XEN stuff" + _XEN_ARCH="i386" _build_grub-xen + echo + fi elif [[ "${CARCH}" == "armv7h" ]]; then msg "Build grub U-Boot stuff" _build_grub-common_and_uboot + echo fi - echo - - msg "Build grub ${_EFI_ARCH} efi stuff" - _build_grub-efi - echo - if [[ "${CARCH}" == "x86_64" ]] && [[ "${_IA32_EFI_IN_ARCH_X64}" == "1" ]]; then - msg "Build grub i386 efi stuff" - _EFI_ARCH="i386" _build_grub-efi + if [[ "${CARCH}" == "x86_64" ]] || [[ "${CARCH}" == "i686" ]] || [[ "${CARCH}" == "armv7h" ]]; then + msg "Build grub ${_EFI_ARCH} EFI stuff" + _build_grub-efi echo + + if [[ "${CARCH}" == "x86_64" ]] && [[ "${_IA32_EFI_IN_ARCH_X64}" == "1" ]]; then + msg "Build grub i386 EFI stuff" + _EFI_ARCH="i386" _build_grub-efi + echo + fi fi if [[ "${_GRUB_EMU_BUILD}" == "1" ]] && [[ "${CARCH}" != "armv7h" ]]; then @@ -482,18 +662,16 @@ build() { _build_grub-emu echo fi - } _package_grub-common_and_bios() { - cd "${srcdir}/grub-${_pkgver}-bios/" - msg "Run make install for bios build" + msg "Run make install for BIOS build" make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install echo - msg "Remove gdb debugging related files for bios build" + msg "Remove gdb debugging related files for BIOS build" rm -f "${pkgdir}/usr/lib/grub/i386-pc"/*.module || true rm -f "${pkgdir}/usr/lib/grub/i386-pc"/*.image || true rm -f "${pkgdir}/usr/lib/grub/i386-pc"/{kernel.exec,gdb_grub,gmodule.pl} || true @@ -503,12 +681,9 @@ _package_grub-common_and_bios() { msg "Install /etc/default/grub (used by grub-mkconfig)" 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" @@ -522,12 +697,22 @@ _package_grub-common_and_uboot() { msg "Install /etc/default/grub (used by grub-mkconfig)" install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub" +} + +_package_grub-qemu() { + cd "${srcdir}/grub-${_pkgver}-qemu/" + msg "Run make install for QEMU build" + make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install + echo + msg "Remove gdb debugging related files for QEMU build" + rm -f "${pkgdir}/usr/lib/grub/i386-qemu"/*.module || true + rm -f "${pkgdir}/usr/lib/grub/i386-qemu"/*.image || true + rm -f "${pkgdir}/usr/lib/grub/i386-qemu"/{kernel.exec,gdb_grub,gmodule.pl} || true } _package_grub-ieee1275() { - cd "${srcdir}/grub-${_pkgver}-ieee1275/" msg "Run make install for IEEE1275 (OpenFirmware) build" @@ -538,11 +723,9 @@ _package_grub-ieee1275() { rm -f "${pkgdir}/usr/lib/grub/i386-ieee1275"/*.module || true rm -f "${pkgdir}/usr/lib/grub/i386-ieee1275"/*.image || true rm -f "${pkgdir}/usr/lib/grub/i386-ieee1275"/{kernel.exec,gdb_grub,gmodule.pl} || true - } _package_grub-libreboot() { - cd "${srcdir}/grub-${_pkgver}-libreboot/" msg "Run make install for Libreboot build" @@ -553,26 +736,48 @@ _package_grub-libreboot() { rm -f "${pkgdir}/usr/lib/grub/i386-coreboot"/*.module || true rm -f "${pkgdir}/usr/lib/grub/i386-coreboot"/*.image || true rm -f "${pkgdir}/usr/lib/grub/i386-coreboot"/{kernel.exec,gdb_grub,gmodule.pl} || true +} + +_package_grub-multiboot() { + cd "${srcdir}/grub-${_pkgver}-multiboot/" + msg "Run make install for Multiboot build" + make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install + echo + + msg "Remove gdb debugging related files for Multiboot build" + rm -f "${pkgdir}/usr/lib/grub/i386-multiboot"/*.module || true + rm -f "${pkgdir}/usr/lib/grub/i386-multiboot"/*.image || true + rm -f "${pkgdir}/usr/lib/grub/i386-multiboot"/{kernel.exec,gdb_grub,gmodule.pl} || true } _package_grub-efi() { - cd "${srcdir}/grub-${_pkgver}-efi-${_EFI_ARCH}/" - msg "Run make install for ${_EFI_ARCH} efi build" + msg "Run make install for ${_EFI_ARCH} EFI build" make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install echo - msg "Remove gdb debugging related files for ${_EFI_ARCH} efi build" + msg "Remove gdb debugging related files for ${_EFI_ARCH} EFI build" rm -f "${pkgdir}/usr/lib/grub/${_EFI_ARCH}-efi"/*.module || true rm -f "${pkgdir}/usr/lib/grub/${_EFI_ARCH}-efi"/*.image || true rm -f "${pkgdir}/usr/lib/grub/${_EFI_ARCH}-efi"/{kernel.exec,gdb_grub,gmodule.pl} || true +} + +_package_grub-xen() { + cd "${srcdir}/grub-${_pkgver}-xen-${_XEN_ARCH}/" + msg "Run make install for ${_XEN_ARCH} XEN build" + make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install + echo + + msg "Remove gdb debugging related files for ${_XEN_ARCH} XEN build" + rm -f "${pkgdir}/usr/lib/grub/${_XEN_ARCH}-xen"/*.module || true + rm -f "${pkgdir}/usr/lib/grub/${_XEN_ARCH}-xen"/*.image || true + rm -f "${pkgdir}/usr/lib/grub/${_XEN_ARCH}-xen"/{kernel.exec,gdb_grub,gmodule.pl} || true } _package_grub-emu() { - cd "${srcdir}/grub-${_pkgver}-emu/" msg "Run make install for emu build" @@ -583,20 +788,21 @@ _package_grub-emu() { rm -f "${pkgdir}/usr/lib/grub/${_EMU_ARCH}-emu"/*.module || true rm -f "${pkgdir}/usr/lib/grub/${_EMU_ARCH}-emu"/*.image || true rm -f "${pkgdir}/usr/lib/grub/${_EMU_ARCH}-emu"/{kernel.exec,gdb_grub,gmodule.pl} || true - } package() { - cd "${srcdir}/grub-${_pkgver}/" - - msg "Package grub ${_EFI_ARCH} efi stuff" - _package_grub-efi - - if [[ "${CARCH}" == "x86_64" ]] && [[ "${_IA32_EFI_IN_ARCH_X64}" == "1" ]]; then - msg "Package grub i386 efi stuff" - _EFI_ARCH="i386" _package_grub-efi + + if [[ "${CARCH}" == "x86_64" ]] || [[ "${CARCH}" == "i686" ]] || [[ "${CARCH}" == "armv7h" ]]; then + msg "Package grub ${_EFI_ARCH} EFI stuff" + _package_grub-efi echo + + if [[ "${CARCH}" == "x86_64" ]] && [[ "${_IA32_EFI_IN_ARCH_X64}" == "1" ]]; then + msg "Package grub i386 EFI stuff" + _EFI_ARCH="i386" _package_grub-efi + echo + fi fi if [[ "${_GRUB_EMU_BUILD}" == "1" ]] && [[ "${CARCH}" != "armv7h" ]]; then @@ -606,14 +812,38 @@ package() { fi if [[ "${CARCH}" == "x86_64" ]] || [[ "${CARCH}" == "i686" ]]; then - msg "Package grub bios stuff" + msg "Package grub ${_XEN_ARCH} XEN stuff" + _package_grub-xen + echo + + if [[ "${CARCH}" == "x86_64" ]] && [[ "${_IA32_XEN_IN_ARCH_X64}" == "1" ]]; then + msg "Package grub i386 XEN stuff" + _XEN_ARCH="i386" _package_grub-xen + echo + fi + + msg "Package grub BIOS stuff" _package_grub-common_and_bios + echo + + msg "Package grub QEMU stuff" + _package_grub-qemu + echo + msg "Package grub IEEE1275 (OpenFirmware) stuff" _package_grub-ieee1275 + echo + msg "Package grub Libreboot stuff" _package_grub-libreboot + echo + + msg "Package grub Multiboot stuff" + _package_grub-multiboot + echo elif [[ "${CARCH}" == "armv7h" ]]; then msg "Package grub U-Boot stuff" _package_grub-common_and_uboot + echo fi } |