Make inclusion of console=serial0 in kernelParams (cmdline.txt) configurable

This commit is contained in:
Jeroen Leeuwestein 2025-02-08 19:58:46 +01:00
parent f317116725
commit 824ce25258

View file

@ -77,6 +77,18 @@ in
package = mkPackageOption pkgs "uboot-rpi-arm64" { }; 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 = { boot = {
kernelParams = kernelParams =
if cfg.uboot.enable then [ ] if cfg.uboot.enable then [ ]
else [ else builtins.concatLists [
"console=tty1" [ "console=tty1" ]
# https://github.com/raspberrypi/firmware/issues/1539#issuecomment-784498108 (if cfg.serial-console.enable then [
"console=serial0,115200n8" # https://github.com/raspberrypi/firmware/issues/1539#issuecomment-784498108
"init=/sbin/init" "console=serial0,115200n8"
] else [ ]
)
[ "init=/sbin/init" ]
]; ];
initrd = { initrd = {
availableKernelModules = [ availableKernelModules = [