summaryrefslogtreecommitdiff
path: root/libre/grub
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@lavabit.com>2012-08-27 00:15:51 -0300
committerAndré Fabian Silva Delgado <emulatorman@lavabit.com>2012-08-27 00:15:51 -0300
commit43a5bcc4818d2b06b0dbc8f53c9b9c26150e7dc6 (patch)
tree5178fe6d32627d77375f7651dd06b06d6acf06eb /libre/grub
parentff0f66c534f9f5d0c042c3eaf48bd7e52d94fa34 (diff)
downloadabslibre-43a5bcc4818d2b06b0dbc8f53c9b9c26150e7dc6.tar.gz
abslibre-43a5bcc4818d2b06b0dbc8f53c9b9c26150e7dc6.tar.bz2
abslibre-43a5bcc4818d2b06b0dbc8f53c9b9c26150e7dc6.zip
grub-2.00-1: adding new grub to [libre] repo on abslibre
Diffstat (limited to 'libre/grub')
-rw-r--r--libre/grub/05_archtheme6
-rw-r--r--libre/grub/20_memtest86+29
-rw-r--r--libre/grub/PKGBUILD250
-rw-r--r--libre/grub/fix_stack_pointer_handling_16_relocator.patch13
-rw-r--r--libre/grub/grub-install.fix11
-rw-r--r--libre/grub/grub-mkconfig-Use_outside_GRUB_PREFIX_if_defined.patch15
-rw-r--r--libre/grub/grub.cfg139
-rw-r--r--libre/grub/grub.default47
-rw-r--r--libre/grub/grub.install33
-rw-r--r--libre/grub/grub2.install33
-rw-r--r--libre/grub/grub2_automake_1.11.2_pkglib_to_pkgdata.patch134
-rw-r--r--libre/grub/grub2_bzr_export.sh113
-rw-r--r--libre/grub/grub_bzr_export.sh113
-rw-r--r--libre/grub/grub_extras_lua_args_fix.patch13
-rw-r--r--libre/grub/parabola-mkconfig.patch32
-rw-r--r--libre/grub/parabola_grub_mkconfig_fixes.patch152
16 files changed, 1133 insertions, 0 deletions
diff --git a/libre/grub/05_archtheme b/libre/grub/05_archtheme
new file mode 100644
index 000000000..4d1b6fb20
--- /dev/null
+++ b/libre/grub/05_archtheme
@@ -0,0 +1,6 @@
+#!/bin/bash -e
+
+cat << EOF
+set menu_color_normal=light-blue/black
+set menu_color_highlight=light-cyan/blue
+EOF
diff --git a/libre/grub/20_memtest86+ b/libre/grub/20_memtest86+
new file mode 100644
index 000000000..1d3096f6b
--- /dev/null
+++ b/libre/grub/20_memtest86+
@@ -0,0 +1,29 @@
+#! /bin/sh -e
+########################################################
+# This script generates a memtest86+ entry on grub.cfg #
+# if memtest is installed on the system. #
+########################################################
+
+prefix="/usr"
+exec_prefix="${prefix}"
+
+datarootdir="/usr/share"
+datadir="${datarootdir}"
+
+. "${datadir}/grub/grub-mkconfig_lib"
+
+MEMTEST86_IMAGE="/boot/memtest86+/memtest.bin"
+CLASS="--class memtest86 --class gnu --class tool"
+
+if [ -e $MEMTEST86_IMAGE ] && is_path_readable_by_grub $MEMTEST86_IMAGE; then
+ # image exists, create menu entry
+ echo "Found memtest86+ image: $MEMTEST86_IMAGE" >&2
+ cat << EOF
+menuentry "Memory test (memtest86+)" $CLASS {
+EOF
+ prepare_grub_to_access_device `${grub_probe} --target=device $MEMTEST86_IMAGE` | sed -e "s/^/ /"
+ cat << EOF
+ linux16 (\$root)`make_system_path_relative_to_its_root $MEMTEST86_IMAGE`
+}
+EOF
+fi
diff --git a/libre/grub/PKGBUILD b/libre/grub/PKGBUILD
new file mode 100644
index 000000000..8a1c01434
--- /dev/null
+++ b/libre/grub/PKGBUILD
@@ -0,0 +1,250 @@
+# Maintainer: Ronald van Haren <ronald.archlinux.org>
+# Contributor: Keshav P R <(the.ridikulus.rat) (aatt) (gemmaeiil) (ddoott) (ccoomm)>
+# Maintainer (Parabola): André Silva <emulatorman@lavabit.com>
+
+_grub_lua_ver=24
+_grub_ntldr_ver=21
+_grub_915_ver=9
+
+pkgname=('grub-common' 'grub-bios' 'grub-efi-i386')
+pkgbase=grub
+pkgver=2.00
+pkgrel=1
+url="https://www.gnu.org/software/grub/"
+arch=('i686' 'x86_64')
+license=('GPL3')
+makedepends=('xz' 'bdf-unifont' 'ttf-dejavu' 'python' 'autogen'
+ 'texinfo' 'help2man' 'gettext' 'device-mapper' 'fuse')
+
+source=("http://ftp.gnu.org/gnu/grub/grub-${pkgver}.tar.xz"
+ "ftp://ftp.archlinux.org/other/grub2/grub2_extras_lua_r${_grub_lua_ver}.tar.xz"
+ "ftp://ftp.archlinux.org/other/grub2/grub2_extras_ntldr-img_r${_grub_ntldr_ver}.tar.xz"
+ "ftp://ftp.archlinux.org/other/grub2/grub2_extras_915resolution_r${_grub_915_ver}.tar.xz"
+ 'parabola_grub_mkconfig_fixes.patch'
+ 'grub.default'
+ 'grub.cfg'
+ '20_memtest86+'
+ 'grub_bzr_export.sh')
+
+noextract=("grub2_extras_lua_r${_grub_lua_ver}.tar.xz"
+ "grub2_extras_ntldr-img_r${_grub_ntldr_ver}.tar.xz"
+ "grub2_extras_915resolution_r${_grub_915_ver}.tar.xz")
+
+sha1sums=('274d91e96b56a5b9dd0a07accff69dbb6dfb596b'
+ '89290031b974780c6df76893836d2477d4add895'
+ 'eb4b35b4c36b64f9405cbcbc538cb205171c1c0a'
+ 'd5ae2efec25616028a9d89e98b6e454f1c4c415f'
+ '31aa740fc225b3f3ed4917843038f9e8658a71be'
+ '79a0e597f19e15bd4c256384e0ef998bc6d06cc8'
+ 'fb69af1ff6c0b7fdf7ce7d42d0f048edc1a50a45'
+ 'ce35d7ae75cd1b5b677e894e528f96add40e77b9'
+ '0cfd4e51cdb14a92f06cfd3c607f2aa21f3e55fc')
+
+_build_grub-common_and_bios() {
+
+ ## copy the source for building the common/bios package
+ cp -r "${srcdir}/grub-${pkgver}" "${srcdir}/grub_bios-${pkgver}"
+ cd "${srcdir}/grub_bios-${pkgver}"
+
+ ## Apply Parabola specific fixes to enable grub-mkconfig detect Libre kernels and initramfs
+ patch -Np1 -i "${srcdir}/parabola_grub_mkconfig_fixes.patch"
+ echo
+
+ ## fix unifont.bdf location so that grub-mkfont can create *.pf2 files
+ sed 's|/usr/share/fonts/unifont|/usr/share/fonts/unifont /usr/share/fonts/misc|g' -i "${srcdir}/grub_bios-${pkgver}/configure.ac"
+
+ ## fix DejaVuSans.ttf location so that grub-mkfont can create *.pf2 files for starfield theme
+ sed 's|/usr/share/fonts/dejavu|/usr/share/fonts/dejavu /usr/share/fonts/TTF|g' -i "${srcdir}/grub_bios-${pkgver}/configure.ac"
+
+ ## add the grub-extra sources
+ export GRUB_CONTRIB="${srcdir}/grub_bios-${pkgver}/grub-extras/"
+ install -d "${srcdir}/grub_bios-${pkgver}/grub-extras"
+
+ bsdtar xf "${srcdir}/grub2_extras_lua_r${_grub_lua_ver}.tar.xz" \
+ -C "${srcdir}/grub_bios-${pkgver}/grub-extras"
+
+ bsdtar xf "${srcdir}/grub2_extras_ntldr-img_r${_grub_ntldr_ver}.tar.xz" \
+ -C "${srcdir}/grub_bios-${pkgver}/grub-extras"
+
+ bsdtar xf "${srcdir}/grub2_extras_915resolution_r${_grub_915_ver}.tar.xz" \
+ -C "${srcdir}/grub_bios-${pkgver}/grub-extras"
+
+ ## Requires python2
+ # sed 's|python |python2 |g' -i "${srcdir}/grub_bios-${pkgver}/autogen.sh"
+
+ ## start the actual build process
+ cd "${srcdir}/grub_bios-${pkgver}"
+ ./autogen.sh
+ echo
+
+ CFLAGS="" ./configure \
+ --with-platform="pc" \
+ --target="i386" \
+ --host="${CARCH}-unknown-linux-gnu" \
+ "${_EFIEMU}" \
+ --enable-mm-debug \
+ --enable-nls \
+ --enable-device-mapper \
+ --enable-cache-stats \
+ --enable-grub-mkfont \
+ --enable-grub-mount \
+ --prefix="/usr" \
+ --bindir="/usr/bin" \
+ --sbindir="/usr/sbin" \
+ --mandir="/usr/share/man" \
+ --infodir="/usr/share/info" \
+ --datarootdir="/usr/share" \
+ --sysconfdir="/etc" \
+ --program-prefix="" \
+ --with-bootdir="/boot" \
+ --with-grubdir="grub" \
+ --disable-werror
+ echo
+
+ CFLAGS="" make
+ echo
+
+}
+
+_build_grub-efi-i386() {
+
+ ## copy the source for building the efi package
+ cp -r "${srcdir}/grub-${pkgver}" "${srcdir}/grub_efi-${pkgver}"
+ cd "${srcdir}/grub_efi-${pkgver}"
+
+ export GRUB_CONTRIB="${srcdir}/grub_efi-${pkgver}/grub-extras/"
+ install -d "${srcdir}/grub_efi-${pkgver}/grub-extras"
+
+ bsdtar xf "${srcdir}/grub2_extras_lua_r${_grub_lua_ver}.tar.xz" \
+ -C "${srcdir}/grub_efi-${pkgver}/grub-extras"
+
+ cd "${srcdir}/grub_efi-${pkgver}"
+ ./autogen.sh
+ echo
+
+ CFLAGS="" ./configure \
+ --with-platform="efi" \
+ --target="i386" \
+ --host="${CARCH}-unknown-linux-gnu" \
+ --disable-efiemu \
+ --enable-mm-debug \
+ --enable-nls \
+ --enable-device-mapper \
+ --enable-cache-stats \
+ --enable-grub-mkfont \
+ --enable-grub-mount \
+ --prefix="/usr" \
+ --bindir="/usr/bin" \
+ --sbindir="/usr/sbin" \
+ --mandir="/usr/share/man" \
+ --infodir="/usr/share/info" \
+ --datarootdir="/usr/share" \
+ --sysconfdir="/etc" \
+ --program-prefix="" \
+ --with-bootdir="/boot" \
+ --with-grubdir="grub" \
+ --disable-werror
+ echo
+
+ CFLAGS="" make
+ echo
+
+}
+
+build() {
+
+ ## set architecture dependent variables
+ if [[ "${CARCH}" == 'x86_64' ]]; then
+ _EFIEMU="--enable-efiemu"
+ else
+ _EFIEMU="--disable-efiemu"
+ fi
+
+ _HOST="${CARCH}"
+
+ cd "${srcdir}/grub-${pkgver}"
+ # _get_locale_files
+
+ _build_grub-common_and_bios
+ echo
+
+ _build_grub-efi-i386
+ echo
+
+}
+
+package_grub-common() {
+
+ pkgdesc="GNU GRand Unified Bootloader - Utilities and Common Files (Parabola rebranded)"
+ depends=('sh' 'xz' 'freetype2' 'gettext' 'device-mapper' 'fuse')
+ conflicts=('grub-legacy' 'grub')
+ replaces=('grub2-common')
+ provides=('grub2-common')
+ backup=('boot/grub/grub.cfg' 'etc/default/grub' 'etc/grub.d/40_custom')
+ optdepends=('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')
+ install="grub.install"
+ options=('strip' 'purge' 'docs' 'zipman' '!emptydirs')
+
+ cd "${srcdir}/grub_bios-${pkgver}"
+ make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
+ echo
+
+ ## install extra /etc/grub.d/ files
+ install -D -m0755 "${srcdir}/20_memtest86+" "${pkgdir}/etc/grub.d/20_memtest86+"
+
+ ## install /etc/default/grub (used by grub-mkconfig)
+ install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
+
+ ## install grub.cfg (needed so it doesn't get removed on upgrading because it was previously here)
+ install -D -m0644 "${srcdir}/grub.cfg" "${pkgdir}/boot/grub/grub.cfg"
+
+ # remove platform specific files
+ rm -rf "${pkgdir}/usr/lib/grub/i386-pc/"
+
+}
+
+package_grub-bios() {
+
+ pkgdesc="GNU GRand Unified Bootloader - i386 PC BIOS Modules"
+ depends=("grub-common=${pkgver}")
+ options=('!strip' '!emptydirs')
+ replaces=('grub2-bios')
+ provides=('grub2-bios')
+
+ cd "${srcdir}/grub_bios-${pkgver}"
+ make DESTDIR="${pkgdir}/" install
+ echo
+
+ ## remove non platform-specific files
+ rm -rf "${pkgdir}"/{boot,etc,usr/{share,bin,sbin}}
+
+ ## remove gdb debugging related files
+ 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
+
+}
+
+package_grub-efi-i386() {
+
+ pkgdesc="GNU GRand Unified Bootloader - i386 UEFI Modules"
+ depends=("grub-common=${pkgver}" 'dosfstools' 'efibootmgr')
+ options=('!strip' '!emptydirs')
+ replaces=('grub2-efi-i386')
+ provides=('grub2-efi-i386')
+
+ cd "${srcdir}/grub_efi-${pkgver}"
+ make DESTDIR="${pkgdir}/" install
+ echo
+
+ ## remove non platform-specific files
+ rm -rf "${pkgdir}"/{boot,etc,usr/{share,bin,sbin}}
+
+ ## remove gdb debugging related files
+ rm -f "${pkgdir}/usr/lib/grub/i386-efi"/*.module || true
+ rm -f "${pkgdir}/usr/lib/grub/i386-efi"/*.image || true
+ rm -f "${pkgdir}/usr/lib/grub/i386-efi"/{kernel.exec,gdb_grub,gmodule.pl} || true
+
+}
diff --git a/libre/grub/fix_stack_pointer_handling_16_relocator.patch b/libre/grub/fix_stack_pointer_handling_16_relocator.patch
new file mode 100644
index 000000000..edc0ef502
--- /dev/null
+++ b/libre/grub/fix_stack_pointer_handling_16_relocator.patch
@@ -0,0 +1,13 @@
+diff --git a/grub-core/lib/i386/relocator16.S b/grub-core/lib/i386/relocator16.S
+index c3768f4..982415d 100644
+--- a/grub-core/lib/i386/relocator16.S
++++ b/grub-core/lib/i386/relocator16.S
+@@ -130,7 +130,7 @@ VARIABLE(grub_relocator16_ss)
+ .byte 0xb8
+ VARIABLE(grub_relocator16_sp)
+ .word 0
+- movw %ax, %ss
++ movzwl %ax, %esp
+
+ /* movw imm32, %edx. */
+ .byte 0x66, 0xba
diff --git a/libre/grub/grub-install.fix b/libre/grub/grub-install.fix
new file mode 100644
index 000000000..29e74bd44
--- /dev/null
+++ b/libre/grub/grub-install.fix
@@ -0,0 +1,11 @@
+=== modified file 'grub-core/kern/emu/hostdisk.c'
+--- grub-core/kern/emu/hostdisk.c 2012-04-18 21:48:52 +0000
++++ grub-core/kern/emu/hostdisk.c 2012-04-19 18:35:06 +0000
+@@ -1081,7 +1081,7 @@
+ {
+ int fd;
+ grub_disk_addr_t max = ~0ULL;
+- fd = open_device (disk, sector, O_RDONLY, &max);
++ fd = open_device (disk, sector, O_WRONLY, &max);
+ if (fd < 0)
+ return grub_errno;
diff --git a/libre/grub/grub-mkconfig-Use_outside_GRUB_PREFIX_if_defined.patch b/libre/grub/grub-mkconfig-Use_outside_GRUB_PREFIX_if_defined.patch
new file mode 100644
index 000000000..e1de26859
--- /dev/null
+++ b/libre/grub/grub-mkconfig-Use_outside_GRUB_PREFIX_if_defined.patch
@@ -0,0 +1,15 @@
+diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
+index 859c2e8..c4391dc 100644
+--- a/util/grub-mkconfig.in
++++ b/util/grub-mkconfig.in
+@@ -40,7 +40,9 @@ self=`basename $0`
+ grub_probe="${sbindir}/`echo grub-probe | sed "${transform}"`"
+ grub_script_check="${bindir}/`echo grub-script-check | sed "${transform}"`"
+
+-GRUB_PREFIX=`echo '/@bootdirname@/@grubdirname@' | sed "s,//*,/,g"`
++if test -z "${GRUB_PREFIX}"; then
++ GRUB_PREFIX=`echo '/@bootdirname@/@grubdirname@' | sed "s,//*,/,g"`
++fi
+
+ . "${datadir}/@PACKAGE@/grub-mkconfig_lib"
+
diff --git a/libre/grub/grub.cfg b/libre/grub/grub.cfg
new file mode 100644
index 000000000..7f583e102
--- /dev/null
+++ b/libre/grub/grub.cfg
@@ -0,0 +1,139 @@
+#
+# DO NOT EDIT THIS FILE
+#
+# It is automatically generated by grub-mkconfig using templates
+# from /etc/grub.d and settings from /etc/default/grub
+#
+
+### BEGIN /etc/grub.d/00_header ###
+insmod part_gpt
+insmod part_msdos
+if [ -s $prefix/grubenv ]; then
+ load_env
+fi
+set default="0"
+
+if [ x"${feature_menuentry_id}" = xy ]; then
+ menuentry_id_option="--id"
+else
+ menuentry_id_option=""
+fi
+
+export menuentry_id_option
+
+if [ "${prev_saved_entry}" ]; then
+ set saved_entry="${prev_saved_entry}"
+ save_env saved_entry
+ set prev_saved_entry=
+ save_env prev_saved_entry
+ set boot_once=true
+fi
+
+function savedefault {
+ if [ -z "${boot_once}" ]; then
+ saved_entry="${chosen}"
+ save_env saved_entry
+ fi
+}
+
+function load_video {
+ if [ x$feature_all_video_module = xy ]; then
+ insmod all_video
+ else
+ insmod efi_gop
+ insmod efi_uga
+ insmod ieee1275_fb
+ insmod vbe
+ insmod vga
+ insmod video_bochs
+ insmod video_cirrus
+ fi
+}
+
+if [ x$feature_default_font_path = xy ] ; then
+ font=unicode
+else
+insmod part_msdos
+insmod ext2
+set root='hd0,msdos5'
+if [ x$feature_platform_search_hint = xy ]; then
+ search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 ad4103fa-d940-47ca-8506-301d8071d467
+else
+ search --no-floppy --fs-uuid --set=root ad4103fa-d940-47ca-8506-301d8071d467
+fi
+ font="/usr/share/grub/unicode.pf2"
+fi
+
+if loadfont $font ; then
+ set gfxmode=auto
+ load_video
+ insmod gfxterm
+ set locale_dir=$prefix/locale
+ set lang=en_US
+ insmod gettext
+fi
+terminal_input console
+terminal_output gfxterm
+set timeout=5
+### END /etc/grub.d/00_header ###
+
+### BEGIN /etc/grub.d/10_linux ###
+menuentry 'Parabola GNU/Linux-libre, with Linux-libre core repo kernel' --class parabola --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-core repo kernel-true-ad4103fa-d940-47ca-8506-301d8071d467' {
+ load_video
+ set gfxpayload=keep
+ insmod gzio
+ insmod part_msdos
+ insmod ext2
+ set root='hd0,msdos5'
+ if [ x$feature_platform_search_hint = xy ]; then
+ search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 ad4103fa-d940-47ca-8506-301d8071d467
+ else
+ search --no-floppy --fs-uuid --set=root ad4103fa-d940-47ca-8506-301d8071d467
+ fi
+ echo 'Loading Linux libre core repo kernel ...'
+ linux /boot/vmlinuz-linux-libre root=UUID=ad4103fa-d940-47ca-8506-301d8071d467 ro quiet
+ echo 'Loading initial ramdisk ...'
+ initrd /boot/initramfs-linux-libre.img
+}
+menuentry 'Parabola GNU/Linux-libre, with Linux libre repo kernel (Fallback initramfs)' --class parabola --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-core repo kernel-fallback-ad4103fa-d940-47ca-8506-301d8071d467' {
+ load_video
+ set gfxpayload=keep
+ insmod gzio
+ insmod part_msdos
+ insmod ext2
+ set root='hd0,msdos5'
+ if [ x$feature_platform_search_hint = xy ]; then
+ search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 ad4103fa-d940-47ca-8506-301d8071d467
+ else
+ search --no-floppy --fs-uuid --set=root ad4103fa-d940-47ca-8506-301d8071d467
+ fi
+ echo 'Loading Linux libre core repo kernel ...'
+ linux /boot/vmlinuz-linux-libre root=UUID=ad4103fa-d940-47ca-8506-301d8071d467 ro quiet
+ echo 'Loading initial ramdisk ...'
+ initrd /boot/initramfs-linux-libre-fallback.img
+}
+
+### END /etc/grub.d/10_linux ###
+
+### BEGIN /etc/grub.d/20_linux_xen ###
+### END /etc/grub.d/20_linux_xen ###
+
+### BEGIN /etc/grub.d/20_memtest86+ ###
+### END /etc/grub.d/20_memtest86+ ###
+
+### BEGIN /etc/grub.d/30_os-prober ###
+### END /etc/grub.d/30_os-prober ###
+
+### BEGIN /etc/grub.d/40_custom ###
+# This file provides an easy way to add custom menu entries. Simply type the
+# menu entries you want to add after this comment. Be careful not to change
+# the 'exec tail' line above.
+### END /etc/grub.d/40_custom ###
+
+### BEGIN /etc/grub.d/41_custom ###
+if [ -f ${config_directory}/custom.cfg ]; then
+ source ${config_directory}/custom.cfg
+elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
+ source $prefix/custom.cfg;
+fi
+### END /etc/grub.d/41_custom ###
diff --git a/libre/grub/grub.default b/libre/grub/grub.default
new file mode 100644
index 000000000..2ceb40543
--- /dev/null
+++ b/libre/grub/grub.default
@@ -0,0 +1,47 @@
+GRUB_DEFAULT=0
+GRUB_TIMEOUT=5
+GRUB_DISTRIBUTOR="Parabola GNU/Linux-libre"
+GRUB_CMDLINE_LINUX_DEFAULT="quiet"
+GRUB_CMDLINE_LINUX=""
+
+# Preload both GPT and MBR modules so that they are not missed
+GRUB_PRELOAD_MODULES="part_gpt part_msdos"
+
+# Uncomment to enable Hidden Menu, and optionally hide the timeout count
+#GRUB_HIDDEN_TIMEOUT=5
+#GRUB_HIDDEN_TIMEOUT_QUIET=true
+
+# Uncomment to use basic console
+GRUB_TERMINAL_INPUT=console
+
+# Uncomment to disable graphical terminal
+#GRUB_TERMINAL_OUTPUT=console
+
+# The resolution used on graphical terminal
+# note that you can use only modes which your graphic card supports via VBE
+# you can see them in real GRUB with the command `vbeinfo'
+GRUB_GFXMODE=auto
+
+# Uncomment to allow the kernel use the same resolution used by grub
+GRUB_GFXPAYLOAD_LINUX=keep
+
+# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
+# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
+#GRUB_DISABLE_LINUX_UUID=true
+
+# Uncomment to disable generation of recovery mode menu entries
+GRUB_DISABLE_RECOVERY=true
+
+# Uncomment and set to the desired menu colors. Used by normal and wallpaper
+# modes only. Entries specified as foreground/background.
+GRUB_COLOR_NORMAL="magenta/black"
+GRUB_COLOR_HIGHLIGHT="white/magenta"
+
+# Uncomment one of them for the gfx desired, a image background or a gfxtheme
+#GRUB_BACKGROUND="/path/to/wallpaper"
+#GRUB_THEME="/path/to/gfxtheme"
+
+# Uncomment to get a beep at GRUB start
+#GRUB_INIT_TUNE="480 440 1"
+
+#GRUB_SAVEDEFAULT="true"
diff --git a/libre/grub/grub.install b/libre/grub/grub.install
new file mode 100644
index 000000000..9188b357a
--- /dev/null
+++ b/libre/grub/grub.install
@@ -0,0 +1,33 @@
+infodir="usr/share/info"
+filelist=('grub.info' 'grub-dev.info')
+
+post_install() {
+ if [ -f /boot/grub/grub.cfg.pacsave ]; then
+ echo "Copying /boot/grub/grub.cfg.pacsave to /boot/grub/grub.cfg"
+ install -D -m0644 /boot/grub/grub.cfg.pacsave /boot/grub/grub.cfg
+ fi
+
+ cat << 'EOM'
+Generating grub.cfg.example config file...
+This may fail on some machines running a custom kernel.
+EOM
+
+ grub-mkconfig -o /boot/grub/grub.cfg.example 2> /dev/null
+ echo "done."
+
+ for file in ${filelist[@]}; do
+ install-info ${infodir}/${file}.gz ${infodir}/dir 2> /dev/null
+ done
+}
+
+post_upgrade() {
+ for file in ${filelist[@]}; do
+ install-info ${infodir}/${file}.gz ${infodir}/dir 2> /dev/null
+ done
+}
+
+pre_remove() {
+ for file in ${filelist[@]}; do
+ install-info --delete ${infodir}/${file} ${infodir}/dir 2> /dev/null
+ done
+}
diff --git a/libre/grub/grub2.install b/libre/grub/grub2.install
new file mode 100644
index 000000000..000533553
--- /dev/null
+++ b/libre/grub/grub2.install
@@ -0,0 +1,33 @@
+infodir=usr/share/info
+filelist=(grub.info grub-dev.info)
+
+post_install() {
+ if [ -f /boot/grub/grub.cfg.pacsave ]; then
+ echo "Copying /boot/grub/grub.cfg.pacsave to /boot/grub/grub.cfg"
+ install -Dm644 /boot/grub/grub.cfg.pacsave /boot/grub/grub.cfg
+ fi
+
+ cat << 'EOM'
+Generating grub.cfg.example config file...
+This may fail on some machines running a custom kernel.
+EOM
+
+ grub-mkconfig -o /boot/grub/grub.cfg.example 2> /dev/null
+ echo "done."
+
+ for file in ${filelist[@]}; do
+ install-info $infodir/$file.gz $infodir/dir 2> /dev/null
+ done
+}
+
+post_upgrade() {
+ for file in ${filelist[@]}; do
+ install-info $infodir/$file.gz $infodir/dir 2> /dev/null
+ done
+}
+
+pre_remove() {
+ for file in ${filelist[@]}; do
+ install-info --delete $infodir/$file $infodir/dir 2> /dev/null
+ done
+}
diff --git a/libre/grub/grub2_automake_1.11.2_pkglib_to_pkgdata.patch b/libre/grub/grub2_automake_1.11.2_pkglib_to_pkgdata.patch
new file mode 100644
index 000000000..0e396b210
--- /dev/null
+++ b/libre/grub/grub2_automake_1.11.2_pkglib_to_pkgdata.patch
@@ -0,0 +1,134 @@
+diff --git a/ChangeLog_Keshav b/ChangeLog_Keshav
+new file mode 100644
+index 0000000..0eafd65
+--- /dev/null
++++ b/ChangeLog_Keshav
+@@ -0,0 +1,12 @@
++2012-01-04 Keshav P R <the.ridikulus.rat@gmail.com>
++
++ Fixes for automake 1.11.2
++
++ * conf/Makefile.common: Change pkglib_SCRIPTS to pkgdata_SCRIPTS.
++ * conf/Makefile.common: Change pkglib_DATA to pkgdata_DATA.
++ * Makefile.am: Likewise.
++ * gentpl.py: Likewise.
++ * util/grub-mkstandalone.in: Likewise.
++ * util/grub-mknetdir.in: Likewise.
++ * util/grub-mkrescue.in: Likewise.
++ * util/grub-mkstandalone.in: Likewise.
+diff --git a/Makefile.am b/Makefile.am
+index c5f486e..395b0dd 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -101,8 +101,8 @@ CLEANFILES += widthspec.h
+ # Install config.h into platformdir
+ platform_HEADERS = config.h
+
+-pkglib_DATA += grub-mkconfig_lib
+-pkglib_DATA += update-grub_lib
++pkgdata_DATA += grub-mkconfig_lib
++pkgdata_DATA += update-grub_lib
+
+
+ if COND_i386_coreboot
+diff --git a/conf/Makefile.common b/conf/Makefile.common
+index 751188b..bbd59cc 100644
+--- a/conf/Makefile.common
++++ b/conf/Makefile.common
+@@ -137,7 +137,7 @@ KERNEL_HEADER_FILES =
+
+ man_MANS =
+ noinst_DATA =
+-pkglib_DATA =
++pkgdata_DATA =
+ bin_SCRIPTS =
+ sbin_SCRIPTS =
+ bin_PROGRAMS =
+@@ -147,7 +147,7 @@ check_SCRIPTS =
+ grubconf_DATA =
+ check_PROGRAMS =
+ noinst_SCRIPTS =
+-pkglib_SCRIPTS =
++pkgdata_SCRIPTS =
+ noinst_PROGRAMS =
+ grubconf_SCRIPTS =
+ noinst_LIBRARIES =
+diff --git a/gentpl.py b/gentpl.py
+index 3008b80..a935f4d 100644
+--- a/gentpl.py
++++ b/gentpl.py
+@@ -512,7 +512,7 @@ def script(platform):
+ r += "[+ ENDIF +]"
+
+ r += rule("[+ name +]", platform_sources(platform) + " $(top_builddir)/config.status", """
+-$(top_builddir)/config.status --file=-:$< | sed -e 's,@pkglib_DATA@,$(pkglib_DATA),g' > $@
++$(top_builddir)/config.status --file=-:$< | sed -e 's,@pkgdata_DATA@,$(pkgdata_DATA),g' > $@
+ chmod a+x [+ name +]
+ """)
+
+diff --git a/util/grub-mknetdir.in b/util/grub-mknetdir.in
+index e5a2172..7f6a36d 100644
+--- a/util/grub-mknetdir.in
++++ b/util/grub-mknetdir.in
+@@ -30,7 +30,7 @@ PACKAGE_VERSION=@PACKAGE_VERSION@
+ host_os=@host_os@
+ localedir=@datadir@/locale
+ datarootdir=@datarootdir@
+-pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst"
++pkgdata_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst"
+
+ self=`basename $0`
+
+@@ -183,7 +183,7 @@ process_input_dir ()
+ cp -f "$file" "$grubdir/"
+ fi
+ done
+- for file in ${pkglib_DATA}; do
++ for file in ${pkgdata_DATA}; do
+ if test -f "${input_dir}/${file}"; then
+ cp -f "${input_dir}/${file}" "$grubdir/"
+ fi
+diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in
+index eff7708..f6b96d4 100644
+--- a/util/grub-mkrescue.in
++++ b/util/grub-mkrescue.in
+@@ -27,7 +27,7 @@ libdir=@libdir@
+ PACKAGE_NAME=@PACKAGE_NAME@
+ PACKAGE_TARNAME=@PACKAGE_TARNAME@
+ PACKAGE_VERSION=@PACKAGE_VERSION@
+-pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst"
++pkgdata_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst"
+
+ self=`basename $0`
+
+@@ -163,7 +163,7 @@ process_input_dir ()
+ cp -f "$file" ${iso9660_dir}/boot/grub/${platform}/
+ fi
+ done
+- for file in ${pkglib_DATA}; do
++ for file in ${pkgdata_DATA}; do
+ if test -f "${input_dir}/${file}"; then
+ cp -f "${input_dir}/${file}" ${iso9660_dir}/boot/grub/${platform}/
+ fi
+diff --git a/util/grub-mkstandalone.in b/util/grub-mkstandalone.in
+index b0dbf9b..92b7306 100644
+--- a/util/grub-mkstandalone.in
++++ b/util/grub-mkstandalone.in
+@@ -27,7 +27,7 @@ libdir=@libdir@
+ PACKAGE_NAME=@PACKAGE_NAME@
+ PACKAGE_TARNAME=@PACKAGE_TARNAME@
+ PACKAGE_VERSION=@PACKAGE_VERSION@
+-pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst"
++pkgdata_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst"
+
+ self=`basename $0`
+
+@@ -163,7 +163,7 @@ for file in "${source_directory}/"*.mod "${source_directory}/"efiemu32.o "${sour
+ fi
+ done
+
+-for file in ${pkglib_DATA}; do
++for file in ${pkgdata_DATA}; do
+ if test -f "${source_directory}/${file}"; then
+ cp -f "${source_directory}/${file}" "${memdisk_dir}"/boot/grub/
+ fi
diff --git a/libre/grub/grub2_bzr_export.sh b/libre/grub/grub2_bzr_export.sh
new file mode 100644
index 000000000..f40588f82
--- /dev/null
+++ b/libre/grub/grub2_bzr_export.sh
@@ -0,0 +1,113 @@
+#!/bin/bash
+
+## For actual repos
+
+# bzr branch bzr://bzr.savannah.gnu.org/grub-extras/lua lua
+# bzr branch bzr://bzr.savannah.gnu.org/grub-extras/gpxe gpxe
+# bzr branch bzr://bzr.savannah.gnu.org/grub-extras/ntldr-img ntldr-img
+# bzr branch bzr://bzr.savannah.gnu.org/grub-extras/915resolution 915resolution
+
+## For launchpad mirror
+
+# bzr branch lp:~the-ridikulus-rat/grub/grub2-extras-lua lua
+# bzr branch lp:~the-ridikulus-rat/grub/grub2-extras-gpxe gpxe
+# bzr branch lp:~the-ridikulus-rat/grub/grub2-extras-ntldr-img ntldr-img
+# bzr branch lp:~the-ridikulus-rat/grub/grub2-extras-915resolution 915resolution
+
+## grub-extras zfs is integrated into grub2 bzr main repo and is no longer needed separately.
+
+_WD="${PWD}/"
+_OUTPUT_DIR="${_WD}/"
+
+_ACTUAL_PKGVER="1.99"
+
+_GRUB2_BZR_REPO_DIR="${_WD}/grub2_BZR/"
+_GRUB2_BZR_EXP_REPO_DIR="${_WD}/grub2_experimental_BZR/"
+_GRUB2_EXTRAS_REPOS_DIR="${_WD}/grub2_extras_BZR/"
+
+_MAIN_SNAPSHOT() {
+
+ cd "${_GRUB2_BZR_REPO_DIR}/"
+ echo
+
+ _REVNUM="$(bzr revno ${_GRUB2_BZR_REPO_DIR})"
+ bzr export --root="grub-${_ACTUAL_PKGVER}" --format="tar" "${_OUTPUT_DIR}/grub2_r${_REVNUM}.tar"
+ echo
+
+ cd "${_OUTPUT_DIR}/"
+
+ xz -9 "${_OUTPUT_DIR}/grub2_r${_REVNUM}.tar"
+ echo
+
+}
+
+_EXP_SNAPSHOT() {
+
+ cd "${_GRUB2_BZR_EXP_REPO_DIR}/"
+ echo
+
+ _REVNUM="$(bzr revno ${_GRUB2_BZR_EXP_REPO_DIR})"
+ bzr export --root="grub-${_ACTUAL_PKGVER}" --format="tar" "${_OUTPUT_DIR}/grub2_exp_r${_REVNUM}.tar"
+ echo
+
+ cd "${_OUTPUT_DIR}/"
+
+ xz -9 "${_OUTPUT_DIR}/grub2_exp_r${_REVNUM}.tar"
+ echo
+
+}
+
+_EXTRAS_SNAPSHOT() {
+
+ cd "${_GRUB2_EXTRAS_REPOS_DIR}/${_GRUB2_EXTRAS_NAME}/"
+ echo
+
+ _REVNUM="$(bzr revno ${_GRUB2_EXTRAS_REPOS_DIR}/${_GRUB2_EXTRAS_NAME})"
+ bzr export --root="${_GRUB2_EXTRAS_NAME}" --format=tar "${_OUTPUT_DIR}/grub2_extras_${_GRUB2_EXTRAS_NAME}_r${_REVNUM}.tar"
+ echo
+
+ cd "${_OUTPUT_DIR}/"
+ echo
+
+ xz -9 "${_OUTPUT_DIR}/grub2_extras_${_GRUB2_EXTRAS_NAME}_r${_REVNUM}.tar"
+ echo
+
+}
+
+echo
+
+set -x -e
+
+echo
+
+_MAIN_SNAPSHOT
+
+echo
+
+# _EXP_SNAPSHOT
+
+echo
+
+_GRUB2_EXTRAS_NAME="lua"
+_EXTRAS_SNAPSHOT
+
+_GRUB2_EXTRAS_NAME="gpxe"
+_EXTRAS_SNAPSHOT
+
+_GRUB2_EXTRAS_NAME="ntldr-img"
+_EXTRAS_SNAPSHOT
+
+_GRUB2_EXTRAS_NAME="915resolution"
+_EXTRAS_SNAPSHOT
+
+echo
+
+set +x +e
+
+echo
+
+unset _WD
+unset _OUTPUT_DIR
+unset _GRUB2_BZR_REPO_DIR
+unset _GRUB2_EXTRAS_REPOS_DIR
+unset _GRUB2_EXTRAS_NAME
diff --git a/libre/grub/grub_bzr_export.sh b/libre/grub/grub_bzr_export.sh
new file mode 100644
index 000000000..ff8f99ecc
--- /dev/null
+++ b/libre/grub/grub_bzr_export.sh
@@ -0,0 +1,113 @@
+#!/usr/bin/env bash
+
+## For actual repos
+
+# bzr branch bzr://bzr.savannah.gnu.org/grub-extras/lua lua
+# bzr branch bzr://bzr.savannah.gnu.org/grub-extras/gpxe gpxe
+# bzr branch bzr://bzr.savannah.gnu.org/grub-extras/ntldr-img ntldr-img
+# bzr branch bzr://bzr.savannah.gnu.org/grub-extras/915resolution 915resolution
+
+## For launchpad mirror
+
+# bzr branch lp:~the-ridikulus-rat/grub/grub-extras-lua lua
+# bzr branch lp:~the-ridikulus-rat/grub/grub-extras-gpxe gpxe
+# bzr branch lp:~the-ridikulus-rat/grub/grub-extras-ntldr-img ntldr-img
+# bzr branch lp:~the-ridikulus-rat/grub/grub-extras-915resolution 915resolution
+
+## grub-extras zfs is integrated into grub bzr main repo and is no longer needed separately.
+
+_WD="${PWD}/"
+_OUTPUT_DIR="${_WD}/"
+
+_ACTUAL_PKGVER="2.00"
+
+_GRUB_BZR_REPO_DIR="${_WD}/grub_mainline_BZR/"
+_GRUB_BZR_EXP_REPO_DIR="${_WD}/grub_experimental_BZR/"
+_GRUB_EXTRAS_REPOS_DIR="${_WD}/grub_extras_BZR/"
+
+_MAIN_SNAPSHOT() {
+
+ cd "${_GRUB_BZR_REPO_DIR}/"
+ echo
+
+ _REVNUM="$(bzr revno ${_GRUB_BZR_REPO_DIR})"
+ bzr export --root="grub-${_ACTUAL_PKGVER}" --format="tar" "${_OUTPUT_DIR}/grub_r${_REVNUM}.tar"
+ echo
+
+ cd "${_OUTPUT_DIR}/"
+
+ xz -9 "${_OUTPUT_DIR}/grub_r${_REVNUM}.tar"
+ echo
+
+}
+
+_EXP_SNAPSHOT() {
+
+ cd "${_GRUB_BZR_EXP_REPO_DIR}/"
+ echo
+
+ _REVNUM="$(bzr revno ${_GRUB_BZR_EXP_REPO_DIR})"
+ bzr export --root="grub-${_ACTUAL_PKGVER}" --format="tar" "${_OUTPUT_DIR}/grub_exp_r${_REVNUM}.tar"
+ echo
+
+ cd "${_OUTPUT_DIR}/"
+
+ xz -9 "${_OUTPUT_DIR}/grub_exp_r${_REVNUM}.tar"
+ echo
+
+}
+
+_EXTRAS_SNAPSHOT() {
+
+ cd "${_GRUB_EXTRAS_REPOS_DIR}/${_GRUB_EXTRAS_NAME}/"
+ echo
+
+ _REVNUM="$(bzr revno ${_GRUB_EXTRAS_REPOS_DIR}/${_GRUB_EXTRAS_NAME})"
+ bzr export --root="${_GRUB_EXTRAS_NAME}" --format="tar" "${_OUTPUT_DIR}/grub_extras_${_GRUB_EXTRAS_NAME}_r${_REVNUM}.tar"
+ echo
+
+ cd "${_OUTPUT_DIR}/"
+ echo
+
+ xz -9 "${_OUTPUT_DIR}/grub_extras_${_GRUB_EXTRAS_NAME}_r${_REVNUM}.tar"
+ echo
+
+}
+
+echo
+
+set -x -e
+
+echo
+
+_MAIN_SNAPSHOT
+
+echo
+
+# _EXP_SNAPSHOT
+
+echo
+
+_GRUB_EXTRAS_NAME="lua"
+_EXTRAS_SNAPSHOT
+
+# _GRUB_EXTRAS_NAME="gpxe"
+# _EXTRAS_SNAPSHOT
+
+_GRUB_EXTRAS_NAME="ntldr-img"
+_EXTRAS_SNAPSHOT
+
+_GRUB_EXTRAS_NAME="915resolution"
+_EXTRAS_SNAPSHOT
+
+echo
+
+set +x +e
+
+echo
+
+unset _WD
+unset _OUTPUT_DIR
+unset _GRUB_BZR_REPO_DIR
+unset _GRUB_EXTRAS_REPOS_DIR
+unset _GRUB_EXTRAS_NAME
diff --git a/libre/grub/grub_extras_lua_args_fix.patch b/libre/grub/grub_extras_lua_args_fix.patch
new file mode 100644
index 000000000..5cb317ce3
--- /dev/null
+++ b/libre/grub/grub_extras_lua_args_fix.patch
@@ -0,0 +1,13 @@
+diff --git a/grub-extras/lua/grub_lib.c b/grub-extras/lua/grub_lib.c
+index 9014320..055d620 100644
+--- a/grub-extras/lua/grub_lib.c
++++ b/grub-extras/lua/grub_lib.c
+@@ -466,7 +466,7 @@ grub_lua_add_menu (lua_State *state)
+ if (! p)
+ return push_result (state);
+
+- grub_normal_add_menu_entry (n, args, NULL, NULL, NULL, NULL, p, 0);
++ grub_normal_add_menu_entry (n, args, NULL, NULL, NULL, NULL, NULL, p, 0);
+ }
+ else
+ {
diff --git a/libre/grub/parabola-mkconfig.patch b/libre/grub/parabola-mkconfig.patch
new file mode 100644
index 000000000..7c18a4cc2
--- /dev/null
+++ b/libre/grub/parabola-mkconfig.patch
@@ -0,0 +1,32 @@
+diff -ru grub-1.99.orig/util/grub.d/10_linux.in grub-1.99/util/grub.d/10_linux.in
+--- grub-1.99.orig/util/grub.d/10_linux.in 2011-08-11 15:54:52.051246328 +0200
++++ grub-1.99/util/grub.d/10_linux.in 2011-08-11 15:55:41.297910793 +0200
+@@ -134,7 +134,7 @@
+
+ case x`uname -m` in
+ xi?86 | xx86_64)
+- list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* /boot/vmlinuz26-* ; do
++ list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* /boot/vmlinuz26-* /boot/vmlinuz26 ; do
+ if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
+ done` ;;
+ *)
+@@ -163,7 +163,8 @@
+ "initrd-${alt_version}" "initramfs-${alt_version}.img" \
+ "initramfs-genkernel-${version}" \
+ "initramfs-genkernel-${alt_version}" \
+- "${basename/vmlinuz/kernel}.img"; do
++ "${basename/vmlinuz/kernel}.img" \
++ "${basename/vmlinuz/initramfs}.img"; do
+ if test -e "${dirname}/${i}" ; then
+ initrd="$i"
+ break
+@@ -194,7 +195,8 @@
+ linux_entry "${OS}" "${version}" false \
+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+ for i in "initramfs-${version}-fallback.img" \
+- "${basename/vmlinuz/kernel}-fallback.img"; do
++ "${basename/vmlinuz/kernel}-fallback.img" \
++ "${basename/vmlinuz/initramfs}-fallback.img"; do
+ if test -e "${dirname}/${i}"; then
+ initrd="$i"
+ linux_entry "${OS}" "${version}" true \
diff --git a/libre/grub/parabola_grub_mkconfig_fixes.patch b/libre/grub/parabola_grub_mkconfig_fixes.patch
new file mode 100644
index 000000000..19022aec6
--- /dev/null
+++ b/libre/grub/parabola_grub_mkconfig_fixes.patch
@@ -0,0 +1,152 @@
+diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
+index 516be86..5f37db2 100644
+--- a/util/grub-mkconfig.in
++++ b/util/grub-mkconfig.in
+@@ -213,6 +213,8 @@ export GRUB_DEFAULT \
+ GRUB_THEME \
+ GRUB_GFXPAYLOAD_LINUX \
+ GRUB_DISABLE_OS_PROBER \
++ GRUB_COLOR_NORMAL \
++ GRUB_COLOR_HIGHLIGHT \
+ GRUB_INIT_TUNE \
+ GRUB_SAVEDEFAULT \
+ GRUB_ENABLE_CRYPTODISK \
+diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
+index 765bfdc..b148558 100644
+--- a/util/grub.d/00_header.in
++++ b/util/grub.d/00_header.in
+@@ -115,6 +115,14 @@ cat <<EOF
+
+ EOF
+
++if [ x$GRUB_COLOR_NORMAL != x ] && [ x$GRUB_COLOR_HIGHLIGHT != x ] ; then
++ cat << EOF
++set menu_color_normal=$GRUB_COLOR_NORMAL
++set menu_color_highlight=$GRUB_COLOR_HIGHLIGHT
++
++EOF
++fi
++
+ serial=0;
+ gfxterm=0;
+ for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index 14402e8..64c9bb5 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -31,7 +31,7 @@
+ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
+ OS=GNU/Linux
+ else
+- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
++ OS="${GRUB_DISTRIBUTOR}"
+ CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
+ fi
+
+@@ -87,6 +87,8 @@ linux_entry ()
+ case $type in
+ recovery)
+ title="$(gettext_printf "%s, with Linux %s (recovery mode)" "${os}" "${version}")" ;;
++ fallback)
++ title="$(gettext_printf "%s, with Linux %s (Fallback initramfs)" "${os}" "${version}")" ;;
+ *)
+ title="$(gettext_printf "%s, with Linux %s" "${os}" "${version}")" ;;
+ esac
+@@ -100,7 +102,7 @@ linux_entry ()
+ else
+ echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
+ fi
+- if [ x$type != xrecovery ] ; then
++ if [ x$type != xrecovery ] && [ x$type != xfallback ] ; then
+ save_default_entry | sed -e "s/^/\t/"
+ fi
+
+@@ -132,7 +134,8 @@ linux_entry ()
+ fi
+ printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
+ fi
+- message="$(gettext_printf "Loading Linux %s ..." ${version})"
++
++ message="$(gettext_printf "Loading Linux %s ..." "${version}")"
+ sed "s/^/$submenu_indentation/" << EOF
+ echo '$message'
+ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
+@@ -190,7 +193,22 @@ while [ "x$list" != "x" ] ; do
+ alt_version=`echo $version | sed -e "s,\.old$,,g"`
+ linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
+
++ if test -e "/etc/arch-release" ; then
++ if echo "${basename}" | grep -q 'vmlinuz-linux' ; then
++ version="`echo "${basename}" | sed -e 's,vmlinuz-linux,,g'`"
++
++ if [ "x${version}" = "x" ] ; then
++ version="core repo kernel"
++ else
++ version="`echo "${version}" | sed -e 's,-,,g'`"
++ version="${version} kernel"
++ fi
++ fi
++ fi
++
+ initrd=
++ initrd_arch="`echo "${basename}" | sed -e 's,vmlinuz,initramfs,g'`"
++
+ for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \
+ "initrd-${version}" "initramfs-${version}.img" \
+ "initrd.img-${alt_version}" "initrd-${alt_version}.img" \
+@@ -198,7 +216,8 @@ while [ "x$list" != "x" ] ; do
+ "initramfs-genkernel-${version}" \
+ "initramfs-genkernel-${alt_version}" \
+ "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
+- "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do
++ "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}" \
++ "${initrd_arch}.img" ; do
+ if test -e "${dirname}/${i}" ; then
+ initrd="$i"
+ break
+@@ -226,6 +245,22 @@ while [ "x$list" != "x" ] ; do
+ linux_root_device_thisversion=${GRUB_DEVICE}
+ fi
+
++ if test -e "/etc/arch-release" ; then
++ is_first_entry="false"
++
++ linux_entry "${OS}" "${version}" true \
++ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
++
++ for i in "${initrd_arch}-fallback.img" "initramfs-${version}-fallback.img" ; do
++ if test -e "${dirname}/${i}" ; then
++ initrd="${i}"
++ linux_entry "${OS}" "${version}" fallback \
++ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
++ break
++ fi
++ done
++ fi
++
+ if [ "x$is_first_entry" = xtrue ]; then
+ linux_entry "${OS}" "${version}" simple \
+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+@@ -239,8 +274,11 @@ while [ "x$list" != "x" ] ; do
+ echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
+ fi
+
++ if ! test -e "/etc/arch-release" ; then
+ linux_entry "${OS}" "${version}" advanced \
+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
++ fi
++
+ if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
+ linux_entry "${OS}" "${version}" recovery \
+ "single ${GRUB_CMDLINE_LINUX}"
+@@ -252,8 +290,10 @@ done
+
+ # If at least one kernel was found, then we need to
+ # add a closing '}' for the submenu command.
++if ! test -e "/etc/arch-release" ; then
+ if [ x"$is_first_entry" != xtrue ]; then
+ echo '}'
+ fi
++fi
+
+ echo "$title_correction_code"