Received: from list by lists.gnu.org with archive (Exim 4.71) id 1aSk2F-0001qn-Fb for mharc-grub-devel@gnu.org; Mon, 08 Feb 2016 06:31:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aShE2-0008OG-NP for grub-devel@gnu.org; Mon, 08 Feb 2016 03:31:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aShE1-0003IO-JT for grub-devel@gnu.org; Mon, 08 Feb 2016 03:31:14 -0500 Received: from mx.mylinuxtime.de ([2a01:4f8:202:62a9:5054:ff:fe05:a137]:40266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aShE1-0003ID-A7 for grub-devel@gnu.org; Mon, 08 Feb 2016 03:31:13 -0500 Received: from leda.eworm.de (unknown [10.10.1.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx.mylinuxtime.de (Postfix) with ESMTPSA id 2FDC425A06; Mon, 8 Feb 2016 09:31:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.9.2 mx.mylinuxtime.de 2FDC425A06 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eworm.de; s=mail; t=1454920272; bh=PJE5Ve8qqgqcvzCjMiL6m+pv5D7VK/wSjdAcgGFgFU8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jK7ZW/TFH6pKLW7yJgAac/VG4jg+UUPX87llJ/ePPjQRpp7uw9eUmr3u5mCWcN0Pr U1IJbinJ4ln8Unbp/aRO+N1zUsJVimmJllBWAcabLte7Gvz61BHBPYMgsb7pfOni4U XXhJmhnrvIl+O53wdYor2NMjK8eEqUaRhmtS0nZk= Received: by leda.eworm.de (Postfix, from userid 1000) id 0894B10170E; Mon, 8 Feb 2016 09:31:07 +0100 (CET) From: Christian Hesse To: The development of GNU GRUB Subject: [PATCH v2 1/1] support loading of custom initrd images Date: Mon, 8 Feb 2016 09:30:40 +0100 Message-Id: <1454920240-1345-1-git-send-email-mail@eworm.de> X-Mailer: git-send-email 2.7.1 In-Reply-To: <20160205184450.197ddab7@leda.localdomain> References: <20160205184450.197ddab7@leda.localdomain> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:4f8:202:62a9:5054:ff:fe05:a137 X-Mailman-Approved-At: Mon, 08 Feb 2016 06:31:14 -0500 Cc: Christian Hesse X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Feb 2016 08:31:15 -0000 Signed-off-by: Christian Hesse --- docs/grub.texi | 6 ++++++ util/grub-mkconfig.in | 1 + util/grub.d/10_linux.in | 19 +++++++++++++------ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/docs/grub.texi b/docs/grub.texi index 0afdd8c..f65647c 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -1398,6 +1398,12 @@ for all respectively normal entries. The values of these options replace the values of @samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT} for Linux and Xen menu entries. +@item GRUB_CUSTOM_INITRD +Give custom initrd images to be loaded in addition to the initrd image +found for the kernel. One use case is to load Intel ucode image. + +This expects a space separated list of initrd images in @samp{/boot}. + @item GRUB_DISABLE_LINUX_UUID Normally, @command{grub-mkconfig} will generate menu entries that use universally-unique identifiers (UUIDs) to identify the root filesystem to diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in index 3183744..bbe9e62 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -211,6 +211,7 @@ export GRUB_DEFAULT \ GRUB_CMDLINE_NETBSD \ GRUB_CMDLINE_NETBSD_DEFAULT \ GRUB_CMDLINE_GNUMACH \ + GRUB_CUSTOM_INITRD \ GRUB_TERMINAL_INPUT \ GRUB_TERMINAL_OUTPUT \ GRUB_SERIAL_COMMAND \ diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in index 5a78513..39bd854 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 # TRANSLATORS: ramdisk isn't identifier. Should be translated. message="$(gettext_printf "Loading initial ramdisk ...")" - sed "s/^/$submenu_indentation/" << EOF - echo '$(echo "$message" | grub_quote)' - initrd ${rel_dirname}/${initrd} -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 + 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 ${GRUB_CUSTOM_INITRD}; 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 fi done @@ -217,7 +224,7 @@ while [ "x$list" != "x" ] ; do fi 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 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