From da241a690d20d4e8f6e9df5357b62e7fb0fe17b6 Mon Sep 17 00:00:00 2001 From: osozer-philips <123357984+osozer-philips@users.noreply.github.com> Date: Thu, 4 Sep 2025 10:39:31 +0000 Subject: [PATCH] platsch: Continue to boot when there is no screen In an error case where the screen is not attached, this change allows boot process to continue instead of a kernel panic. --- platsch.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/platsch.c b/platsch.c index 6670d5c..03707d9 100644 --- a/platsch.c +++ b/platsch.c @@ -113,8 +113,28 @@ int main(int argc, char *argv[]) } ctx = platsch_create_ctx(dir, base); - if (!ctx) + if (!ctx) { + /* If we're PID 1, do NOT die on missing DRM. Hand off to real init. */ + error("platsch: no DRM device found, continuing without splash\n"); + if (pid1) { + initsargv = calloc(argc + 1, sizeof(argv[0])); + if (!initsargv) { + error("failed to allocate argv for init\n"); + return EXIT_FAILURE; + } + memcpy(initsargv, argv, argc * sizeof(argv[0])); + initsargv[0] = "/sbin/init"; + initsargv[argc] = NULL; + + execv("/sbin/init", initsargv); + error("failed to exec init: %m\n"); + /* If exec fails, we have to return non-zero; kernel will panic anyway. */ + return EXIT_FAILURE; + } + + /* Not PID 1: keep current behaviour (useful for diagnostics in user space) */ return EXIT_FAILURE; + } platsch_draw(ctx);