[PATCH v3 0/2] x86: Parse CONFIG_CMDLINE in compressed kernel
From: Baskov Evgeniy
Date: Thu May 05 2022 - 06:33:05 EST
CONFIG_CMDLINE_BOOL and CONFIG_CMDLINE_OVERRIDE was ignored during
options lookup in compressed kernel, including earlyprintk option,
so it was impossible to get earlyprintk messages from that stage
of boot process via command line provided at compile time.
Being able to enable earlyprintk via compile-time option might
be desirable for booting on systems with broken UEFI command line
arguments via EFISTUB.
v2 changes:
As Borislav Petkov stated, we can do the work just once and then
return correct command line pointer. Doing it this way require
us to perform string manipulations, so the first patch adds missing
strlcat() to compressed kernel, since this function simplifies
the code a lot.
If we need to concatenate strings, static buffer of fixed length
is used. The maximum command line length is set to the same value
as the one in the kernel setup code.
v3 changes:
v2 had a bug: cmd_line_ptr was set to a pointer to a buffer inside
a kernel before kernel relocation, that makes this pointer invalid.
It was fixed by replacing the pointer by a boolean variable.
Baskov Evgeniy (2):
x86: Add strlcat() to compressed kernel
x86: Parse CONFIG_CMDLINE in compressed kernel
arch/x86/boot/compressed/cmdline.c | 24 +++++++++++++++++++++++-
arch/x86/boot/compressed/string.c | 15 +++++++++++++++
2 files changed, 38 insertions(+), 1 deletion(-)