summaryrefslogtreecommitdiff
path: root/libre/grub2
diff options
context:
space:
mode:
Diffstat (limited to 'libre/grub2')
-rw-r--r--libre/grub2/05_archtheme6
-rw-r--r--libre/grub2/20_memtest86+27
-rw-r--r--libre/grub2/PKGBUILD204
-rw-r--r--libre/grub2/archlinux_grub2_mkconfig_fixes.patch93
-rw-r--r--libre/grub2/grub.cfg26
-rw-r--r--libre/grub2/grub.default42
-rw-r--r--libre/grub2/grub2.install30
7 files changed, 428 insertions, 0 deletions
diff --git a/libre/grub2/05_archtheme b/libre/grub2/05_archtheme
new file mode 100644
index 000000000..4d1b6fb20
--- /dev/null
+++ b/libre/grub2/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/grub2/20_memtest86+ b/libre/grub2/20_memtest86+
new file mode 100644
index 000000000..41ca11f02
--- /dev/null
+++ b/libre/grub2/20_memtest86+
@@ -0,0 +1,27 @@
+#! /bin/sh -e
+########################################################
+# This script generates a memtest86+ entry on grub.cfg #
+# if memtest is installed on the system. #
+########################################################
+
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+
+. ${libdir}/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/grub2/PKGBUILD b/libre/grub2/PKGBUILD
new file mode 100644
index 000000000..6d884dcea
--- /dev/null
+++ b/libre/grub2/PKGBUILD
@@ -0,0 +1,204 @@
+# Maintainer: Ronald van Haren <ronald.archlinux.org>
+# Contributor: Keshav P R <skodabenz at rocketmail dot com>
+
+# _grub2_rev=3072
+
+_grub2_lua_ver=19
+_grub2_gpxe_ver=12
+_grub2_ntldr_ver=13
+_grub2_915_ver=6
+
+pkgname=('grub2-common' 'grub2-bios' 'grub2-efi-i386')
+pkgbase="grub2"
+pkgver='1.99~rc1'
+pkgrel=4
+url="http://www.gnu.org/software/grub/"
+arch=('i686' 'x86_64')
+license=('GPL3')
+makedepends=('bdf-unifont' 'python2' 'xz' 'autogen' 'texinfo' 'help2man' 'gettext' 'device-mapper')
+options=(strip purge docs zipman !emptydirs)
+
+source=("ftp://alpha.gnu.org/gnu/grub/grub-${pkgver}.tar.gz"
+ "ftp://ftp.archlinux.org/other/grub2/grub2_extras_lua_r${_grub2_lua_ver}.tar.xz"
+ "ftp://ftp.archlinux.org/other/grub2/grub2_extras_gpxe_r${_grub2_gpxe_ver}.tar.xz"
+ "ftp://ftp.archlinux.org/other/grub2/grub2_extras_ntldr-img_r${_grub2_ntldr_ver}.tar.xz"
+ "ftp://ftp.archlinux.org/other/grub2/grub2_extras_915resolution_r${_grub2_915_ver}.tar.xz"
+ 'archlinux_grub2_mkconfig_fixes.patch'
+ 'grub.default'
+ 'grub.cfg'
+ '20_memtest86+'
+ '05_archtheme')
+
+noextract=("grub2_extras_lua_r${_grub2_lua_ver}.tar.xz"
+ "grub2_extras_gpxe_r${_grub2_gpxe_ver}.tar.xz"
+ "grub2_extras_ntldr-img_r${_grub2_ntldr_ver}.tar.xz"
+ "grub2_extras_915resolution_r${_grub2_915_ver}.tar.xz")
+
+
+build() {
+ # set architecture dependent variables
+ if [ "${CARCH}" = "x86_64" ] ; then
+ _EFIEMU="--enable-efiemu"
+ else
+ _EFIEMU="--disable-efiemu"
+ fi
+ _HOST="${CARCH}"
+
+ build_grub2-common_and_bios
+ build_grub2-efi
+}
+
+build_grub2-common_and_bios() {
+ # copy the source for building the common/bios package
+ cp -r ${srcdir}/grub-${pkgver} ${srcdir}/grub2_bios-${pkgver}
+
+ ## Apply Archlinux specific fixes to enable grub2-mkconfig detect Arch kernels and initramfs
+ cd ${srcdir}/grub2_bios-${pkgver}
+ patch -Np1 -i ${srcdir}/archlinux_grub2_mkconfig_fixes.patch
+
+ # add the grub-extra sources
+ export GRUB_CONTRIB=${srcdir}/grub2_bios-${pkgver}/grub2-extras/
+ install -d ${srcdir}/grub2_bios-${pkgver}/grub2-extras
+ bsdtar xf ${srcdir}/grub2_extras_lua_r${_grub2_lua_ver}.tar.xz \
+ -C ${srcdir}/grub2_bios-${pkgver}/grub2-extras
+ bsdtar xf ${srcdir}/grub2_extras_gpxe_r${_grub2_gpxe_ver}.tar.xz \
+ -C ${srcdir}/grub2_bios-${pkgver}/grub2-extras
+ bsdtar xf ${srcdir}/grub2_extras_ntldr-img_r${_grub2_ntldr_ver}.tar.xz \
+ -C ${srcdir}/grub2_bios-${pkgver}/grub2-extras
+ bsdtar xf ${srcdir}/grub2_extras_915resolution_r${_grub2_915_ver}.tar.xz \
+ -C ${srcdir}/grub2_bios-${pkgver}/grub2-extras
+
+ ## Need to use python2
+ sed -i 's|python|python2|' ${srcdir}/grub2_bios-${pkgver}/autogen.sh
+
+ # start the actual build process
+ cd ${srcdir}/grub2_bios-${pkgver}
+ ./autogen.sh
+
+ ## fix unifont.bdf location so grub-mkfont can create *.pf2 files
+ sed -i 's|/usr/share/fonts/unifont|/usr/share/fonts/misc|' ${srcdir}/grub2_bios-${pkgver}/configure
+
+# mkdir ${srcdir}/grub2_bios-${pkgver}/BUILD_BIOS
+# cd ${srcdir}/grub2_bios-${pkgver}/BUILD_BIOS
+
+ CFLAGS="" ./configure \
+ --with-platform=pc --enable-mm-debug \
+ ${_EFIEMU} --host=${CARCH}-unknown-linux-gnu \
+ --enable-grub-mkfont --prefix=/usr \
+ --bindir=/bin --sbindir=/sbin \
+ --mandir=/usr/share/man --infodir=/usr/share/info \
+ --sysconfdir=/etc --enable-nls \
+ --program-transform-name=s,grub,grub,
+ CFLAGS="" make
+}
+
+build_grub2-efi() {
+ # copy the source for building the efi package
+ cp -r ${srcdir}/grub-${pkgver} ${srcdir}/grub2_efi-${pkgver}
+
+ # add the grub-extra sources
+ export GRUB_CONTRIB=${srcdir}/grub2_efi-${pkgver}/grub2-extras/
+ install -d ${srcdir}/grub2_efi-${pkgver}/grub2-extras
+ bsdtar xf ${srcdir}/grub2_extras_lua_r${_grub2_lua_ver}.tar.xz \
+ -C ${srcdir}/grub2_efi-${pkgver}/grub2-extras
+ bsdtar xf ${srcdir}/grub2_extras_gpxe_r${_grub2_gpxe_ver}.tar.xz \
+ -C ${srcdir}/grub2_efi-${pkgver}/grub2-extras
+
+ ## Need to use python2
+ sed -i 's|python|python2|' ${srcdir}/grub2_efi-${pkgver}/autogen.sh
+
+ # start the actual build process
+ cd ${srcdir}/grub2_efi-${pkgver}
+ ./autogen.sh
+
+ CFLAGS="" ./configure \
+ --with-platform=efi --target=i386 \
+ --enable-mm-debug --disable-efiemu \
+ --host=${CARCH}-unknown-linux-gnu \
+ --prefix=/usr --bindir=/bin \
+ --sbindir=/sbin --mandir=/usr/share/man \
+ --infodir=/usr/share/info --sysconfdir=/etc \
+ --enable-nls --program-transform-name=s,grub,grub,
+ CFLAGS="" make
+}
+
+package_grub2-common() {
+ pkgdesc="The GNU GRand Unified Bootloader version 2 - Files common for all platforms"
+ install="grub2.install"
+ depends=('xz' 'freetype2' 'device-mapper')
+ conflicts=('grub')
+ backup=('boot/grub/grub.cfg' 'etc/default/grub' 'etc/grub.d/40_custom')
+ cd ${srcdir}/grub2_bios-${pkgver}
+ make DESTDIR=${pkgdir} install
+
+ ## install grub2-extras ntldr-img's grubinst as /sbin/grubinst
+ install -Dm755 ${srcdir}/grub2_bios-${pkgver}/grub-core/grubinst ${pkgdir}/sbin/grubinst
+
+ install -Dm755 ${pkgdir}/sbin/grub-install ${pkgdir}/sbin/grub_bios-install
+ install -Dm755 ${pkgdir}/sbin/grub-install ${pkgdir}/sbin/grub_efi_x86_64-install
+ install -Dm755 ${pkgdir}/sbin/grub-install ${pkgdir}/sbin/grub_efi_i386-install
+
+ sed -i "s|^\(target_cpu\)=.*|\1=i386|; \
+ s|^\(platform\)=.*|\1=pc|" \
+ ${pkgdir}/sbin/grub_bios-install
+
+ sed -i "s|^\(target_cpu\)=.*|\1=x86_64|; \
+ s|^\(platform\)=.*|\1=efi|" \
+ ${pkgdir}/sbin/grub_efi_x86_64-install
+
+ sed -i "s|^\(target_cpu\)=.*|\1=i386|; \
+ s|^\(platform\)=.*|\1=efi|" \
+ ${pkgdir}/sbin/grub_efi_i386-install
+
+ ## install extra /etc/grub.d/ files
+ install -Dm755 ${srcdir}/05_archtheme ${pkgdir}/etc/grub.d/05_archtheme
+ install -Dm755 ${srcdir}/20_memtest86+ ${pkgdir}/etc/grub.d/20_memtest86+
+
+ ## install /etc/default/grub (used by grub-mkconfig)
+ install -Dm644 ${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 -Dm644 ${srcdir}/grub.cfg ${pkgdir}/boot/grub/grub.cfg
+
+ # remove platform specific files
+ rm -rf ${pkgdir}/usr/lib/grub/i386-pc/
+}
+
+package_grub2-bios() {
+ pkgdesc="The GNU GRand Unified Bootloader version 2 - Built for PC BIOS"
+ depends=(grub2-common=${pkgver})
+ replaces=('grub2')
+ provides=('grub2')
+
+ cd ${srcdir}/grub2_bios-${pkgver}
+ make DESTDIR=${pkgdir} install
+
+ ## remove non platform-specific files
+ rm -rf ${pkgdir}/{boot,bin,sbin,etc,usr/share}
+ rm ${pkgdir}/usr/lib/grub/{grub-mkconfig_lib,update-grub_lib}
+}
+
+package_grub2-efi-i386() {
+
+ pkgdesc="The GNU GRand Unified Bootloader version 2 - i386 UEFI version"
+ depends=("grub2-common=${pkgver}" 'dosfstools')
+ optdepends=('efibootmgr')
+
+ cd ${srcdir}/grub2_efi-${pkgver}
+ make DESTDIR=${pkgdir} install
+
+ ## remove non platform-specific files
+ rm -rf ${pkgdir}/{boot,bin,sbin,etc,usr/share}
+ rm ${pkgdir}/usr/lib/grub/{grub-mkconfig_lib,update-grub_lib}
+}
+
+md5sums=('fd602ffaada5ba7939d0ea47091841a5'
+ '21b709f119e0bef1c51978d757e885dc'
+ '9e0944f3e63586dc4242fd8b7977e3c4'
+ '0a124ffc9835100ba0e7de7a0ac1c389'
+ '0016761d429e6a77b90d09ed6ee8a47d'
+ '93f0f96911451e86014e04f96e13462f'
+ '50123c37cf145a98aba4ffb0fc4efba1'
+ '7cb90ebb04b856ded6ae171c3658fba2'
+ '5a07e04c4ecb8ed145d54fec3043e0d5'
+ 'e143ae2e453b7c3ced309667df30da55')
diff --git a/libre/grub2/archlinux_grub2_mkconfig_fixes.patch b/libre/grub2/archlinux_grub2_mkconfig_fixes.patch
new file mode 100644
index 000000000..62acd2ee8
--- /dev/null
+++ b/libre/grub2/archlinux_grub2_mkconfig_fixes.patch
@@ -0,0 +1,93 @@
+diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
+index b041a38..6f31dce 100644
+--- a/util/grub-mkconfig.in
++++ b/util/grub-mkconfig.in
+@@ -252,6 +252,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_BADRAM
+diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
+index 420b3f3..79fd4fb 100644
+--- a/util/grub.d/00_header.in
++++ b/util/grub.d/00_header.in
+@@ -100,6 +100,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 a09c3e6..cf12ea9 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -31,8 +31,8 @@ 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) ${CLASS}"
++ OS="${GRUB_DISTRIBUTOR}"
++ CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]' | tr -d ' ') ${CLASS}"
+ fi
+
+ # loop-AES arranges things so that /dev/loop/X can be our root device, but
+@@ -48,7 +48,7 @@ if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue"
+ || uses_abstraction "${GRUB_DEVICE}" lvm; then
+ LINUX_ROOT_DEVICE=${GRUB_DEVICE}
+ else
+- LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
++ LINUX_ROOT_DEVICE="/dev/disk/by-uuid/${GRUB_DEVICE_UUID}"
+ fi
+
+ linux_entry ()
+@@ -111,7 +111,7 @@ EOF
+ EOF
+ }
+
+-list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* ; do
++list=`for i in /boot/vmlinuz* /boot/vmlinux* /vmlinuz* /vmlinux* ; do
+ if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
+ done`
+ prepare_boot_cache=
+@@ -123,14 +123,12 @@ while [ "x$list" != "x" ] ; do
+ dirname=`dirname $linux`
+ rel_dirname=`make_system_path_relative_to_its_root $dirname`
+ version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
+- alt_version=`echo $version | sed -e "s,\.old$,,g"`
++ base_init=`echo $basename | sed -e "s,vmlinuz,kernel,g"`
++ alt_version="${base_init}-fallback"
+ linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
+
+ initrd=
+- for i in "initrd.img-${version}" "initrd-${version}.img" \
+- "initrd-${version}" "initramfs-${version}.img" \
+- "initrd.img-${alt_version}" "initrd-${alt_version}.img" \
+- "initrd-${alt_version}" "initramfs-${alt_version}.img"; do
++ for i in "${base_init}.img"; do
+ if test -e "${dirname}/${i}" ; then
+ initrd="$i"
+ break
+@@ -155,6 +153,9 @@ while [ "x$list" != "x" ] ; do
+
+ linux_entry "${OS}" "${version}" false \
+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
++ initrd="${alt_version}.img"
++ linux_entry "${OS}" "${version} Fallback" false \
++ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+ if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
+ linux_entry "${OS}" "${version}" true \
+ "single ${GRUB_CMDLINE_LINUX}"
diff --git a/libre/grub2/grub.cfg b/libre/grub2/grub.cfg
new file mode 100644
index 000000000..1f0e41471
--- /dev/null
+++ b/libre/grub2/grub.cfg
@@ -0,0 +1,26 @@
+# Config file for GRUB2 - The GNU GRand Unified Bootloader
+# /boot/grub/grub.cfg
+
+# DEVICE NAME CONVERSIONS
+#
+# Linux Grub
+# -------------------------
+# /dev/fd0 (fd0)
+# /dev/sda (hd0)
+# /dev/sdb2 (hd1,2)
+# /dev/sda3 (hd0,3)
+#
+
+# Timeout for menu
+set timeout=5
+
+# Set default boot entry as Entry 0
+set default=0
+
+# (0) Parabola GNU/Linux-libre
+menuentry "Parabola GNU/Linux-libre" {
+set root=(hd0,1)
+linux /vmlinuz26 root=/dev/sda1 ro
+initrd /kernel26.img
+}
+
diff --git a/libre/grub2/grub.default b/libre/grub2/grub.default
new file mode 100644
index 000000000..8302bdb3f
--- /dev/null
+++ b/libre/grub2/grub.default
@@ -0,0 +1,42 @@
+# If you change this file, run 'update-grub' afterwards to update
+# /boot/grub/grub.cfg.
+
+GRUB_DEFAULT=0
+GRUB_TIMEOUT=5
+GRUB_DISTRIBUTOR="Arch Linux"
+GRUB_CMDLINE_LINUX_DEFAULT="quiet"
+GRUB_CMDLINE_LINUX=""
+
+# Uncomment to enable Hidden Menu, and optionally hide the timeout count
+#GRUB_HIDDEN_TIMEOUT=5
+#GRUB_HIDDEN_TIMEOUT_QUIET=true
+
+# Uncomment to disable graphical terminal
+#GRUB_TERMINAL=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=1024x768x24
+
+# 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="light-blue/black"
+GRUB_COLOR_HIGHLIGHT="light-cyan/blue"
+
+# 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"
diff --git a/libre/grub2/grub2.install b/libre/grub2/grub2.install
new file mode 100644
index 000000000..898dc9246
--- /dev/null
+++ b/libre/grub2/grub2.install
@@ -0,0 +1,30 @@
+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
+
+ echo -n "Generating grub.cfg.example config file... "
+ grub-mkconfig -o /boot/grub/grub.cfg.example 2> /dev/null
+ echo "done."
+
+cat << EOF
+ An example config file is created at /boot/grub/grub.cfg.example
+
+ For more information and additional config settings please see http://wiki.archlinux.org/index.php/GRUB2
+
+EOF
+
+}
+
+
+post_upgrade() {
+cat << EOF
+ An example config file is created at /boot/grub/grub.cfg.example
+
+ For more information and additional config settings please see http://wiki.archlinux.org/index.php/GRUB2
+
+EOF
+}
+