* move grub configuration from grub to memtest86+ package

* rework intel ucode handling and make it work for fallback (FS#50226)
This commit is contained in:
Christian Hesse 2016-08-03 07:43:02 +00:00
parent b7cfff4062
commit 1c26892702
4 changed files with 38 additions and 87 deletions

View File

@ -1,9 +1,13 @@
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 5a78513..39bd854 100644 index de9044c..f5d3e78 100644
--- a/util/grub.d/10_linux.in --- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in
@@ -136,10 +136,12 @@ EOF @@ -133,13 +133,15 @@ linux_entry ()
if test -n "${initrd}" ; then echo '$(echo "$message" | grub_quote)'
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
EOF
- if test -n "${initrd}" ; then
+ if test -n "${initrd}" -o -n "${initrd_extra}" ; then
# TRANSLATORS: ramdisk isn't identifier. Should be translated. # TRANSLATORS: ramdisk isn't identifier. Should be translated.
message="$(gettext_printf "Loading initial ramdisk ...")" message="$(gettext_printf "Loading initial ramdisk ...")"
- sed "s/^/$submenu_indentation/" << EOF - sed "s/^/$submenu_indentation/" << EOF
@ -12,43 +16,37 @@ index 5a78513..39bd854 100644
-EOF -EOF
+ printf ' %s\n' "echo '$(echo "$message" | grub_quote)'" | sed "s/^/$submenu_indentation/" + printf ' %s\n' "echo '$(echo "$message" | grub_quote)'" | sed "s/^/$submenu_indentation/"
+ printf ' %s ' 'initrd' | sed "s/^/$submenu_indentation/" + printf ' %s ' 'initrd' | sed "s/^/$submenu_indentation/"
+ for i in ${initrd}; do + for i in ${initrd_extra} ${initrd}; do
+ printf ' %s/%s' "${rel_dirname}" "${i}" + printf ' %s/%s' "${rel_dirname}" "${i}"
+ done + done
+ printf '\n' + printf '\n'
fi fi
sed "s/^/$submenu_indentation/" << EOF sed "s/^/$submenu_indentation/" << EOF
} }
@@ -189,6 +191,11 @@ while [ "x$list" != "x" ] ; do @@ -202,6 +204,12 @@ while [ "x$list" != "x" ] ; do
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
initrd=
+ for i in intel-ucode.img; do
+ if test -e "${dirname}/${i}" ; then
+ initrd+=" ${i}"
+ fi
+ done
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 +205,7 @@ while [ "x$list" != "x" ] ; do
"initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
"initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do
if test -e "${dirname}/${i}" ; then
- initrd="$i"
+ initrd+=" $i"
break break
fi fi
done done
@@ -217,7 +224,7 @@ while [ "x$list" != "x" ] ; do + initrd_extra=
+ for i in intel-ucode.img; do
+ if test -e "${dirname}/${i}" ; then
+ initrd_extra+=" ${i}"
+ fi
+ done
config=
for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
@@ -216,8 +224,8 @@ while [ "x$list" != "x" ] ; do
initramfs=`grep CONFIG_INITRAMFS_SOURCE= "${config}" | cut -f2 -d= | tr -d \"`
fi fi
if test -n "${initrd}" ; then - if test -n "${initrd}" ; then
- gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2 - gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2
+ gettext_printf "Found initrd image(s) in %s:%s\n" "${dirname}" "${initrd}" >&2 + if test -n "${initrd}" -o -n "${initrd_extra}" ; then
+ gettext_printf "Found initrd image(s) in %s:%s\n" "${dirname}" "${initrd_extra} ${initrd}" >&2
elif test -z "${initramfs}" ; then elif test -z "${initramfs}" ; then
# "UUID=" and "ZFS=" magic is parsed by initrd or initramfs. Since there's # "UUID=" and "ZFS=" magic is parsed by initrd or initramfs. Since there's
# no initrd or builtin initramfs, it can't work here. # no initrd or builtin initramfs, it can't work here.
-- --
2.7.1 2.9.2

View File

@ -1,18 +1,8 @@
From b470ffd22e43acc7c11231180187a720efd88de1 Mon Sep 17 00:00:00 2001
From: Keshav Amburay <the.ridikulus.rat@gmail.com>
Date: Sat, 5 Apr 2014 20:40:51 -0400
Subject: [PATCH] 10_linux: Detect Arch Linux main and fallback initramfs
images
---
util/grub.d/10_linux.in | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 00d1931..7d4086b 100644 index f5d3e78..ef59c8c 100644
--- a/util/grub.d/10_linux.in --- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in
@@ -81,6 +81,8 @@ linux_entry () @@ -83,6 +83,8 @@ linux_entry ()
case $type in case $type in
recovery) recovery)
title="$(gettext_printf "%s, with Linux %s (recovery mode)" "${os}" "${version}")" ;; title="$(gettext_printf "%s, with Linux %s (recovery mode)" "${os}" "${version}")" ;;
@ -21,7 +11,7 @@ index 00d1931..7d4086b 100644
*) *)
title="$(gettext_printf "%s, with Linux %s" "${os}" "${version}")" ;; title="$(gettext_printf "%s, with Linux %s" "${os}" "${version}")" ;;
esac esac
@@ -180,7 +182,7 @@ while [ "x$list" != "x" ] ; do @@ -186,7 +188,7 @@ while [ "x$list" != "x" ] ; do
basename=`basename $linux` basename=`basename $linux`
dirname=`dirname $linux` dirname=`dirname $linux`
rel_dirname=`make_system_path_relative_to_its_root $dirname` rel_dirname=`make_system_path_relative_to_its_root $dirname`
@ -30,25 +20,25 @@ index 00d1931..7d4086b 100644
alt_version=`echo $version | sed -e "s,\.old$,,g"` alt_version=`echo $version | sed -e "s,\.old$,,g"`
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
@@ -236,6 +238,18 @@ while [ "x$list" != "x" ] ; do @@ -248,6 +250,18 @@ while [ "x$list" != "x" ] ; do
linux_entry "${OS}" "${version}" advanced \ linux_entry "${OS}" "${version}" advanced \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+ +
+ if test -e "${dirname}/initramfs-${version}-fallback.img" ; then + if test -e "${dirname}/initramfs-${version}-fallback.img" ; then
+ initrd="initramfs-${version}-fallback.img" + initrd="initramfs-${version}-fallback.img"
+ +
+ if test -n "${initrd}" ; then + if test -n "${initrd}" ; then
+ gettext_printf "Found fallback initramfs image: %s\n" "${dirname}/${initrd}" >&2 + gettext_printf "Found fallback initrd image(s) in %s:%s\n" "${dirname}" "${initrd_extra} ${initrd}" >&2
+ fi + fi
+ +
+ linux_entry "${OS}" "${version}" fallback \ + linux_entry "${OS}" "${version}" fallback \
+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" + "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+ fi + fi
+ +
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
linux_entry "${OS}" "${version}" recovery \ linux_entry "${OS}" "${version}" recovery \
"single ${GRUB_CMDLINE_LINUX}" "single ${GRUB_CMDLINE_LINUX}"
-- --
1.9.1 2.9.2

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bash
########################################################
# 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
_GRUB_MEMTEST_HINTS_STRING="$(${grub_probe} --target=hints_string ${MEMTEST86_IMAGE})"
_GRUB_MEMTEST_FS_UUID="$(${grub_probe} --target=fs_uuid ${MEMTEST86_IMAGE})"
_GRUB_MEMTEST_REL_PATH="$(make_system_path_relative_to_its_root ${MEMTEST86_IMAGE})"
cat << EOF
if [ "\${grub_platform}" == "pc" ]; then
menuentry "Memory Tester (memtest86+)" ${CLASS} {
search --fs-uuid --no-floppy --set=root ${_GRUB_MEMTEST_HINTS_STRING} ${_GRUB_MEMTEST_FS_UUID}
linux16 ${_GRUB_MEMTEST_REL_PATH} ${GRUB_CMDLINE_MEMTEST86}
}
fi
EOF
fi

View File

@ -23,7 +23,7 @@ _UNIFONT_VER="6.3.20131217"
pkgname="grub" pkgname="grub"
pkgdesc="GNU GRand Unified Bootloader (2)" pkgdesc="GNU GRand Unified Bootloader (2)"
pkgver=2.02.beta3 pkgver=2.02.beta3
pkgrel=1 pkgrel=2
epoch=1 epoch=1
url="https://www.gnu.org/software/grub/" url="https://www.gnu.org/software/grub/"
arch=('x86_64' 'i686') arch=('x86_64' 'i686')
@ -61,7 +61,6 @@ source=("grub-${_pkgver}::git+git://git.sv.gnu.org/grub.git#tag=${_GRUB_GIT_TAG}
'0002-intel-ucode.patch' '0002-intel-ucode.patch'
'0003-10_linux-detect-archlinux-initramfs.patch' '0003-10_linux-detect-archlinux-initramfs.patch'
'0004-add-GRUB_COLOR_variables.patch' '0004-add-GRUB_COLOR_variables.patch'
'60_memtest86+'
'grub.default' 'grub.default'
'grub.cfg') 'grub.cfg')
@ -70,10 +69,9 @@ md5sums=('SKIP'
'728b7439ac733a7c0d56049adec364c7' '728b7439ac733a7c0d56049adec364c7'
'SKIP' 'SKIP'
'9589ec46a04f9bb4d5da987340a4a324' '9589ec46a04f9bb4d5da987340a4a324'
'e582a1ca6b06444e891f3b46af13d563' 'ff3b8524983ce02fc48fce38f96b1a82'
'945527e0de8d384166a4cf23439ae9ee' 'ba9d27c44b677bf329e5b96933bdbde8'
'e506ae4a9f9f7d1b765febfa84e10d48' 'e506ae4a9f9f7d1b765febfa84e10d48'
'be55eabc102f2c60b38ed35c203686d6'
'a03ffd56324520393bf574cefccb893d' 'a03ffd56324520393bf574cefccb893d'
'c8b9511586d57d6f2524ae7898397a46') 'c8b9511586d57d6f2524ae7898397a46')
validpgpkeys=('95D2E9AB8740D8046387FD151A09227B1F435A33') #Paul Hardy validpgpkeys=('95D2E9AB8740D8046387FD151A09227B1F435A33') #Paul Hardy
@ -320,9 +318,6 @@ _package_grub-common_and_bios() {
rm -f "${pkgdir}/usr/lib/grub/i386-pc"/*.image || 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 rm -f "${pkgdir}/usr/lib/grub/i386-pc"/{kernel.exec,gdb_grub,gmodule.pl} || true
msg "Install extra /etc/grub.d/ files"
install -D -m0755 "${srcdir}/60_memtest86+" "${pkgdir}/etc/grub.d/60_memtest86+"
msg "Install /etc/default/grub (used by grub-mkconfig)" msg "Install /etc/default/grub (used by grub-mkconfig)"
install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub" install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"