From 824ce252585a8fbf8b50023da67c8405d5f4ff85 Mon Sep 17 00:00:00 2001 From: Jeroen Leeuwestein Date: Sat, 8 Feb 2025 19:58:46 +0100 Subject: [PATCH] Make inclusion of console=serial0 in kernelParams (cmdline.txt) configurable --- rpi/default.nix | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/rpi/default.nix b/rpi/default.nix index dc207eb..ff0a62b 100644 --- a/rpi/default.nix +++ b/rpi/default.nix @@ -77,6 +77,18 @@ in package = mkPackageOption pkgs "uboot-rpi-arm64" { }; }; + serial-console = { + enable = mkOption { + default = true; + type = types.bool; + description = '' + Whether to enable a console on serial0. + + Corresponds with raspi-config's setting + "Would you like a login shell to be accessible over serial?" + ''; + }; + }; }; }; @@ -319,11 +331,14 @@ in boot = { kernelParams = if cfg.uboot.enable then [ ] - else [ - "console=tty1" - # https://github.com/raspberrypi/firmware/issues/1539#issuecomment-784498108 - "console=serial0,115200n8" - "init=/sbin/init" + else builtins.concatLists [ + [ "console=tty1" ] + (if cfg.serial-console.enable then [ + # https://github.com/raspberrypi/firmware/issues/1539#issuecomment-784498108 + "console=serial0,115200n8" + ] else [ ] + ) + [ "init=/sbin/init" ] ]; initrd = { availableKernelModules = [