diff options
Diffstat (limited to 'user/grub')
-rw-r--r-- | user/grub/APKBUILD | 31 | ||||
-rw-r--r-- | user/grub/adelie-branding.patch | 25 | ||||
-rw-r--r-- | user/grub/default-grub | 9 | ||||
-rw-r--r-- | user/grub/grub.post-upgrade | 38 | ||||
-rw-r--r-- | user/grub/grub.trigger | 2 | ||||
-rw-r--r-- | user/grub/grub2-accept-empty-module.patch | 10 | ||||
-rw-r--r-- | user/grub/quirk-01_radeon_agpmode | 28 | ||||
-rw-r--r-- | user/grub/the-arch-everyone-uses-and-nobody-loves.patch | 72 | ||||
-rw-r--r-- | user/grub/update-grub | 16 | ||||
-rw-r--r-- | user/grub/x86_64_asm.patch | 73 |
10 files changed, 145 insertions, 159 deletions
diff --git a/user/grub/APKBUILD b/user/grub/APKBUILD index 9d6ada6fd..69c53c313 100644 --- a/user/grub/APKBUILD +++ b/user/grub/APKBUILD @@ -1,8 +1,8 @@ # Contributor: Carlo Landmeter <clandmeter@gmail.com> # Maintainer: A. Wilcox <awilfox@adelielinux.org> pkgname=grub -pkgver=2.02 -pkgrel=7 +pkgver=2.04 +pkgrel=0 pkgdesc="Bootloader with support for Linux, Multiboot and more" url="https://www.gnu.org/software/grub/" arch="all !s390x" @@ -12,6 +12,8 @@ license="GPL-3.0+" depends="" makedepends="bison flex freetype-dev linux-headers lvm2-dev python3 xz unifont automake autoconf libtool" +# [22:02] <@awilfox> [[sroracle]]: grub breaks without its locale files present +# [22:02] <@awilfox> it cannot be split subpackages="$pkgname-dev $pkgname-doc" # currently grub only builds on x86*, aarch64 and ppc* systems @@ -27,13 +29,17 @@ for f in $flavors; do subpackages="$subpackages $pkgname-$f" done +install="$pkgname.post-upgrade" +triggers="$pkgname.trigger=/boot" + source="https://ftp.gnu.org/gnu/grub/grub-$pkgver.tar.xz + adelie-branding.patch fix-gcc-no-pie-specs.patch grub2-accept-empty-module.patch grub-xen-host_grub.cfg - the-arch-everyone-uses-and-nobody-loves.patch - x86_64_asm.patch default-grub + update-grub + quirk-01_radeon_agpmode " prepare() { @@ -119,8 +125,14 @@ package() { rm -f "$pkgdir"/usr/lib/charset.alias install -D -m644 "$srcdir"/default-grub "$pkgdir"/etc/default/grub + install -D -m755 "$srcdir"/update-grub "$pkgdir"/usr/sbin # remove grub-install warning of missing directory mkdir -p "$pkgdir"/usr/share/locale + + for i in "$srcdir"/quirk-*; do + install -Dm755 "$i" \ + "$pkgdir"/etc/grub-quirks.d/"${i##"$srcdir"/quirk-}" + done } bios() { @@ -157,10 +169,11 @@ emu() { mv $pkgdir/usr/lib/grub/*-emu $subpkgdir/usr/lib/grub/ } -sha512sums="cc6eb0a42b5c8df2f671cc128ff725afb3ff1f8832a196022e433cf0d3b75decfca2316d0aa5fabea75747d55e88f3d021dd93508563f8ca80fd7b9e7fe1f088 grub-2.02.tar.xz +sha512sums="9c15c42d0cf5d61446b752194e3b628bb04be0fe6ea0240ab62b3d753784712744846e1f7c3651d8e0968d22012e6d713c38c44936d4004ded3ca4d4007babbb grub-2.04.tar.xz +f8c9af848c14abc3e4cc749b3ec80432d1d69bf945c8e48f1650ec35d2442450dc0436a02a4737d5d06f21d5fdef54a91120a393e8d77a6b55aeb897aa1fe85c adelie-branding.patch f2a7d9ab6c445f4e402e790db56378cecd6631b5c367451aa6ce5c01cd95b95c83c3dd24d6d4b857f8f42601eba82c855607513eb6ce5b2af6bd6c71f046e288 fix-gcc-no-pie-specs.patch -2fefc6d5c1388dba6d368451f47c216171136f03891e87777ee392884d7ef53c70b2a2565af676237216565f203f62b79aec0d1a82979b21aa29c4ebf87ac566 grub2-accept-empty-module.patch +6e001762f7f562f2fafed56118079122e7602c731c70723241276f523e0882a3930d720fd847143d379ffd85626d2d7d3fa914590c0de1f0903a293695e71c41 grub2-accept-empty-module.patch 4e7394e0fff6772c89683039ccf81099ebbfe4f498e6df408977a1488fd59389b6e19afdbf0860ec271e2b2aea0df7216243dcc8235d1ca3af0e7f4d0a9d60a4 grub-xen-host_grub.cfg -088455205f2f397d60e43eab19ed73994880ea1f442661f7975846cceaf2b112d92fd1341119d7dbfad3af2174dfd4d4721f31dead1ac35f4a3cb7c0d92f8a04 the-arch-everyone-uses-and-nobody-loves.patch -8752b5e689ec3b7e1f438c7207adc517d7acb4f7d15fda2907bc9177883a686f23994c66641bfc0c7620365415972b5d8b74f511c13dd234f5f3461dda4bb445 x86_64_asm.patch -048d061ac0aab0106f59a3d257739ff5de6c7dc08a4dc9b8b12e9bd2b1ec11f9bc6214013f3d1083b11c3ce41185fcbb5615beb2f290380abf392bb4c3f0d509 default-grub" +1e6ae4a3884829864dbd789d3c3a0d43a5aa5f279c3ebb25f71775686e9236bc1c6295e5064ad32b384635987ee0814df95e9ca33bc57bc8e0aeb47bec34270e default-grub +0907a810e9ba5be92d10dae38403d1e50fb9b324799df36d2241ff59f545dace37a65f2b1c8f07367220da4fd341d8f21dd9a4fab8da6c87ae52d7ffbca3dbd7 update-grub +78b7ec141a364994c7de181e47fedca820add9960c56c7adf4c14ee11d5249a0887fd788ecd5d24b9bdd102b7c40395181e2f7c3fe5ab795dd7c0057ba1115c5 quirk-01_radeon_agpmode" diff --git a/user/grub/adelie-branding.patch b/user/grub/adelie-branding.patch new file mode 100644 index 000000000..606c1e6e9 --- /dev/null +++ b/user/grub/adelie-branding.patch @@ -0,0 +1,25 @@ +--- grub-2.04/util/grub.d/10_linux.in.old 2018-11-24 17:13:02.000000000 +0000 ++++ grub-2.04/util/grub.d/10_linux.in 2019-10-03 01:22:34.593401423 +0000 +@@ -28,12 +28,16 @@ + + CLASS="--class gnu-linux --class gnu --class os" + +-if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then +- OS=GNU/Linux +-else +- OS="${GRUB_DISTRIBUTOR} GNU/Linux" +- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}" +-fi ++case "x${GRUB_DISTRIBUTOR}" in ++ x) ++ OS=GNU/Linux;; ++ xAdélie|xAdelie) ++ OS="Adélie Linux"; ++ CLASS="--class adelie";; ++ *) ++ OS="${GRUB_DISTRIBUTOR} GNU/Linux"; ++ CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}";; ++esac + + # loop-AES arranges things so that /dev/loop/X can be our root device, but + # the initrds that Linux uses don't like that. diff --git a/user/grub/default-grub b/user/grub/default-grub index 18fc2317d..3fb754c7e 100644 --- a/user/grub/default-grub +++ b/user/grub/default-grub @@ -6,3 +6,12 @@ GRUB_DEFAULT="Adélie" GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="Adélie" GRUB_CMDLINE_LINUX_DEFAULT="ro" + +# Uncomment the following line if you do *not* want /boot/grub/grub.cfg to be +# automatically regenerated when easy-kernel is upgraded. +#ADELIE_MANUAL_CONFIG=1 + +for i in /etc/grub-quirks.d/[0-9][0-9]*; do + [ -x "$i" ] || continue + . "$i" +done diff --git a/user/grub/grub.post-upgrade b/user/grub/grub.post-upgrade new file mode 100644 index 000000000..5b9cbb072 --- /dev/null +++ b/user/grub/grub.post-upgrade @@ -0,0 +1,38 @@ +#!/bin/sh -e +ver_new="$1" +ver_old="$2" + +if [ "$(apk version -t "$ver_old" "2.02-r8")" = "<" ]; then + cat >&2 <<-EOF + * + * Starting with grub=2.02-r8, /boot/grub/grub.cfg is now automatically + * regenerated when easy-kernel is upgraded. + * + EOF + if ! grep -Fqx '# DO NOT EDIT THIS FILE' /boot/grub/grub.cfg; then + cat >&2 <<-EOF + * It appears that you have a manual GRUB configuration. + * If this is incorrect, comment out ADELIE_MANUAL_CONFIG + * in /etc/default/grub. When this option is set, /boot/grub/grub.cfg + * will *not* be automatically regenerated. + * + EOF + + cat >> /etc/default/grub <<-EOF + # Uncomment the following line if you do *not* want /boot/grub/grub.cfg to be + # automatically regenerated when easy-kernel is upgraded. + ADELIE_MANUAL_CONFIG=1 + EOF + else + cat >&2 <<-EOF + * It appears that you have a default GRUB configuration. + * If this is incorrect, uncomment ADELIE_MANUAL_CONFIG=1 + * in /etc/default/grub. When this option is set, /boot/grub/grub.cfg + * will *not* be automatically regenerated. + * + * A copy of the existing configuration will be saved as + * /boot/grub/grub.cfg.update-grub-old. + * + EOF + fi +fi diff --git a/user/grub/grub.trigger b/user/grub/grub.trigger new file mode 100644 index 000000000..eba13a458 --- /dev/null +++ b/user/grub/grub.trigger @@ -0,0 +1,2 @@ +#!/bin/sh -e +exec update-grub diff --git a/user/grub/grub2-accept-empty-module.patch b/user/grub/grub2-accept-empty-module.patch index 16655b1a8..f4f62d433 100644 --- a/user/grub/grub2-accept-empty-module.patch +++ b/user/grub/grub2-accept-empty-module.patch @@ -10,13 +10,13 @@ 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 -@@ -224,7 +224,8 @@ check_symbols (const struct grub_module_ - Elf_Shdr *s = find_section (arch, e, ".moddeps"); +@@ -225,7 +225,8 @@ check_symbols (const struct grub_module_ + 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");*/ +- grub_util_error ("%s: no symbol table and no .moddeps section", modname); ++ /*grub_util_error ("%s: no symbol table and no .moddeps section", modname);*/ + 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"); + grub_util_error ("%s: no symbol table and empty .moddeps section", modname); diff --git a/user/grub/quirk-01_radeon_agpmode b/user/grub/quirk-01_radeon_agpmode new file mode 100644 index 000000000..879f1619e --- /dev/null +++ b/user/grub/quirk-01_radeon_agpmode @@ -0,0 +1,28 @@ +#!/bin/sh +# vi: noet: +# Horst Burkhardt <horst@adelielinux.org> 2018 +# Max Rees <maxcrees@me.com> 2019 +# +# AGP acceleration in the Radeon KMS driver has been broken on Apple PPC +# since the 2.6 series, and most developers are in agreement that since +# UniNorth is underdocumented, it probably won't ever be fixed. Disable +# it on all Apple machines except ones where it is known not to apply. +# +# https://bts.adelielinux.org/show_bug.cgi?id=49 +set -e + +case "$(uname -m)" in +ppc|ppc64) + if grep -q 'MacRISC[23]' /proc/cpuinfo; then + case "$(awk '$1 == "machine" { print $3 }' /proc/cpuinfo)" in + PowerBook1,1) ;; + PowerMac1,1) ;; + PowerMac1,2) ;; + PowerMac11,2) ;; + PowerMac12,1) ;; + RackMac3,1) ;; + iMac,1) ;; + *) export GRUB_CMDLINE_LINUX="radeon.agpmode=-1 $GRUB_CMDLINE_LINUX";; + esac + fi;; +esac diff --git a/user/grub/the-arch-everyone-uses-and-nobody-loves.patch b/user/grub/the-arch-everyone-uses-and-nobody-loves.patch deleted file mode 100644 index 2d09149f7..000000000 --- a/user/grub/the-arch-everyone-uses-and-nobody-loves.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 563b1da6e6ae7af46cc8354cadb5dab416989f0a Mon Sep 17 00:00:00 2001 -From: Michael Chang <mchang@suse.com> -Date: Mon, 26 Mar 2018 16:52:34 +0800 -Subject: Fix packed-not-aligned error on GCC 8 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When building with GCC 8, there are several errors regarding packed-not-aligned. - -./include/grub/gpt_partition.h:79:1: error: alignment 1 of ‘struct grub_gpt_partentry’ is less than 8 [-Werror=packed-not-aligned] - -This patch fixes the build error by cleaning up the ambiguity of placing -aligned structure in a packed one. In "struct grub_btrfs_time" and "struct -grub_gpt_part_type", the aligned attribute seems to be superfluous, and also -has to be packed, to ensure the structure is bit-to-bit mapped to the format -laid on disk. I think we could blame to copy and paste error here for the -mistake. In "struct efi_variable", we have to use grub_efi_packed_guid_t, as -the name suggests. :) - -Signed-off-by: Michael Chang <mchang@suse.com> -Tested-by: Michael Chang <mchang@suse.com> -Tested-by: Paul Menzel <paulepanter@users.sourceforge.net> -Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> ---- - grub-core/fs/btrfs.c | 2 +- - include/grub/efiemu/runtime.h | 2 +- - include/grub/gpt_partition.h | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 4849c1ceb..be195448d 100644 ---- a/grub-core/fs/btrfs.c -+++ b/grub-core/fs/btrfs.c -@@ -175,7 +175,7 @@ struct grub_btrfs_time - { - grub_int64_t sec; - grub_uint32_t nanosec; --} __attribute__ ((aligned (4))); -+} GRUB_PACKED; - - struct grub_btrfs_inode - { -diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h -index 9b6b729f4..36d2dedf4 100644 ---- a/include/grub/efiemu/runtime.h -+++ b/include/grub/efiemu/runtime.h -@@ -29,7 +29,7 @@ struct grub_efiemu_ptv_rel - - struct efi_variable - { -- grub_efi_guid_t guid; -+ grub_efi_packed_guid_t guid; - grub_uint32_t namelen; - grub_uint32_t size; - grub_efi_uint32_t attributes; -diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h -index 1b32f6725..9668a68c3 100644 ---- a/include/grub/gpt_partition.h -+++ b/include/grub/gpt_partition.h -@@ -28,7 +28,7 @@ struct grub_gpt_part_type - grub_uint16_t data2; - grub_uint16_t data3; - grub_uint8_t data4[8]; --} __attribute__ ((aligned(8))); -+} GRUB_PACKED; - typedef struct grub_gpt_part_type grub_gpt_part_type_t; - - #define GRUB_GPT_PARTITION_TYPE_EMPTY \ --- -cgit v1.1-33-g03f6 - diff --git a/user/grub/update-grub b/user/grub/update-grub new file mode 100644 index 000000000..d22930bd7 --- /dev/null +++ b/user/grub/update-grub @@ -0,0 +1,16 @@ +#!/bin/sh -e +. /etc/default/grub +if [ "$ADELIE_MANUAL_CONFIG" = 1 ]; then + cat >&2 <<-EOF + * + * You have specified that you are using a manual GRUB configuration. + * You must update it yourself. + * + EOF + exit 0 +fi + +if [ -e /boot/grub/grub.cfg ]; then + cp -p /boot/grub/grub.cfg /boot/grub/grub.cfg.update-grub-old +fi +exec grub-mkconfig -o /boot/grub/grub.cfg diff --git a/user/grub/x86_64_asm.patch b/user/grub/x86_64_asm.patch deleted file mode 100644 index 67a0d833f..000000000 --- a/user/grub/x86_64_asm.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 842c390469e2c2e10b5aa36700324cd3bde25875 Mon Sep 17 00:00:00 2001 -From: "H.J. Lu" <hjl.tools@gmail.com> -Date: Sat, 17 Feb 2018 06:47:28 -0800 -Subject: [PATCH] x86-64: Treat R_X86_64_PLT32 as R_X86_64_PC32 - -Starting from binutils commit bd7ab16b4537788ad53521c45469a1bdae84ad4a: - -https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=bd7ab16b4537788ad53521c45469a1bdae84ad4a - -x86-64 assembler generates R_X86_64_PLT32, instead of R_X86_64_PC32, for -32-bit PC-relative branches. Grub2 should treat R_X86_64_PLT32 as -R_X86_64_PC32. - -Signed-off-by: H.J. Lu <hjl.tools@gmail.com> -Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> ---- - grub-core/efiemu/i386/loadcore64.c | 1 + - grub-core/kern/x86_64/dl.c | 1 + - util/grub-mkimagexx.c | 1 + - util/grub-module-verifier.c | 1 + - 4 files changed, 4 insertions(+) - -diff --git a/grub-core/efiemu/i386/loadcore64.c b/grub-core/efiemu/i386/loadcore64.c -index e49d0b6..18facf4 100644 ---- a/grub-core/efiemu/i386/loadcore64.c -+++ b/grub-core/efiemu/i386/loadcore64.c -@@ -98,6 +98,7 @@ grub_arch_efiemu_relocate_symbols64 (grub_efiemu_segment_t segs, - break; - - case R_X86_64_PC32: -+ case R_X86_64_PLT32: - err = grub_efiemu_write_value (addr, - *addr32 + rel->r_addend - + sym.off -diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c -index 4406906..3a73e6e 100644 ---- a/grub-core/kern/x86_64/dl.c -+++ b/grub-core/kern/x86_64/dl.c -@@ -70,6 +70,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, - break; - - case R_X86_64_PC32: -+ case R_X86_64_PLT32: - { - grub_int64_t value; - value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value - -diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c -index a2bb054..39d7efb 100644 ---- a/util/grub-mkimagexx.c -+++ b/util/grub-mkimagexx.c -@@ -832,6 +832,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, - break; - - case R_X86_64_PC32: -+ case R_X86_64_PLT32: - { - grub_uint32_t *t32 = (grub_uint32_t *) target; - *t32 = grub_host_to_target64 (grub_target_to_host32 (*t32) -diff --git a/util/grub-module-verifier.c b/util/grub-module-verifier.c -index 9179285..a79271f 100644 ---- a/util/grub-module-verifier.c -+++ b/util/grub-module-verifier.c -@@ -19,6 +19,7 @@ struct grub_module_verifier_arch archs[] = { - -1 - }, (int[]){ - R_X86_64_PC32, -+ R_X86_64_PLT32, - -1 - } - }, --- -1.9.1 - |