[PATCH] init: remove legacy lilo auto cmdline hack

From: Nir Lichtman
Date: Sun Jan 26 2025 - 04:59:41 EST


Problem: The code handling the "init" and "initrd" command line options has
a
LILO specific hack which cleans up arguments that are meant to be passed to
init.
As the comment claims, LILO indeed passes "auto" to the init to signify that
the
boot was automatic without user manual intervention, but I think this logic
is weird
and unexpected since it just cleans up everything that came before the
"init=" or "initrd="
which could be confusing for the end users expecting the unknown params to
be passed on
to the init process, but they just get swallowed because of this.
On top of that, LILO is pretty much an abandoned project, so I don't think
there is much
value of having this handling code in the kernel.

Example: This behavior can be demonstrated by running
qemu-system-x86_64 -kernel arch/x86/boot/bzImage -append "arg1 init=/myinit"
The LILO logic will clean up the arg1, such that no arguments are passed to
myinit

Solution: Remove this logic from the "init=" and "initrd=" handling logic

Signed-off-by: Nir Lichtman <nir@xxxxxxxxxxxx>
---
init/main.c | 15 ---------------
1 file changed, 15 deletions(-)

diff --git a/init/main.c b/init/main.c
index 893cb77aef22..864b60a07b90 100644
--- a/init/main.c
+++ b/init/main.c
@@ -589,29 +589,14 @@ static int __init unknown_bootoption(char *param, char
*val,

static int __init init_setup(char *str)
{
- unsigned int i;
-
execute_command = str;
- /*
- * In case LILO is going to boot us with default command line,
- * it prepends "auto" before the whole cmdline which makes
- * the shell think it should execute a script with such name.
- * So we ignore all arguments entered _before_ init=... [MJ]
- */
- for (i = 1; i < MAX_INIT_ARGS; i++)
- argv_init[i] = NULL;
return 1;
}
__setup("init=", init_setup);

static int __init rdinit_setup(char *str)
{
- unsigned int i;
-
ramdisk_execute_command = str;
- /* See "auto" comment in init_setup */
- for (i = 1; i < MAX_INIT_ARGS; i++)
- argv_init[i] = NULL;
return 1;
}
__setup("rdinit=", rdinit_setup);
--
2.39.5