summaryrefslogtreecommitdiff
path: root/user/grub
diff options
context:
space:
mode:
Diffstat (limited to 'user/grub')
-rw-r--r--user/grub/2.02_beta3-mkconfig-alpine.patch30
-rw-r--r--user/grub/APKBUILD158
-rw-r--r--user/grub/fix-gcc-no-pie-specs.patch11
-rw-r--r--user/grub/grub-xen-host_grub.cfg24
-rw-r--r--user/grub/grub2-accept-empty-module.patch22
5 files changed, 245 insertions, 0 deletions
diff --git a/user/grub/2.02_beta3-mkconfig-alpine.patch b/user/grub/2.02_beta3-mkconfig-alpine.patch
new file mode 100644
index 000000000..606540fff
--- /dev/null
+++ b/user/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/user/grub/APKBUILD b/user/grub/APKBUILD
new file mode 100644
index 000000000..c7673788e
--- /dev/null
+++ b/user/grub/APKBUILD
@@ -0,0 +1,158 @@
+# Contributor: Carlo Landmeter <clandmeter@gmail.com>
+# Maintainer: A. Wilcox <awilfox@adelielinux.org>
+pkgname=grub
+pkgver=2.02
+pkgrel=4
+pkgdesc="Bootloader with support for Linux, Multiboot and more"
+url="https://www.gnu.org/software/grub/"
+arch="all !s390x"
+# strip handled by grub Makefiles, abuild strip breaks xen pv-grub
+options="!check !strip" # Cannot test boot loader.
+license="GPL-3.0+"
+depends=""
+makedepends="bison flex freetype-dev linux-headers lvm2-dev python3 xz unifont
+ automake autoconf libtool"
+subpackages="$pkgname-dev $pkgname-doc"
+
+# currently grub only builds on x86*, aarch64 and ppc* systems
+flavors=""
+case "$CARCH" in
+x86) flavors="efi bios";;
+x86_64) flavors="efi bios xenhost";;
+aarch64|arm*) flavors="efi";;
+ppc*) flavors="ieee1275"; makedepends="$makedepends powerpc-utils" ;;
+s390x) flavors="emu" ;;
+esac
+for f in $flavors; do
+ subpackages="$subpackages $pkgname-$f"
+done
+
+source="https://ftp.gnu.org/gnu/grub/grub-$pkgver.tar.xz
+ fix-gcc-no-pie-specs.patch
+ grub2-accept-empty-module.patch
+ grub-xen-host_grub.cfg
+ 2.02_beta3-mkconfig-alpine.patch
+ "
+
+prepare() {
+ default_prepare
+ autoreconf -vif
+}
+
+_build_flavor() {
+ local flavor="$1"
+ shift
+ local _configure="$@"
+
+ msg "Building grub for platform $flavor"
+ mkdir -p "$srcdir"/build-$flavor
+ cd "$srcdir"/build-$flavor
+ $builddir/configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --target=$CTARGET \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --localstatedir=/var \
+ --disable-nls \
+ --disable-werror \
+ $_configure
+ make
+}
+
+build() {
+ local f
+ for f in $flavors; do
+ case "$f" in
+ bios) _build_flavor $f --with-platform=pc;;
+ efi) _build_flavor $f --with-platform=efi --disable-efiemu;;
+ xenhost) _build_flavor $f --with-platform=xen;;
+ *) _build_flavor $f --with-platform=$f;;
+ esac
+ done
+}
+
+_install_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" "$grub_memdisk"
+}
+
+_install_flavor() {
+ local flavor="$1"
+ cd "$srcdir"/build-$flavor
+ case $flavor in
+ xenhost) _install_xen;;
+ *) make DESTDIR="$pkgdir" install-strip;;
+ esac
+}
+
+package() {
+ # install BIOS & EFI version into the same directory
+ # and overwrite similar files.
+ for f in $flavors; do
+ _install_flavor $f
+ done
+
+ rm -f "$pkgdir"/usr/lib/charset.alias
+ # remove grub-install warning of missing directory
+ mkdir -p "$pkgdir"/usr/share/locale
+}
+
+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 powerpc-utils"
+ mkdir -p $subpkgdir/usr/lib/grub
+ mv $pkgdir/usr/lib/grub/*-ieee1275 $subpkgdir/usr/lib/grub/
+}
+
+emu() {
+ pkgdesc="$pkgdesc (EMU version)"
+ depends="$pkgname"
+ mkdir -p $subpkgdir/usr/lib/grub
+ mv $pkgdir/usr/lib/grub/*-emu $subpkgdir/usr/lib/grub/
+}
+
+sha512sums="cc6eb0a42b5c8df2f671cc128ff725afb3ff1f8832a196022e433cf0d3b75decfca2316d0aa5fabea75747d55e88f3d021dd93508563f8ca80fd7b9e7fe1f088 grub-2.02.tar.xz
+f2a7d9ab6c445f4e402e790db56378cecd6631b5c367451aa6ce5c01cd95b95c83c3dd24d6d4b857f8f42601eba82c855607513eb6ce5b2af6bd6c71f046e288 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/user/grub/fix-gcc-no-pie-specs.patch b/user/grub/fix-gcc-no-pie-specs.patch
new file mode 100644
index 000000000..273c9dbe3
--- /dev/null
+++ b/user/grub/fix-gcc-no-pie-specs.patch
@@ -0,0 +1,11 @@
+--- ./configure.ac.orig
++++ ./configure.ac
+@@ -1100,7 +1100,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
diff --git a/user/grub/grub-xen-host_grub.cfg b/user/grub/grub-xen-host_grub.cfg
new file mode 100644
index 000000000..f0eecbba7
--- /dev/null
+++ b/user/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/user/grub/grub2-accept-empty-module.patch b/user/grub/grub2-accept-empty-module.patch
new file mode 100644
index 000000000..d3d75457d
--- /dev/null
+++ b/user/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");