All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] support loading of custom initrd images
@ 2016-02-05 10:43 Christian Hesse
  2016-02-05 17:04 ` Andrei Borzenkov
  2016-02-05 18:23 ` [PATCH " Vladimir 'phcoder' Serbinenko
  0 siblings, 2 replies; 9+ messages in thread
From: Christian Hesse @ 2016-02-05 10:43 UTC (permalink / raw)
  To: grub-devel; +Cc: Christian Hesse

From: Christian Hesse <mail@eworm.de>

Signed-off-by: Christian Hesse <mail@eworm.de>
---
 docs/grub.texi          |  6 ++++++
 util/grub-mkconfig.in   |  1 +
 util/grub.d/10_linux.in | 16 +++++++++-------
 3 files changed, 16 insertions(+), 7 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..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="$(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" != "x" ] ; do
   alt_version=`echo $version | sed -e "s,\.old$,,g"`
   linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
 
-  initrd=
+  initrd=(${GRUB_CUSTOM_INITRD})
   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" != "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 +219,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.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/1] support loading of custom initrd images
  2016-02-05 10:43 [PATCH 1/1] support loading of custom initrd images Christian Hesse
@ 2016-02-05 17:04 ` Andrei Borzenkov
  2016-02-05 17:44   ` Christian Hesse
  2016-02-05 18:23 ` [PATCH " Vladimir 'phcoder' Serbinenko
  1 sibling, 1 reply; 9+ messages in thread
From: Andrei Borzenkov @ 2016-02-05 17:04 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: Christian Hesse

05.02.2016 13:43, Christian Hesse пишет:
> From: Christian Hesse <mail@eworm.de>
> 
> Signed-off-by: Christian Hesse <mail@eworm.de>
> ---
>  docs/grub.texi          |  6 ++++++
>  util/grub-mkconfig.in   |  1 +
>  util/grub.d/10_linux.in | 16 +++++++++-------
>  3 files changed, 16 insertions(+), 7 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.
> +

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.

> +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="$(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" != "x" ] ; do
>    alt_version=`echo $version | sed -e "s,\.old$,,g"`
>    linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
>  
> -  initrd=
> +  initrd=(${GRUB_CUSTOM_INITRD})

We explicitly avoid bashisms in all scripts.

>    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" != "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 +219,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.
> 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/1] support loading of custom initrd images
  2016-02-05 17:04 ` Andrei Borzenkov
@ 2016-02-05 17:44   ` Christian Hesse
  2016-02-06  6:51     ` Andrei Borzenkov
  2016-02-08  8:30     ` [PATCH v2 " Christian Hesse
  0 siblings, 2 replies; 9+ messages in thread
From: Christian Hesse @ 2016-02-05 17:44 UTC (permalink / raw)
  To: Andrei Borzenkov; +Cc: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 5345 bytes --]

Andrei Borzenkov <arvidjaar@gmail.com> on Fri, 2016/02/05 20:04:
> 05.02.2016 13:43, Christian Hesse пишет:
> > From: Christian Hesse <mail@eworm.de>
> > 
> > Signed-off-by: Christian Hesse <mail@eworm.de>
> > ---
> >  docs/grub.texi          |  6 ++++++
> >  util/grub-mkconfig.in   |  1 +
> >  util/grub.d/10_linux.in | 16 +++++++++-------
> >  3 files changed, 16 insertions(+), 7 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.
> > +  
> 
> 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="$(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" != "x" ] ; do
> >    alt_version=`echo $version | sed -e "s,\.old$,,g"`
> >    linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
> >  
> > -  initrd=
> > +  initrd=(${GRUB_CUSTOM_INITRD})  
> 
> 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" != "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 +219,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.
> >   


[0] https://bugs.archlinux.org/task/47941
[1] https://github.com/eworm-de/mkinitcpio-ykfde

-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Chris           get my mail address:    */=0;b=c[a++];)
putchar(b-1/(/*               gcc -o sig sig.c && ./sig    */b/42*2-3)*42);}

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/1] support loading of custom initrd images
  2016-02-05 10:43 [PATCH 1/1] support loading of custom initrd images Christian Hesse
  2016-02-05 17:04 ` Andrei Borzenkov
@ 2016-02-05 18:23 ` Vladimir 'phcoder' Serbinenko
  2016-02-08  8:27   ` Christian Hesse
  1 sibling, 1 reply; 9+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2016-02-05 18:23 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: Christian Hesse

[-- Attachment #1: Type: text/plain, Size: 4089 bytes --]

What is the name of ucode? What takes care of putting it under /boot? Can
we just add ucode if it's under standard name under /boot and not have
extra config? Ucode is something highly technical and we don't want user to
bother about it

Le ven. 5 févr. 2016 12:20, Christian Hesse <list@eworm.de> a écrit :

> From: Christian Hesse <mail@eworm.de>
>
> Signed-off-by: Christian Hesse <mail@eworm.de>
> ---
>  docs/grub.texi          |  6 ++++++
>  util/grub-mkconfig.in   |  1 +
>  util/grub.d/10_linux.in | 16 +++++++++-------
>  3 files changed, 16 insertions(+), 7 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..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="$(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" != "x" ] ; do
>    alt_version=`echo $version | sed -e "s,\.old$,,g"`
>    linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
>
> -  initrd=
> +  initrd=(${GRUB_CUSTOM_INITRD})
>    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" != "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 +219,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.0
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>

[-- Attachment #2: Type: text/html, Size: 6099 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/1] support loading of custom initrd images
  2016-02-05 17:44   ` Christian Hesse
@ 2016-02-06  6:51     ` Andrei Borzenkov
  2016-02-08  8:22       ` Christian Hesse
  2016-02-08  8:30     ` [PATCH v2 " Christian Hesse
  1 sibling, 1 reply; 9+ messages in thread
From: Andrei Borzenkov @ 2016-02-06  6:51 UTC (permalink / raw)
  To: Christian Hesse; +Cc: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 1238 bytes --]

05.02.2016 20:44, Christian Hesse пишет:
>>> +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.
>>> +  
>>
>> 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?

Yes.

> 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.
> 

Why your initrd cannot simply read this file from /boot itself?



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/1] support loading of custom initrd images
  2016-02-06  6:51     ` Andrei Borzenkov
@ 2016-02-08  8:22       ` Christian Hesse
  0 siblings, 0 replies; 9+ messages in thread
From: Christian Hesse @ 2016-02-08  8:22 UTC (permalink / raw)
  To: Andrei Borzenkov; +Cc: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 976 bytes --]

Andrei Borzenkov <arvidjaar@gmail.com> on Sat, 2016/02/06 09:51:
> > 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.
> >   
> 
> Why your initrd cannot simply read this file from /boot itself?

Because just having the files around is easier than handling mount and
umount. My code is run from udev when a key is inserted, I suppose fiddling
with mount will confuse systemd units.
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Chris           get my mail address:    */=0;b=c[a++];)
putchar(b-1/(/*               gcc -o sig sig.c && ./sig    */b/42*2-3)*42);}

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/1] support loading of custom initrd images
  2016-02-05 18:23 ` [PATCH " Vladimir 'phcoder' Serbinenko
@ 2016-02-08  8:27   ` Christian Hesse
  0 siblings, 0 replies; 9+ messages in thread
From: Christian Hesse @ 2016-02-08  8:27 UTC (permalink / raw)
  To: Vladimir 'phcoder' Serbinenko; +Cc: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 907 bytes --]

"Vladimir 'phcoder' Serbinenko" <phcoder@gmail.com> on Fri, 2016/02/05 18:23:
> What is the name of ucode? What takes care of putting it under /boot? Can
> we just add ucode if it's under standard name under /boot and not have
> extra config? Ucode is something highly technical and we don't want user to
> bother about it

The image filename is /boot/intel-ucode.img and it is placed there by package
intel-ucode [0].

Hard coding this would solve the issue of loading Intel ucode. (Though other
distribution may have other file names/pathes.)

I still can not load my custom initrd then. ;)

[0] https://www.archlinux.org/packages/extra/any/intel-ucode/
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Chris           get my mail address:    */=0;b=c[a++];)
putchar(b-1/(/*               gcc -o sig sig.c && ./sig    */b/42*2-3)*42);}

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/1] support loading of custom initrd images
  2016-02-05 17:44   ` Christian Hesse
  2016-02-06  6:51     ` Andrei Borzenkov
@ 2016-02-08  8:30     ` Christian Hesse
  2016-02-08 16:10       ` Christian Hesse
  1 sibling, 1 reply; 9+ messages in thread
From: Christian Hesse @ 2016-02-08  8:30 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: Christian Hesse

Signed-off-by: Christian Hesse <mail@eworm.de>
---
 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



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/1] support loading of custom initrd images
  2016-02-08  8:30     ` [PATCH v2 " Christian Hesse
@ 2016-02-08 16:10       ` Christian Hesse
  0 siblings, 0 replies; 9+ messages in thread
From: Christian Hesse @ 2016-02-08 16:10 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 479 bytes --]

Christian Hesse <mail@eworm.de> on Mon, 2016/02/08 09:30:
>    initrd=
> +  for i in ${GRUB_CUSTOM_INITRD}; do

To hardcode know images we could add file names here...

[...]
  for i in intel-ucode.img ${GRUB_CUSTOM_INITRD}; do
[...]
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Chris           get my mail address:    */=0;b=c[a++];)
putchar(b-1/(/*               gcc -o sig sig.c && ./sig    */b/42*2-3)*42);}

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-02-08 16:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-05 10:43 [PATCH 1/1] support loading of custom initrd images Christian Hesse
2016-02-05 17:04 ` Andrei Borzenkov
2016-02-05 17:44   ` Christian Hesse
2016-02-06  6:51     ` Andrei Borzenkov
2016-02-08  8:22       ` Christian Hesse
2016-02-08  8:30     ` [PATCH v2 " Christian Hesse
2016-02-08 16:10       ` Christian Hesse
2016-02-05 18:23 ` [PATCH " Vladimir 'phcoder' Serbinenko
2016-02-08  8:27   ` Christian Hesse

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.