From 1c268927020d5ee37055250ee3de3ce4fdae23eb Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 3 Aug 2016 07:43:02 +0000 Subject: [PATCH] * move grub configuration from grub to memtest86+ package * rework intel ucode handling and make it work for fallback (FS#50226) --- 0002-intel-ucode.patch | 50 +++++++++---------- ...-10_linux-detect-archlinux-initramfs.patch | 32 ++++-------- 60_memtest86+ | 32 ------------ PKGBUILD | 11 ++-- 4 files changed, 38 insertions(+), 87 deletions(-) delete mode 100644 60_memtest86+ diff --git a/0002-intel-ucode.patch b/0002-intel-ucode.patch index d6277d5..bd20fa2 100644 --- a/0002-intel-ucode.patch +++ b/0002-intel-ucode.patch @@ -1,9 +1,13 @@ 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 +++ b/util/grub.d/10_linux.in -@@ -136,10 +136,12 @@ EOF - if test -n "${initrd}" ; then +@@ -133,13 +133,15 @@ linux_entry () + 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. message="$(gettext_printf "Loading initial ramdisk ...")" - sed "s/^/$submenu_indentation/" << EOF @@ -12,43 +16,37 @@ index 5a78513..39bd854 100644 -EOF + printf ' %s\n' "echo '$(echo "$message" | grub_quote)'" | 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}" + done + printf '\n' fi sed "s/^/$submenu_indentation/" << EOF } -@@ -189,6 +191,11 @@ 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" +@@ -202,6 +204,12 @@ while [ "x$list" != "x" ] ; do break fi 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 - 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) 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 # "UUID=" and "ZFS=" magic is parsed by initrd or initramfs. Since there's # no initrd or builtin initramfs, it can't work here. -- -2.7.1 +2.9.2 diff --git a/0003-10_linux-detect-archlinux-initramfs.patch b/0003-10_linux-detect-archlinux-initramfs.patch index 18d9d52..5cbd19f 100644 --- a/0003-10_linux-detect-archlinux-initramfs.patch +++ b/0003-10_linux-detect-archlinux-initramfs.patch @@ -1,18 +1,8 @@ -From b470ffd22e43acc7c11231180187a720efd88de1 Mon Sep 17 00:00:00 2001 -From: Keshav Amburay -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 -index 00d1931..7d4086b 100644 +index f5d3e78..ef59c8c 100644 --- a/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 recovery) 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}")" ;; esac -@@ -180,7 +182,7 @@ while [ "x$list" != "x" ] ; do +@@ -186,7 +188,7 @@ while [ "x$list" != "x" ] ; do basename=`basename $linux` dirname=`dirname $linux` 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"` 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 \ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" -+ ++ + if test -e "${dirname}/initramfs-${version}-fallback.img" ; then + initrd="initramfs-${version}-fallback.img" -+ ++ + 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 -+ ++ + linux_entry "${OS}" "${version}" fallback \ -+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" ++ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" + fi -+ ++ if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then linux_entry "${OS}" "${version}" recovery \ "single ${GRUB_CMDLINE_LINUX}" -- -1.9.1 +2.9.2 diff --git a/60_memtest86+ b/60_memtest86+ deleted file mode 100644 index 086f0cc..0000000 --- a/60_memtest86+ +++ /dev/null @@ -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 diff --git a/PKGBUILD b/PKGBUILD index d2ce45c..23b9da3 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -23,7 +23,7 @@ _UNIFONT_VER="6.3.20131217" pkgname="grub" pkgdesc="GNU GRand Unified Bootloader (2)" pkgver=2.02.beta3 -pkgrel=1 +pkgrel=2 epoch=1 url="https://www.gnu.org/software/grub/" 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' '0003-10_linux-detect-archlinux-initramfs.patch' '0004-add-GRUB_COLOR_variables.patch' - '60_memtest86+' 'grub.default' 'grub.cfg') @@ -70,10 +69,9 @@ md5sums=('SKIP' '728b7439ac733a7c0d56049adec364c7' 'SKIP' '9589ec46a04f9bb4d5da987340a4a324' - 'e582a1ca6b06444e891f3b46af13d563' - '945527e0de8d384166a4cf23439ae9ee' + 'ff3b8524983ce02fc48fce38f96b1a82' + 'ba9d27c44b677bf329e5b96933bdbde8' 'e506ae4a9f9f7d1b765febfa84e10d48' - 'be55eabc102f2c60b38ed35c203686d6' 'a03ffd56324520393bf574cefccb893d' 'c8b9511586d57d6f2524ae7898397a46') 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"/{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)" install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"