[PATCH 3/4] misc: Allow selective disabling of debug conditionals

2021-03-19 Thread Glenn Washburn
Sometimes you know only know which debug logging conditionals you want to turn off. Now debug log messages can be excluded by specifying the conditional in the $debug string with a prepended dash. So say you want all debug logging on except for btrfs and scripting, then set debug=all,-btrfs,-scri

[PATCH 4/4] misc: Change grub_strword to return a string like grub_strstr

2021-03-19 Thread Glenn Washburn
This makes grub_strword more versatile. All code as of this change using grub_strword uses it in a conditional or boolean operator context where its return value would be silently converted to a 1 or 0, so this does not affect current usage. A few lines in loader/xnu.c have been changed to enhance

[PATCH 2/4] misc: Add debug log condition to log output

2021-03-19 Thread Glenn Washburn
When debugging using the "all" condition frequently gives way too much info. So selecting a subset of conditions is desirable. This change makes it easier to identify which conditions are desired. Before this change log messages needed to be looked up in the source code to find the condition used.

[PATCH 0/4] Miscellaneous changes to aid in troubleshooting

2021-03-19 Thread Glenn Washburn
These are pretty self-explanatory. They've been useful in debugging grub issues. Note that patch #2 and #3 are particularly synergistic. Also a note about patch #4. It was used in a version of patch #3, though not any more. I decided to leave it in this patch series because it enhances grub_strwor

[PATCH 1/4] error: Add grub_errno to printed error message

2021-03-19 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- grub-core/kern/err.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/kern/err.c b/grub-core/kern/err.c index 53c734de7..a12fda48b 100644 --- a/grub-core/kern/err.c +++ b/grub-core/kern/err.c @@ -107,7 +107,7 @@ grub_print_error (void

[PATCH] kern/dl: Disable grub_dl_unload_unneeded

2021-03-19 Thread Colin Watson
grub_dl_unload_unneeded has been unused by default since de04eecfa9 put its only call within an "#if 0", so there's no point in it sitting around taking up space in the core image. Turn the "#if 0" into "#ifdef GRUB_UNLOAD_UNNEEDED_MODULES" just in case somebody is turning this code back on locall

[PATCH] kern/misc: Move grub_printf_fmt_check to gfxmenu

2021-03-19 Thread Colin Watson
This function is only used by gfxmenu. Moving it there is unfortunately a bit messy, but it frees up a fairly substantial amount (in relative terms) of precious core image space on i386-pc. DOWN: obj/i386-pc/grub-core/kernel.img (31740 > 31528) - change: -212 UP: obj/i386-pc/grub-core/gfxme

[PATCH 4/4] luks2: Fix potential grub_free with NULL pointer

2021-03-19 Thread Glenn Washburn
This is not strictly necessary because grub_free does nothing if it is passed a NULL pointer. However, it simplifies the code and makes it a tad bit easier to read. Signed-off-by: Glenn Washburn --- grub-core/disk/luks2.c | 34 +- 1 file changed, 9 insertions(+),

[PATCH 2/4] luks2: Add error message strings to crypto errors

2021-03-19 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- grub-core/disk/luks2.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c index 199e11473..4b259cbdb 100644 --- a/grub-core/disk/luks2.c +++ b/grub-core/disk/luks2.c @@ -411,7 +4

[PATCH 3/4] luks2: Add error message strings to errors in luks2_read_header

2021-03-19 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- grub-core/disk/luks2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c index 4b259cbdb..2ed9e5a80 100644 --- a/grub-core/disk/luks2.c +++ b/grub-core/disk/luks2.c @@ -328,7 +328,7 @@ luks2_re

[PATCH 1/4] luks2: Continue trying all keyslots even if there are some failures

2021-03-19 Thread Glenn Washburn
luks2_get_keyslot can fail for a variety of reasons that do not neccesarily mean the next keyslot should not be tried (eg. a new kdf type). So always try the next slot. This will make GRUB more resilient to non-spec json data that 3rd party systems may add. We do not care if some of the keyslots ar

[PATCH 0/4] Various LUKS2 improvements

2021-03-19 Thread Glenn Washburn
Patch #1: Allows GRUB to be more resilient in the fact or unexpected json data, thus allowing access to LUKS2 volumes in cases where currently it would be inaccessible Patch #2-3: Add some text to go along with the error in case it gets bubbled up to the user Patch #4: Simplifies some error h

[PATCH] buffer: Sync up out-of-range error message

2021-03-19 Thread Colin Watson
The messages associated with other similar GRUB_ERR_OUT_OF_RANGE errors were lacking the trailing full stop. Syncing up the strings saves a small amount of precious core image space on i386-pc. DOWN: obj/i386-pc/grub-core/kernel.img (31740 > 31708) - change: -32 DOWN: i386-pc core image (bios

Re: [PATCH 3/5] ns8250: Add base support for MMIO UARTs

2021-03-19 Thread Benjamin Herrenschmidt
On Fri, 2021-03-19 at 12:16 -0500, Glenn Washburn wrote: > diff --git a/grub-core/term/serial.c b/grub-core/term/serial.c > > > index f9271b092..7d4dbb2de 100644 > > --- a/grub-core/term/serial.c > > +++ b/grub-core/term/serial.c > > @@ -160,6 +160,18 @@ grub_serial_find (const char *name) > >

[PROCFS 3/5] cryptodisk: Add crypto disk name and source device names to (proc)/luks_script

2021-03-19 Thread Glenn Washburn
It can be difficult to determine what device backs a particular (cryptoN) device because they are automatically generated. This allows users to see in the grub shell which devices back which crypto devices. Signed-off-by: Glenn Washburn --- grub-core/disk/cryptodisk.c | 22 ++

[PROCFS 5/5] procfs: Add (proc)/devices to get info on grub devices.

2021-03-19 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- grub-core/fs/proc.c | 91 + 1 file changed, 91 insertions(+) diff --git a/grub-core/fs/proc.c b/grub-core/fs/proc.c index 5f516502d..9baabb7d4 100644 --- a/grub-core/fs/proc.c +++ b/grub-core/fs/proc.c @@ -190,10 +190,

[PROCFS 4/5] cryptodisk: Add header line of field names to (procfs)/luks_script

2021-03-19 Thread Glenn Washburn
Its not obvious from the grub shell, nor is it documented anywhere, what the fields in each line of (procfs)/luks_script represent. This makes it easier for the user to comprehend the meaning of fields directly from the shell. Signed-off-by: Glenn Washburn --- grub-core/disk/cryptodisk.c | 6 +++

[PROCFS 2/5] luks2: Add support for LUKS2 in (proc)/luks_script

2021-03-19 Thread Glenn Washburn
In addition, the sector size in bytes is added to each line and it is allowed to be 4 decimal digits long, which covers the most common cases of 512 and 4096 byte sectors. The size allocation is updated to reflect this additional field, allow up to 4 characters and 1 space added. Signed-off-by: Gl

[PROCFS 1/5] loopback: Add procfs entry 'loopbacks' to output configured loopback devices

2021-03-19 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- grub-core/disk/loopback.c | 57 +++ 1 file changed, 57 insertions(+) diff --git a/grub-core/disk/loopback.c b/grub-core/disk/loopback.c index 41bebd14f..5957f58df 100644 --- a/grub-core/disk/loopback.c +++ b/grub-core/disk/loo

[PROCFS 0/5] Add and improve (proc) entries

2021-03-19 Thread Glenn Washburn
This patch series adds proc entries to show the user some of GRUB's internal state on devices, loopback devices, and luks devices. This can be valuable when debugging grub, either as a developer, or as a user trying to determine why their config is not working as expected. Some of the same info can

Re: [PATCH 3/5] ns8250: Add base support for MMIO UARTs

2021-03-19 Thread Glenn Washburn
On Fri, 19 Mar 2021 09:07:26 +1100 Benjamin Herrenschmidt wrote: > This adds the ability for the driver to access UARTs via MMIO instead > of PIO selectively at runtime, and exposes a new function to add an > MMIO port. > > Signed-off-by: Benjamin Herrenschmidt > --- > docs/grub.texi

Re: [PATCH 0/5] serial: Add MMIO & SPCR support for AWS EC2 metal instances

2021-03-19 Thread Glenn Washburn
On Fri, 19 Mar 2021 12:27:15 +1100 Benjamin Herrenschmidt wrote: > On Thu, 2021-03-18 at 19:03 -0500, Glenn Washburn wrote: > > > This was tested using SPCR on an actual c5.metal instance, and > > > using explicit instanciation via serial -p mmio on a > > > modified qemu hacked to create