Received: from list by lists.gnu.org with archive (Exim 4.71) id 1aRkRT-0002zq-37 for mharc-grub-devel@gnu.org; Fri, 05 Feb 2016 12:45:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60863) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRkRP-0002uH-Us for grub-devel@gnu.org; Fri, 05 Feb 2016 12:45:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRkRM-0003Ft-QI for grub-devel@gnu.org; Fri, 05 Feb 2016 12:45:07 -0500 Received: from mx.mylinuxtime.de ([148.251.109.235]:50364) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRkRM-0003Ec-E3 for grub-devel@gnu.org; Fri, 05 Feb 2016 12:45:04 -0500 Received: from leda.localdomain (unknown [IPv6:2001:470:1f0b:a5b:6257:18ff:fe7f:1598]) (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 6D891259C5; Fri, 5 Feb 2016 18:44:56 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.9.2 mx.mylinuxtime.de 6D891259C5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eworm.de; s=mail; t=1454694296; bh=TRzQZUV0hJ5w+3sjPI5uTpk4N/JvGvQgqt4dqiVIJM0=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=LF45BVzAGZgDEmz1kYe/ETzzuEwGo/5Isu8Gz2AUF7XHMDQF9v/RPP9yE6h6BPNXG mh1HOE2q7c/wO1QGjSAL/U5ntVOacI7RRdZ9l0gIJ8iJlJug2EOhrS7C3C1VNJCPFQ i8dEQyjHOnWH+zA0bkOcbOgsgexGXolE/VFP+BhI= Date: Fri, 5 Feb 2016 18:44:50 +0100 From: Christian Hesse To: Andrei Borzenkov Subject: Re: [PATCH 1/1] support loading of custom initrd images Message-ID: <20160205184450.197ddab7@leda.localdomain> In-Reply-To: <56B4D61D.5010205@gmail.com> References: <1454668980-25352-1-git-send-email-list@eworm.de> <56B4D61D.5010205@gmail.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; x86_64-unknown-linux-gnu) X-Face: %O:rCSkHSKf7^4uF|FD$9$I0}g$nbnS1{DYPvs#:,~e`).mzj\$P9]V!WCveE/XdbL,L!{)6v%x4\Bt!b#{; dS&h"7l=ow'^({02!2%XOugod|u*mYBVm-OS:VpZ"ZrRA4[Q&zye,^j; ftj!Hxx\1@; LM)Pz)|B%1#sfF; s; ,N?*K*^) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEUZFRFENy6KVTKEd23CiGHeqofJvrX4+vdHgItOAAAACXBIWXMAAA3XAAAN1wFCKJt4AAACUklEQVQ4y2VUTZeqMAxNxXG2Io5uGd64L35unbF9ax0b3OLxgFs4PcLff0lBHeb1QIq5uelNCEJNq/TIFGyeC+iugH0WJr+B1MvzWASpuP4CYHOB0VfoDdddwA7OIFQIEHjXDiCtV5e9QX0WMu8AG0mB7g7WP4GqeqVdsi4vv/5kFBvaF/zD7zDquL4DxbrDGDyAsgNYOsJOYzth4Q9ZF6iLV+6TLAT1pi2kuvgAtZxSjoG8cL+8vIn251uoe1OOEWwbIPU04gHsmMsoxyyhYsD2FdIigF1yxaVbBuSOCAlCoX324I7wNMhrO1bhOLsRoA6DC6wQ5eQiSG5BiWQfM4gN+uItQTRDMaJUhVbGyKWCuaaUGSVFVKpl4PdoDn3yY8J+YxQxyhlHfoYOyPgyDcO+cSQK6Bvabjcy2nwRo3pxgA8jslnCuYw23ESOzHAPYwo4ITNQMaOO+RGPEGhSlPEZBh2jmBEjQ5cKbxmr0ruAe/WCriUxW76I8T3h7vqY5VR5wXLdERodg2rHEzdxxk5KpXTL4FwnarvndKM5/MWDY5CuBBdQ+3/0ivsUJHicuHd+Xh3jOdBL+FjSGq4SPCwco+orpWlERRTNo7BHCvbNXFVSIQMp+P5QsIL9upmr8kMTUOfxEHoanwzKRcNAe76WbjBwex/RkdHu48xT5YqP70DaMOhBcTHmAVDxLaBdle93oJy1QKFUh2GXT4am+YH/GGel1CeI98GdMXsytjCKIq/9cMrlgxFCROv+3/BU1fijNpcVD6DxE8VfLBaxUGr1D5usgDYdjwiPAAAAAElFTkSuQmCC MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/9Tmwqkkg7sUgb0UFTZ.4Rz1"; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 148.251.109.235 Cc: The development of GNU GRUB 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: Fri, 05 Feb 2016 17:45:09 -0000 --Sig_/9Tmwqkkg7sUgb0UFTZ.4Rz1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Andrei Borzenkov on Fri, 2016/02/05 20:04: > 05.02.2016 13:43, Christian Hesse =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > > From: Christian Hesse > >=20 > > Signed-off-by: Christian Hesse > > --- > > docs/grub.texi | 6 ++++++ > > util/grub-mkconfig.in | 1 + > > util/grub.d/10_linux.in | 16 +++++++++------- > > 3 files changed, 16 insertions(+), 7 deletions(-) > >=20 > > 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 Lin= ux > > and Xen menu entries.=20 > > +@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. > > + =20 >=20 > Is there any other use case? Both dracut and initramfs-tools already add > early cpio with microcode to generated initrd. This is bootloader > agnostic and better solution. Running Arch Linux here, mkinitcpio does not do that. The ucode has to be in uncompressed initramfs, so dracut and initramfs-tools use a concatenated image? I think this was discussed for mkinitcpio, but denied for any reason. Would have to search for references... We have a downstream bug about dealing with Intel ucode in bug tracker. [0] Nevertheless I have another use case: I do use Yubikeys in challenge/response mode to open my LUKS encrypted partition. [1] (This is not specific for mkinitcpio but works with dracut as well.) The challenges are stored in an extra initramfs. This is required if you want to update the challenge on every use - recompressing the initramfs on every boot is not a good option. > > +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..8e060c5 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=3D"$(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 > > } > > @@ -188,7 +190,7 @@ while [ "x$list" !=3D "x" ] ; do > > alt_version=3D`echo $version | sed -e "s,\.old$,,g"` > > linux_root_device_thisversion=3D"${LINUX_ROOT_DEVICE}" > > =20 > > - initrd=3D > > + initrd=3D(${GRUB_CUSTOM_INITRD}) =20 >=20 > We explicitly avoid bashisms in all scripts. This can be handled with a simple space separated string as well. I will rework this (given you do not deny this at all). Did not know that arrarys are not POSIX but bashism... Learned something at least. :D > > 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 +200,7 @@ while [ "x$list" !=3D "x" ] ; do > > "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \ > > "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do > > if test -e "${dirname}/${i}" ; then > > - initrd=3D"$i" > > + initrd+=3D("$i") > > break > > fi > > done > > @@ -217,7 +219,7 @@ while [ "x$list" !=3D "x" ] ; do > > fi > > =20 > > 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=3D" and "ZFS=3D" magic is parsed by initrd or initramfs. = Since > > there's # no initrd or builtin initramfs, it can't work here. > > =20 [0] https://bugs.archlinux.org/task/47941 [1] https://github.com/eworm-de/mkinitcpio-ykfde --=20 main(a){char*c=3D/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Chris get my mail address: */=3D0;b=3Dc[a+= +];) putchar(b-1/(/* gcc -o sig sig.c && ./sig */b/42*2-3)*42);} --Sig_/9Tmwqkkg7sUgb0UFTZ.4Rz1 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJWtN+SAAoJEIlFIdfMgPR28AcH/AwdeZpO7MXZkTrYK80AYZPK CDF6egid6R/zKwykhyoIEO1gMAqMOON8YB5q8MkjHxpWRBDfOR88rIu6Mya5EFbB nfZ8aareS8mUH8oUv/dL75ZFX+sF/schDQNgJOhPnKaEgLGP4yp9xS5sXX3U3psg yPpI3FuKaRx88hw9N1UFithnuGtvJ5ivFDBTIeRYYvo8yvnnphZgW332wcfEJnTb yXCBc0YOdOQ7RM0OYnDvKAFZdXhhZLtKvHk/T4BMmvriNLbab/SQ5UfpOsNOwRpy WbYGneNYi4uwAXU90ljBQdtsxRj5Dlj+wpgcEnjAvufgoUuNurz6lv5aFwQtT/c= =UGlO -----END PGP SIGNATURE----- --Sig_/9Tmwqkkg7sUgb0UFTZ.4Rz1--