diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2017-05-22 14:07:52 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2017-05-22 14:22:00 +0000 |
commit | 5b05d9838e2aeb8d29ba22e64fdc205445f9e3a0 (patch) | |
tree | 64d54828d7226a17160b7ccf610dcde06221cd8a /main/grub | |
parent | 5d1c3fc11703f547a43bc4d7b9f089d75efbec60 (diff) | |
download | aports-5b05d9838e2aeb8d29ba22e64fdc205445f9e3a0.tar.bz2 aports-5b05d9838e2aeb8d29ba22e64fdc205445f9e3a0.tar.xz |
main/grub: move from testing
neeed for ppc64le image
Diffstat (limited to 'main/grub')
-rw-r--r-- | main/grub/2.02_beta3-gcc6-ld-no-pie.patch | 57 | ||||
-rw-r--r-- | main/grub/2.02_beta3-mkconfig-alpine.patch | 30 | ||||
-rw-r--r-- | main/grub/APKBUILD | 231 | ||||
-rw-r--r-- | main/grub/fix-gcc-no-pie-specs.patch | 20 | ||||
-rw-r--r-- | main/grub/grub-xen-host_grub.cfg | 24 | ||||
-rw-r--r-- | main/grub/grub2-accept-empty-module.patch | 22 |
6 files changed, 384 insertions, 0 deletions
diff --git a/main/grub/2.02_beta3-gcc6-ld-no-pie.patch b/main/grub/2.02_beta3-gcc6-ld-no-pie.patch new file mode 100644 index 0000000000..0d81415447 --- /dev/null +++ b/main/grub/2.02_beta3-gcc6-ld-no-pie.patch @@ -0,0 +1,57 @@ +2016-05-21 Magnus Granberg <zorry@gentoo.org> + + #583042 sys-boot/grub-2.02_beta3-r1: building w/gcc-6[pie]: error: + x86_64-pc-linux-gnu/bin/ld: -r and -shared may not be used together + + * acinclude.m4: Add -no-pie check. + * configure.ac: Add -no-pie to TARGET_LDFLAGS if needed. + +--- a/acinclude.m4 2015-11-11 20:56:52.000000000 +0100 ++++ b/acinclude.m4 2016-05-17 00:08:22.000000000 +0200 +@@ -390,6 +390,24 @@ else + [fi] + ]) + ++dnl Check if the Linker supports `-no-pie'. ++AC_DEFUN([grub_CHECK_NO_PIE], ++[AC_MSG_CHECKING([whether linker accepts -no-pie]) ++AC_CACHE_VAL(grub_cv_cc_ld_nopie, ++[save_LDFLAGS="$LDFLAGS" ++LDFLAGS="$LDFLAGS -no-pie" ++AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], ++ [grub_cv_cc_ld_no_pie=yes], ++ [grub_cv_cc_ld_no_pie=no]) ++LDFLAGS="$save_LDFLAGS" ++]) ++AC_MSG_RESULT([$grub_cv_cc_ld_no_pie]) ++nopie_possible=no ++if test "x$grub_cv_cc_ld_no_pie" = xyes ; then ++ nopie_possible=yes ++fi ++]) ++ + dnl Check if the C compiler supports `-fPIC'. + AC_DEFUN([grub_CHECK_PIC],[ + [# Position independent executable. +--- a/configure.ac 2016-02-27 13:40:56.000000000 +0100 ++++ b/configure.ac 2016-05-17 00:57:29.471000000 +0200 +@@ -1184,13 +1184,18 @@ CFLAGS="$TARGET_CFLAGS" + + # Position independent executable. + grub_CHECK_PIE ++grub_CHECK_NO_PIE + [# Need that, because some distributions ship compilers that include +-# `-fPIE' in the default specs. ++# `-fPIE' and '-pie' in the default specs. + if [ x"$pie_possible" = xyes ]; then + TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE" ++fi ++if [ x"$nopie_possible" = xyes ] && [ x"$pie_possible" = xyes ]; then ++ TARGET_LDFLAGS="$TARGET_LDFLAGS -no-pie" + fi] + + CFLAGS="$TARGET_CFLAGS" ++LDFLAGS="$TARGET_LDFLAGS" + + # Position independent executable. + grub_CHECK_PIC diff --git a/main/grub/2.02_beta3-mkconfig-alpine.patch b/main/grub/2.02_beta3-mkconfig-alpine.patch new file mode 100644 index 0000000000..606540fff3 --- /dev/null +++ b/main/grub/2.02_beta3-mkconfig-alpine.patch @@ -0,0 +1,30 @@ +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -21,8 +21,11 @@ + exec_prefix="@exec_prefix@" + datarootdir="@datarootdir@" + ++. /etc/update-extlinux.conf + . "$pkgdatadir/grub-mkconfig_lib" + ++GRUB_CMDLINE_LINUX_DEFAULT="modules=${modules} ${default_kernel_opts} ${GRUB_CMDLINE_LINUX_DEFAULT}" ++ + export TEXTDOMAIN=@PACKAGE@ + export TEXTDOMAINDIR="@localedir@" + +@@ -75,6 +78,7 @@ + version="$2" + type="$3" + args="$4" ++ tag="$(basename ${rel_dirname}/${basename} | cut -b9-)" + + if [ -z "$boot_device_id" ]; then + boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" +@@ -133,6 +137,7 @@ + echo '$(echo "$message" | grub_quote)' + linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} + EOF ++ [ -f "/boot/initramfs-${tag}" ] && initrd="initramfs-${tag}" + if test -n "${initrd}" ; then + # TRANSLATORS: ramdisk isn't identifier. Should be translated. + message="$(gettext_printf "Loading initial ramdisk ...")" diff --git a/main/grub/APKBUILD b/main/grub/APKBUILD new file mode 100644 index 0000000000..4783fdaa02 --- /dev/null +++ b/main/grub/APKBUILD @@ -0,0 +1,231 @@ +# Contributor: Carlo Landmeter <clandmeter@gmail.com> +# Maintainer: +pkgname=grub +_ver=2.02~beta3 +pkgver=2.02_beta3 +pkgrel=6 +pkgdesc="Bootloader with support for Linux, Multiboot and more" +url="https://www.gnu.org/software/grub/" +arch="all !armhf" +license="GPLv3+" +depends="" +depends_dev="" +makedepends="$depends_dev bison flex linux-headers xz-dev lvm2-dev + automake autoconf libtool python2 freetype-dev unifont" +install="" +# strip handled by grub Makefiles, abuild strip breaks xen pv-grub +options="!strip" +subpackages="$pkgname-dev $pkgname-doc" + +# currently grub only builds on x86*, aarch64 and ppc64le systems +case "$CARCH" in +x86) subpackages="$subpackages $pkgname-efi $pkgname-bios" ;; +x86_64) subpackages="$subpackages $pkgname-efi $pkgname-bios $pkgname-xenhost" ;; +aarch64) subpackages="$subpackages $pkgname-efi" ;; +ppc64le) subpackages="$subpackages $pkgname-ieee1275" ;; +esac + +source="ftp://alpha.gnu.org/gnu/grub/grub-$_ver.tar.xz + 2.02_beta3-gcc6-ld-no-pie.patch + fix-gcc-no-pie-specs.patch + grub2-accept-empty-module.patch + grub-xen-host_grub.cfg + 2.02_beta3-mkconfig-alpine.patch + " +builddir="$srcdir/grub-$_ver" + + +_build_bios() { + msg "Building grub for platform BIOS" + cd $builddir/bios + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --localstatedir=/var \ + --disable-nls \ + --disable-werror \ + --with-platform=pc \ + || return 1 + make || return 1 +} + +_build_efi() { + msg "Building grub for platform EFI" + cd $builddir/efi + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --localstatedir=/var \ + --disable-nls \ + --disable-werror \ + --with-platform=efi \ + --disable-efiemu \ + || return 1 + make || return 1 +} + +_build_xen() { + msg "Building grub for platform XEN" + cd $builddir/xen + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --localstatedir=/var \ + --disable-nls \ + --disable-werror \ + --with-platform=xen \ + --target=$CARCH \ + || return 1 + make || return 1 +} + +_build_ieee1275() { + msg "Building grub for platform IEEE1275" + cd $builddir/ieee1275 + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --localstatedir=/var \ + --disable-nls \ + --disable-werror \ + --with-platform=ieee1275 \ + || return 1 + make || return 1 +} + +build() { + cd "$builddir" + autoreconf -vif || return 1 + + cd "$srcdir" + tmpdir="$srcdir"/tmp + mv "$builddir" "$tmpdir" + + mkdir "$builddir" + cp -r "$tmpdir" "$builddir"/bios + cp -r "$tmpdir" "$builddir"/efi + cp -r "$tmpdir" "$builddir"/xen + mv "$tmpdir" "$builddir"/ieee1275 + + case "$CARCH" in + x86) + _build_bios || return 1 + _build_efi || return 1 ;; + x86_64) + _build_bios || return 1 + _build_efi || return 1 + _build_xen || return 1 ;; + aarch64) + _build_efi || return 1 ;; + ppc64le) + _build_ieee1275 || return 1 ;; + esac +} + +_install_bios() { + cd "$builddir"/bios + make DESTDIR="$pkgdir" install-strip || return 1 +} + +_install_efi() { + cd "$builddir"/efi + make DESTDIR="$pkgdir" install-strip || return 1 +} + +_install_xen() { + cd "$builddir"/xen + + grub_dir=`mktemp -d` + cfg=`mktemp` + grub_memdisk=`mktemp` + + mkdir -p $grub_dir/boot/grub + echo 'normal (memdisk)/grub.cfg' > $cfg + sed -e "s/@@PVBOOT_ARCH@@/$CARCH/g" \ + $srcdir/grub-xen-host_grub.cfg \ + > $grub_dir/grub.cfg + tar -cf - -C $grub_dir grub.cfg > $grub_memdisk + + ./grub-mkimage \ + -O $CARCH-xen \ + -c $cfg \ + -d ./grub-core ./grub-core/*.mod \ + -m $grub_memdisk \ + -o $pkgdir/grub-$CARCH-xen.bin + + rm -r "$grub_dir" + rm "$cfg" + rm "$grub_memdisk" +} + +_install_ieee1275() { + cd "$builddir"/ieee1275 + make DESTDIR="$pkgdir" install-strip || return 1 +} + +package() { + # install BIOS & EFI version into the same directory + # and overwrite similar files. + + case "$CARCH" in + x86) + _install_bios + _install_efi ;; + x86_64) + _install_bios + _install_efi + _install_xen ;; + aarch64) + _install_efi ;; + ppc64le) + _install_ieee1275 ;; + esac + + rm -f "$pkgdir"/usr/lib/charset.alias +} + +bios() { + pkgdesc="$pkgdesc (BIOS version)" + depends="$pkgname" + mkdir -p $subpkgdir/usr/lib/grub + mv $pkgdir/usr/lib/grub/*-pc $subpkgdir/usr/lib/grub/ +} + +efi() { + pkgdesc="$pkgdesc (EFI version)" + depends="$pkgname" + mkdir -p $subpkgdir/usr/lib/grub + mv $pkgdir/usr/lib/grub/*-efi $subpkgdir/usr/lib/grub/ +} + +xenhost() { + pkgdesc="$pkgdesc (XEN host version)" + mkdir -p $subpkgdir/usr/lib/grub-xen + mv $pkgdir/*-xen.bin $subpkgdir/usr/lib/grub-xen/ +} + +ieee1275() { + pkgdesc="$pkgdesc (IEEE1275 version)" + depends="$pkgname" + mkdir -p $subpkgdir/usr/lib/grub + mv $pkgdir/usr/lib/grub/*-ieee1275 $subpkgdir/usr/lib/grub/ +} + +sha512sums="4a530efef4dae45f4046cf3550563f14acb24d25cb88d5e06c93953ca5b1eec115118c6860233a9f627edcddae2571e5d6b867b70ff9dd5c184c9fef83ef7e11 grub-2.02~beta3.tar.xz +fc15c95bf26b28eee3b5a0d8e5fac538445179cea19a8657cd360e37dd5a95010ea2b899d1e4f3692b778a71f79526539ad1c741f028186f0daf135ee1678da0 2.02_beta3-gcc6-ld-no-pie.patch +b9eab870006ab7842e0af27171d3b66fea10835d3fd4e606f241a9898aa28bfc4c1cdf59cece8ad50d2e284a44cba74eb0f390ac29627518f86257a8d586976e fix-gcc-no-pie-specs.patch +098a1742aef131c85d63b934a9815879b991f2e73030cb90ac4b5dcd07d249fa0dd0a281e52ada0e10f05d59223493bd416eb47543242bf0ba336a0ebc9b2a1a grub2-accept-empty-module.patch +4e7394e0fff6772c89683039ccf81099ebbfe4f498e6df408977a1488fd59389b6e19afdbf0860ec271e2b2aea0df7216243dcc8235d1ca3af0e7f4d0a9d60a4 grub-xen-host_grub.cfg +5de7c1cc11640a3892447f0daa1e3fd1f67b0c474c8aec555e4e6315b5e6c00491ba02c88b420cec221da0640c6961d639f148746df14a0b2c15bda7989cd25c 2.02_beta3-mkconfig-alpine.patch" diff --git a/main/grub/fix-gcc-no-pie-specs.patch b/main/grub/fix-gcc-no-pie-specs.patch new file mode 100644 index 0000000000..b14c0be3cc --- /dev/null +++ b/main/grub/fix-gcc-no-pie-specs.patch @@ -0,0 +1,20 @@ +--- ./configure.ac.orig ++++ ./configure.ac +@@ -1092,7 +1092,7 @@ + if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then + efiemu_excuse="no suitable link format for efiemu64 found" + else +- EFIEMU64_LINK_FORMAT="-Wl,$grub_cv_target_cc_efiemu64_link_format" ++ EFIEMU64_LINK_FORMAT="-Wl,$grub_cv_target_cc_efiemu64_link_format -no-pie" + fi + fi + if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then +@@ -1188,7 +1188,7 @@ + [# Need that, because some distributions ship compilers that include + # `-fPIE' and '-pie' in the default specs. + if [ x"$pie_possible" = xyes ]; then +- TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE" ++ TARGET_CFLAGS="$TARGET_CFLAGS -no-pie" + fi + if [ x"$nopie_possible" = xyes ] && [ x"$pie_possible" = xyes ]; then + TARGET_LDFLAGS="$TARGET_LDFLAGS -no-pie" diff --git a/main/grub/grub-xen-host_grub.cfg b/main/grub/grub-xen-host_grub.cfg new file mode 100644 index 0000000000..f0eecbba7d --- /dev/null +++ b/main/grub/grub-xen-host_grub.cfg @@ -0,0 +1,24 @@ +# First search for a suitable grub to chainload +if search -s -f /boot/xen/pvboot-@@PVBOOT_ARCH@@.elf ; then + echo "Chainloading (${root})/boot/xen/pvboot-@@PVBOOT_ARCH@@.elf" + multiboot "/boot/xen/pvboot-@@PVBOOT_ARCH@@.elf" + boot +fi + +if search -s -f /xen/pvboot-@@PVBOOT_ARCH@@.elf ; then + echo "Chainloading (${root})/xen/pvboot-@@PVBOOT_ARCH@@.elf" + multiboot "/xen/pvboot-@@PVBOOT_ARCH@@.elf" + boot +fi + +# Second try looking for grub.cfg + +if search -s -f /boot/grub/grub.cfg ; then + echo "Reading (${root})/boot/grub/grub.cfg" + configfile /boot/grub/grub.cfg +fi + +if search -s -f /grub/grub.cfg ; then + echo "Reading (${root})/grub/grub.cfg" + configfile /grub/grub.cfg +fi diff --git a/main/grub/grub2-accept-empty-module.patch b/main/grub/grub2-accept-empty-module.patch new file mode 100644 index 0000000000..d3d75457dc --- /dev/null +++ b/main/grub/grub2-accept-empty-module.patch @@ -0,0 +1,22 @@ +From: Michael Matz <matz@suse.com> + +Accept empty modules + +For the Xen platform the all_video.mod module is empty. +With old binutils the .symtab section remained (containing +only section symbols), so the check didn't trigger, but starting +with binutils 2.27 not even a .symtab remains. As there are +also no relocations that's no problem (and that is checked +independendly). +--- grub-2.02~beta3/util/grub-module-verifierXX.c.mm 2016-02-11 10:57:41.000000000 +0000 ++++ grub-2.02~beta3/util/grub-module-verifierXX.c 2016-08-31 15:26:36.000000000 +0000 +@@ -199,7 +199,8 @@ check_symbols (const struct grub_module_ + Elf_Shdr *s = find_section (arch, e, ".moddeps"); + + if (!s) +- grub_util_error ("no symbol table and no .moddeps section"); ++ /*grub_util_error ("no symbol table and no .moddeps section");*/ ++ return; /* An empty module happens for all_video.module for Xen */ + + if (!s->sh_size) + grub_util_error ("no symbol table and empty .moddeps section"); |