From a2eb03660d782e0520a296f006886374f9d8b930 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Wed, 3 Dec 2025 14:03:18 +0100 Subject: [PATCH] zipl/boot: Fix unused loadparm when SCLP line-mode console is absent Currently, 'sclp_setup(SCLP_INIT)' fails if no SCLP line-mode console is available. As a result 'menu_param()' is never called, even though it is required to retrieve the 'loadparm' value. However, reading the loadparm via SCLP remains useful even when a SCLP line-mode console is absent, because this value determines which boot entry should be selected. Therefore, the boot process should continue by retrieving the loadparm without requiring an SCLP line-mode console. It's safe to continue without a SCLP console as 'printf' and 'menu_param' tolerates the absence of a SCLP line-mode console. Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/196 Reported-by: Thomas Huth Reviewed-by: Steffen Eiden Reviewed-by: Eduard Shishkin Signed-off-by: Marc Hartmayer Signed-off-by: Steffen Eiden --- zipl/boot/menu.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/zipl/boot/menu.c b/zipl/boot/menu.c index 4ece5507..6b5208ee 100644 --- a/zipl/boot/menu.c +++ b/zipl/boot/menu.c @@ -150,16 +150,17 @@ int menu(void) { enum { DEFAULT_MENU_ENTRY = 0 }; unsigned long value = DEFAULT_MENU_ENTRY; + int sclp_lm_available; char *cmd_line_extra; char endstring[15]; cmd_line_extra = (char *)COMMAND_LINE_EXTRA; memset(cmd_line_extra, 0, COMMAND_LINE_EXTRA_SIZE); - if (sclp_setup(SCLP_INIT) != 0) { - /* sclp setup failed boot default */ - goto boot; - } + /* Try to initialize SCLP line-mode console. But do not fail in case no + * SCLP line-mode console is available. + */ + sclp_lm_available = sclp_setup(SCLP_INIT) == 0; switch (menu_param(&value)) { case NUMBER_FOUND: @@ -180,6 +181,10 @@ int menu(void) break; } + /* SCLP line-mode unavailable; skip menu and input */ + if (!sclp_lm_available) + goto boot; + /* print banner */ printf("%s\n", ((void *)&__stage2_params) + __stage2_params.banner);