Re: [PATCH v4 3/5] efi: Drop all uses of efi_call_XX wrappers

2023-06-16 Thread Christian Hesse
Robin Candau  on Fri, 2023/06/16 12:48:
> Le 16/06/2023 à 12:35, Daniel Kiper a écrit :
> > On Fri, Jun 16, 2023 at 09:15:19AM +0200, Robin Candau wrote:  
> >> Le 15/06/2023 à 23:36, Christian Hesse a écrit :  
> >>> Daniel Kiper  on Thu, 2023/06/15 17:05:  
> >>>>> It looks I was able to reproduce this problem. I will be checking what
> >>>>> is going on in following days...  
> >>>> Here [1] is the fix. Please test...  
> >>> Works for me, thanks!  
> >> Works for me as well, thanks!  
> > Cool! Thanks for doing tests!
> >
> > Christian, Robin, may I add Tested-by tag on your behalf to the patch?
>
> Fine by me ;)

Sure, same for me! :)

Thanks a lot!
-- 
main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH"
"CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];)
putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);}


pgpheecrerVuv.pgp
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] efi: Add missing __grub_efi_api attributes

2023-06-15 Thread Christian Hesse
Daniel Kiper  on Thu, 2023/06/15 16:45:
> The commit bb4aa6e06 (efi: Drop all uses of efi_call_XX() wrappers) did
> not add some __grub_efi_api attributes to the EFI calls. Lack of them
> led to hangs on x86_64-efi target. So, let's add missing __grub_efi_api
> attributes.
> 
> Fixes: bb4aa6e06 (efi: Drop all uses of efi_call_XX() wrappers)

I can confirm this fixes the issue for me. Thanks a lot!
-- 
main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH"
"CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];)
putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);}


pgpCviyNPEndj.pgp
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH v4 3/5] efi: Drop all uses of efi_call_XX wrappers

2023-06-15 Thread Christian Hesse
Daniel Kiper  on Thu, 2023/06/15 17:05:
> > It looks I was able to reproduce this problem. I will be checking what
> > is going on in following days...  
> 
> Here [1] is the fix. Please test...

Works for me, thanks!
-- 
main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH"
"CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];)
putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);}


pgpG4nzvtPfGC.pgp
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH v4 3/5] efi: Drop all uses of efi_call_XX wrappers

2023-06-12 Thread Christian Hesse
Ard Biesheuvel  on Tue, 2023/05/23 17:31:
> Now that GCC can generate function calls using the correct calling
> convention for us, we can stop using the efi_call_XX () wrappers, and
> just dereference the function pointers directly.
> 
> This avoids the untyped variadic wrapper routines, which means better
> type checking for the method calls.

Building an Arch package from current git master makes the system unbootable
with just a black screen. We did biscect this and found this commit
(bb4aa6e06ee3877110a1dc0eb0d766ffac978993 in master) to be the first bad one.

As gcc is mentioned in the commit message... We are building with gcc
13.1.1-1. Any idea what is going on here?
-- 
main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH"
"CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];)
putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);}


pgpFryIqi6gT1.pgp
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [programmer11...@programist.ru: Bug#1021846: grub-install is broken since 2.06-3: error: unknown filesystem]

2022-12-08 Thread Christian Hesse
Daniel Axtens  on Sat, 2022/12/03 01:41:
> Please try the following:
> 
> diff --git a/grub-core/fs/f2fs.c b/grub-core/fs/f2fs.c
> index df6beb544cbd..855e24618c2b 100644
> --- a/grub-core/fs/f2fs.c
> +++ b/grub-core/fs/f2fs.c
> @@ -650,7 +650,7 @@ get_blkaddr_from_nat_journal (struct grub_f2fs_data
> *data, grub_uint32_t nid, grub_uint16_t n = grub_le_to_cpu16
> (data->nat_j.n_nats); grub_uint16_t i;
>  
> -  if (n >= NAT_JOURNAL_ENTRIES)
> +  if (n > NAT_JOURNAL_ENTRIES)
>  return grub_error (GRUB_ERR_BAD_FS,
> "invalid number of nat journal entries");

I have a confirmation in Arch downstream bug report that this indeed does
fix the issue.

https://bugs.archlinux.org/task/76168#comment213505

Pleas commit into master. Thanks a lot!
-- 
main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH"
"CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];)
putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);}


pgp75MieUztUX.pgp
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH 1/1] templates: filter C.UTF-8 locale for translation

2022-09-19 Thread Christian Hesse
From: Christian Hesse 

In addition to C locale there is also C.UTF-8 locale now. Filter that as
well, by using ${grub_lang}, which contains a stripped value.
This fixes the following message and resulting boot failure:

error: file `/boot/grub/locale/C.gmo' not found.

Signed-off-by: Christian Hesse 
---
 util/grub.d/00_header.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
index f74c2a4c6..6a316a5ba 100644
--- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in
@@ -191,7 +191,7 @@ EOF
 EOF
 
 # Gettext variables and module
-if [ "x${LANG}" != "xC" ] && [ "x${LANG}" != "xPOSIX" ] && [ "x${LANG}" != "x" 
]; then
+if [ "x${grub_lang}" != "xC" ] && [ "x${LANG}" != "xPOSIX" ] && [ "x${LANG}" 
!= "x" ]; then
   cat << EOF
   set locale_dir=\$prefix/locale
   set lang=${grub_lang}
-- 
2.37.3


___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [SECURITY PATCH 00/28] Multiple GRUB2 vulnerabilities - BootHole

2020-07-29 Thread Christian Hesse
Daniel Kiper  on Wed, 2020/07/29 19:00:
> I am posting all the GRUB2 upstream patches which fixes all security bugs
> found and reported up until now. Major Linux distros carry or will carry
> soon one form or another of these patches. Now all the GRUB2 upstream
> patches are in the GRUB2 git repository [5] too.

This does not apply on top of grub 2.04. Will downstream maintainers have to
do their cherry-picking on its own or will a maintenance branch on top of
grub-2.04 (or what ever) be available?
I would like to push updates to the Arch Linux repositories.
Thanks!
-- 
main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH"
"CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];)
putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);}


pgpS3oSiQZeUG.pgp
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: GRUB 2.04 RC01 does not build on Debian Jessie

2019-04-11 Thread Christian Hesse
adrian15  on Fri, 2019/04/12 07:37:
>  --target="i386-pe" \

No idea if it make a difference, but I guess this should read "i386-pc"?
-- 
main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH"
"CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];)
putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);}


pgpxhlTT87Wit.pgp
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: GRUB 2.04 RC01 released

2019-04-09 Thread Christian Hesse
"Vladimir 'phcoder' Serbinenko"  on Tue, 2019/04/09 20:53:
> Hello all. GRUB maintainers team is proud to announce 2.04~rc1 that we
> have just released.
> 
> We’re not aware of any of the release-critical bugs but we’re sure
> that there are some so we need your help finding them.

Built an Arch Linux package, successfully tested booting on i386-pc and
x86_64-efi. This is ready to go from my point of view.
-- 
main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH"
"CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];)
putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);}


pgpDRNfVADxWU.pgp
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: Signing keys for releases on ftp.gnu.org

2018-07-18 Thread Christian Hesse
Brian Finn  on Tue, 2018/07/17 23:42:
> Hey grub-devel,
> 
> 
> I see that grub2 releases on ftp://ftp.gnu.org/gnu/grub/ have detached
> signatures, but I can't find the corresponding public key anywhere. gpg
> tells me I should be looking for key ID E82E4209. Can any of you point me
> in the right direction?

It's a key by Vladimir 'phcoder' Serbinenko :

https://pgp.mit.edu/pks/lookup?op=get=0xE53D497F3FA42AD8C9B4D1E835A93B74E82E4209
-- 
main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH"
"CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];)
putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);}


pgpzHfCsjDCVu.pgp
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] grub-mkconfig/10_linux: Support multiple early initrd images

2018-03-17 Thread Christian Hesse
Daniel Kiper <dki...@net-space.pl> on Mon, 2018/03/05 17:48:
> On Sat, Feb 24, 2018 at 05:44:58PM -0500, Matthew S. Turnbull wrote:
> > Add support for multiple, shared, early initrd images. These early
> > images will be loaded in the order declared, and all will be loaded
> > before the initrd image.
> >
> > While many classes of data can be provided by early images, the
> > immediate use case would be for distributions to provide CPU
> > microcode to mitigate the Meltdown and Spectre vulnerabilities.
> >
> > There are two environment variables provided for declaring the early
> > images.
> >
> > * GRUB_EARLY_INITRD_LINUX_STOCK is for the distribution declare
> >   images that are provided by the distribution or installed packages.
> >   If undeclared, this will default to a set of common microcode image
> >   names.
> >
> > * GRUB_EARLY_INITRD_LINUX_CUSTOM is for user created images. User
> >   images will be loaded after the stock images.
> >
> > These separate configurations allow the distribution and user to
> > declare different image sets without clobbering each other.
> >
> > This also makes a minor update to ensure that UUID partition labels
> > stay disabled when no initrd image is found, even if early images are
> > present.
> >
> > This is a continuation of a previous patch published by Christian
> > Hesse in 2016:
> > http://lists.gnu.org/archive/html/grub-devel/2016-02/msg00025.html
> >
> > Down stream Gentoo bug:
> > https://bugs.gentoo.org/645088
> >
> > Signed-off-by: Robin H. Johnson <robb...@gentoo.org>
> > Signed-off-by: Matthew S. Turnbull <spa...@bluefang-logic.com>  
> 
> Reviewed-by: Daniel Kiper <daniel.ki...@oracle.com>
> 
> If there are not objections I will apply this in a week or so.

Thanks for picking my work and bringing this upstream! Much appreciated I can
use this now.
-- 
main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH"
"CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];)
putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);}


pgp0vTP0bLAbC.pgp
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: Possible regression in e2fsprogs-1.43.4

2017-06-23 Thread Christian Hesse
Theodore Ts'o  on Fri, 2017/06/23 15:53:
> +grub-devel
> 
> On Sat, Jun 10, 2017 at 04:00:20PM +0200, Felipe A Rodriguez wrote:
> > Upgrading from e2fsprogs-1.42.13 to e2fsprogs-1.43.4 causes the boot
> > loader to fail (unknown filesystem error) on the x86_64 VM I use for
> > initial testing.  I traced the problem to changes in the e2fsprogs
> > configuration file which now sets 64 bit flags.  I tried upgrading
> > to GRUB 2.02 but that did not resolve the problem.  Reverting the
> > changes per the patch below fixes the problem.  
> 
> Hmm, my laptop has been using a file system with the 64-bit feature
> enabled for quite some time, and my Debian Stretch system has been
> using Grub 2.02 to boot my system without any difficulties.
> 
> I've done a quick check of the Debian patches and none of them seem to
> modify Grub's ext2/ext4 file system implementation.  So I don't know
> what to tell you.  Are you sure you properly reinstalled grub on the
> boot device after you upgraded to grub 2.02?

Grub should be fine, however syslinux still suffers issues with 64-bit
feature. Possibly you use a chain to load syslinux first, grub second?
-- 
main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH"
"CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];)
putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);}


pgpjLxgPkBGfx.pgp
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: truncated checksums.h

2017-02-03 Thread Christian Hesse
"Vladimir 'phcoder' Serbinenko"  on Fri, 2017/02/03 16:21:
> You're right. Looks like it got truncated. I'm going to repush when I get
> to the hotel

Thanks!
-- 
main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH"
"CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];)
putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);}


pgpy_BiGZRkFU.pgp
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


truncated checksums.h

2017-02-03 Thread Christian Hesse
Hello everybody,

just wanted to build grub from git master / tag 2.02-rc1. Looks like
checksums.h is truncated... This broke with commit fcb1528d93.
-- 
main(a){char*c=/*Schoene Gruesse */"C7?Bj;MEH"
"CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];)
putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);}


pgpldl1bNvRur.pgp
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 1/1] support loading of custom initrd images

2016-02-08 Thread Christian Hesse
Andrei Borzenkov  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);}


pgpH6wNaY8na1.pgp
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH v2 1/1] support loading of custom initrd images

2016-02-08 Thread Christian Hesse
Christian Hesse <m...@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);}


pgp1sq7inCgQM.pgp
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH v2 1/1] support loading of custom initrd images

2016-02-08 Thread Christian Hesse
Signed-off-by: Christian Hesse <m...@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


___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 1/1] support loading of custom initrd images

2016-02-08 Thread Christian Hesse
"Vladimir 'phcoder' Serbinenko"  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);}


pgp5JWnG0OJsV.pgp
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 1/1] support loading of custom initrd images

2016-02-05 Thread Christian Hesse
Andrei Borzenkov <arvidj...@gmail.com> on Fri, 2016/02/05 20:04:
> 05.02.2016 13:43, Christian Hesse пишет:
> > From: Christian Hesse <m...@eworm.de>
> > 
> > Signed-off-by: Christian Hesse <m...@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}" \

[PATCH 1/1] support loading of custom initrd images

2016-02-05 Thread Christian Hesse
From: Christian Hesse <m...@eworm.de>

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