├── .SRCINFO ├── 10_linux-detect-archlinux-initramfs.patch ├── PKGBUILD ├── README.md ├── add-GRUB_COLOR_variables.patch ├── grub-git.install ├── grub.default └── setup_var.patch /.SRCINFO: -------------------------------------------------------------------------------- 1 | pkgbase = grub-git 2 | pkgdesc = GNU GRand Unified Bootloader (2) 3 | pkgver = 2.02.r241.ged087f046 4 | pkgrel = 1 5 | url = https://www.gnu.org/software/grub/ 6 | install = grub-git.install 7 | arch = x86_64 8 | arch = i686 9 | license = GPL3 10 | makedepends = autogen 11 | makedepends = bdf-unifont 12 | makedepends = git 13 | makedepends = help2man 14 | makedepends = python 15 | makedepends = rsync 16 | makedepends = texinfo 17 | makedepends = ttf-dejavu 18 | makedepends = libusb 19 | depends = device-mapper 20 | depends = freetype2 21 | depends = fuse2 22 | depends = gettext 23 | depends = sdl 24 | optdepends = dosfstools: For grub-mkrescue FAT FS and EFI support 25 | optdepends = efibootmgr: For grub-install EFI support 26 | optdepends = libisoburn: Provides xorriso for generating grub rescue iso using grub-mkrescue 27 | optdepends = mtools: For grub-mkrescue FAT FS support 28 | optdepends = os-prober: To detect other OSes when generating grub.cfg in BIOS systems 29 | optdepends = libusb: For grub-emu USB support 30 | provides = grub 31 | conflicts = grub 32 | backup = etc/default/grub 33 | backup = etc/grub.d/40_custom 34 | source = grub::git://git.savannah.gnu.org/grub.git 35 | source = grub-extras::git://git.savannah.gnu.org/grub-extras.git 36 | source = 10_linux-detect-archlinux-initramfs.patch 37 | source = add-GRUB_COLOR_variables.patch 38 | source = grub.default 39 | sha256sums = SKIP 40 | sha256sums = SKIP 41 | sha256sums = b41e4438319136b5e74e0abdfcb64ae115393e4e15207490272c425f54026dd3 42 | sha256sums = a5198267ceb04dceb6d2ea7800281a42b3f91fd02da55d2cc9ea20d47273ca29 43 | sha256sums = 74e5dd2090a153c10a7b9599b73bb09e70fddc6a019dd41641b0f10b9d773d82 44 | 45 | pkgname = grub-git 46 | 47 | -------------------------------------------------------------------------------- /10_linux-detect-archlinux-initramfs.patch: -------------------------------------------------------------------------------- 1 | diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in 2 | index f5d3e78..ef59c8c 100644 3 | --- a/util/grub.d/10_linux.in 4 | +++ b/util/grub.d/10_linux.in 5 | @@ -83,6 +83,8 @@ linux_entry () 6 | case $type in 7 | recovery) 8 | title="$(gettext_printf "%s, with Linux %s (recovery mode)" "${os}" "${version}")" ;; 9 | + fallback) 10 | + title="$(gettext_printf "%s, with Linux %s (fallback initramfs)" "${os}" "${version}")" ;; 11 | *) 12 | title="$(gettext_printf "%s, with Linux %s" "${os}" "${version}")" ;; 13 | esac 14 | @@ -186,7 +188,7 @@ while [ "x$list" != "x" ] ; do 15 | basename=`basename $linux` 16 | dirname=`dirname $linux` 17 | rel_dirname=`make_system_path_relative_to_its_root $dirname` 18 | - version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` 19 | + version=`echo $basename | sed -e "s,vmlinuz-,,g"` 20 | alt_version=`echo $version | sed -e "s,\.old$,,g"` 21 | linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" 22 | 23 | @@ -248,6 +250,18 @@ while [ "x$list" != "x" ] ; do 24 | 25 | linux_entry "${OS}" "${version}" advanced \ 26 | "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" 27 | + 28 | + if test -e "${dirname}/initramfs-${version}-fallback.img" ; then 29 | + initrd="initramfs-${version}-fallback.img" 30 | + 31 | + if test -n "${initrd}" ; then 32 | + gettext_printf "Found fallback initrd image(s) in %s:%s\n" "${dirname}" "${initrd_extra} ${initrd}" >&2 33 | + fi 34 | + 35 | + linux_entry "${OS}" "${version}" fallback \ 36 | + "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" 37 | + fi 38 | + 39 | if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then 40 | linux_entry "${OS}" "${version}" recovery \ 41 | "single ${GRUB_CMDLINE_LINUX}" 42 | -- 43 | 2.9.2 44 | 45 | -------------------------------------------------------------------------------- /PKGBUILD: -------------------------------------------------------------------------------- 1 | # Maintainer: Llewelyn Trahaearn 2 | # Contributor: Tobias Powalowski 3 | # Contributor: Ronald van Haren 4 | # Contributor: Keshav Amburay <(the ddoott ridikulus ddoott rat) (aatt) (gemmaeiil) (ddoott) (ccoomm)> 5 | 6 | ## "1" to enable IA32-EFI build in Arch x86_64, "0" to disable 7 | _ia32_efi_in_arch_x64="1" 8 | 9 | ## "1" to enable EMU build, "0" to disable 10 | _grub_emu_build="1" 11 | 12 | [[ "${CARCH}" == "x86_64" ]] && _target_arch="x86_64" 13 | [[ "${CARCH}" == "i686" ]] && _target_arch="i386" 14 | 15 | _build_platforms="i386-pc ${_target_arch}-efi" 16 | [[ "${CARCH}" == "x86_64" ]] && [[ "${_ia32_efi_in_arch_x64}" == "1" ]] && _build_platforms+=" i386-efi" 17 | [[ "${_grub_emu_build}" == "1" ]] && _build_platforms+=" ${_target_arch}-emu" 18 | 19 | pkgname="grub-git" 20 | pkgver=2.02.r265.g686db9664 21 | pkgrel=1 22 | pkgdesc="GNU GRand Unified Bootloader (2)" 23 | arch=('x86_64' 'i686') 24 | url="https://www.gnu.org/software/grub/" 25 | license=('GPL3') 26 | depends=('device-mapper' 'freetype2' 'fuse2' 'gettext') 27 | makedepends=('autogen' 'bdf-unifont' 'git' 'help2man' 28 | 'python' 'rsync' 'texinfo' 'ttf-dejavu') 29 | optdepends=('dosfstools: For grub-mkrescue FAT FS and EFI support' 30 | 'efibootmgr: For grub-install EFI support' 31 | 'libisoburn: Provides xorriso for generating grub rescue iso using grub-mkrescue' 32 | 'mtools: For grub-mkrescue FAT FS support' 33 | 'os-prober: To detect other OSes when generating grub.cfg in BIOS systems') 34 | 35 | if [[ "${_grub_emu_build}" == "1" ]]; then 36 | depends+=('sdl') 37 | makedepends+=('libusb') 38 | optdepends+=('libusb: For grub-emu USB support') 39 | fi 40 | 41 | provides=("${pkgname%-*}") 42 | conflicts=("${pkgname%-*}") 43 | backup=('etc/default/grub' 44 | 'etc/grub.d/40_custom') 45 | install="${pkgname}.install" 46 | source=("grub::git://git.savannah.gnu.org/grub.git" 47 | "grub-extras::git://git.savannah.gnu.org/grub-extras.git" 48 | 'setup_var.patch' 49 | '10_linux-detect-archlinux-initramfs.patch' 50 | 'add-GRUB_COLOR_variables.patch' 51 | 'grub.default') 52 | sha256sums=('SKIP' 53 | 'SKIP' 54 | 'SKIP' 55 | 'b41e4438319136b5e74e0abdfcb64ae115393e4e15207490272c425f54026dd3' 56 | 'a5198267ceb04dceb6d2ea7800281a42b3f91fd02da55d2cc9ea20d47273ca29' 57 | '74e5dd2090a153c10a7b9599b73bb09e70fddc6a019dd41641b0f10b9d773d82') 58 | 59 | prepare() { 60 | cd grub 61 | 62 | # Patch grub-mkconfig to detect Arch Linux initramfs images. 63 | patch -Np1 -i "$srcdir"/10_linux-detect-archlinux-initramfs.patch 64 | 65 | # Patch to enable GRUB_COLOR_* variables in grub-mkconfig. 66 | # Based on http://lists.gnu.org/archive/html/grub-devel/2012-02/msg00021.html 67 | patch -Np1 -i "$srcdir"/add-GRUB_COLOR_variables.patch 68 | 69 | # Patch to add setup_var 70 | patch -Np1 -i "$srcdir"/setup_var.patch 71 | 72 | # Fix DejaVuSans.ttf location so that grub-mkfont can create *.pf2 files for starfield theme. 73 | sed 's|/usr/share/fonts/dejavu|/usr/share/fonts/dejavu /usr/share/fonts/TTF|g' -i "configure.ac" 74 | 75 | # Modify grub-mkconfig behaviour to silence warnings FS#36275 76 | sed 's| ro | rw |g' -i "util/grub.d/10_linux.in" 77 | 78 | # Modify grub-mkconfig behaviour so automatically generated entries read 'Arch Linux' FS#33393 79 | sed 's|GNU/Linux|Linux|' -i "util/grub.d/10_linux.in" 80 | 81 | # Pull in latest language files 82 | ./linguas.sh 83 | 84 | # Remove lua module from grub-extras as it is incompatible with changes to grub_file_open 85 | # http://git.savannah.gnu.org/cgit/grub.git/commit/?id=ca0a4f689a02c2c5a5e385f874aaaa38e151564e 86 | rm -rf "$srcdir"/grub-extras/lua 87 | } 88 | 89 | pkgver() { 90 | cd grub 91 | git describe --long --tags | sed 's/^grub.//;s/\([^-]*-g\)/r\1/;s/-/./g' 92 | } 93 | 94 | build() { 95 | cd grub 96 | export GRUB_CONTRIB="$srcdir"/grub-extras 97 | ./autogen.sh 98 | 99 | # Undefined references to __stack_chk_fail 100 | CFLAGS=${CFLAGS/-fstack-protector-strong} 101 | 102 | # Undefined references to _GLOBAL_OFFSET_TABLE_ 103 | CFLAGS=${CFLAGS/-fno-plt} 104 | 105 | for _arch in $_build_platforms; do 106 | mkdir "$srcdir"/grub/build_"$_arch" 107 | cd "$srcdir"/grub/build_"$_arch" 108 | 109 | # Explicitly set ac_cv_header_sys_sysmacros_h 110 | # https://savannah.gnu.org/bugs/index.php?55520 111 | ../configure --with-platform="${_arch##*-}" \ 112 | --target="${_arch%%-*}" \ 113 | --prefix="/usr" \ 114 | --sbindir="/usr/bin" \ 115 | --sysconfdir="/etc" \ 116 | --enable-boot-time \ 117 | --enable-cache-stats \ 118 | --enable-device-mapper \ 119 | --enable-grub-mkfont \ 120 | --enable-grub-mount \ 121 | --enable-mm-debug \ 122 | --enable-nls \ 123 | --disable-silent-rules \ 124 | --disable-werror \ 125 | ac_cv_header_sys_sysmacros_h=yes 126 | make -j$(nproc) 127 | done 128 | } 129 | 130 | package() { 131 | cd grub 132 | 133 | for _arch in $_build_platforms; do 134 | cd "$srcdir"/grub/build_"$_arch" 135 | make DESTDIR="$pkgdir" bashcompletiondir=/usr/share/bash-completion/completions install 136 | done 137 | 138 | # Install /etc/default/grub (used by grub-mkconfig) 139 | install -D -m0644 "$srcdir"/grub.default "$pkgdir"/etc/default/grub 140 | 141 | # Tidy up 142 | find "$pkgdir"/usr/lib/grub \( -name '*.module' -o \ 143 | -name '*.image' -o \ 144 | -name 'kernel.exec' -o \ 145 | -name 'gdb_grub' -o \ 146 | -name 'gmodule.pl' \) -delete 147 | } 148 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # setup_var_grub 2 | Modified grub-git [PKGBUILD](https://wiki.archlinux.org/index.php/PKGBUILD) containing custom setup_var patch. 3 | This version of the setup_var patch allows users to edit efi variable stores outside of "Setup" for manufacturers with different naming conventions. 4 | 5 | I am not responsible for any losses or damages caused by the use of this program. USE AT YOUR OWN RISK. 6 | 7 | # Usage 8 | This modification uses the same syntax, with the addition of the storevariable. 9 | ``` 10 | setup_var storename offset [setval] 11 | ``` 12 | 13 | In the typical use the storename will be "Setup" 14 | ``` 15 | $ setup_var Setup 16 | ``` 17 | 18 | # Build Notes 19 | You can find pre-compiled binaries ready for use in [releases](https://github.com/XDleader555/grub_setup_var/releases) 20 | 21 | If you want to build and install this package on Arch Linux, simply run 22 | ``` 23 | $ makepkg -si 24 | ``` 25 | 26 | otherwise, for other linux distros, you can open up the PKGBUILD in your favorite text editor and follow the build process. 27 | 28 | To generate a standalone efi shell after building the project, from the build directory run 29 | ``` 30 | $ ./build_x86_64-efi/grub-mkstandalone -d ./build_x86_64-efi/grub-core/ -O x86_64-efi -o grubx64.efi 31 | ``` 32 | -------------------------------------------------------------------------------- /add-GRUB_COLOR_variables.patch: -------------------------------------------------------------------------------- 1 | diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in 2 | index 3390ba9..c416489 100644 3 | --- a/util/grub-mkconfig.in 4 | +++ b/util/grub-mkconfig.in 5 | @@ -218,6 +218,8 @@ export GRUB_DEFAULT \ 6 | GRUB_THEME \ 7 | GRUB_GFXPAYLOAD_LINUX \ 8 | GRUB_DISABLE_OS_PROBER \ 9 | + GRUB_COLOR_NORMAL \ 10 | + GRUB_COLOR_HIGHLIGHT \ 11 | GRUB_INIT_TUNE \ 12 | GRUB_SAVEDEFAULT \ 13 | GRUB_ENABLE_CRYPTODISK \ 14 | diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in 15 | index d2e7252..8259f45 100644 16 | --- a/util/grub.d/00_header.in 17 | +++ b/util/grub.d/00_header.in 18 | @@ -125,6 +125,14 @@ cat <