Skip to content
This repository was archived by the owner on Mar 23, 2025. It is now read-only.

Commit 824ce25

Browse files
committed
Make inclusion of console=serial0 in kernelParams (cmdline.txt) configurable
1 parent f317116 commit 824ce25

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

rpi/default.nix

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@ in
7777

7878
package = mkPackageOption pkgs "uboot-rpi-arm64" { };
7979
};
80+
serial-console = {
81+
enable = mkOption {
82+
default = true;
83+
type = types.bool;
84+
description = ''
85+
Whether to enable a console on serial0.
86+
87+
Corresponds with raspi-config's setting
88+
"Would you like a login shell to be accessible over serial?"
89+
'';
90+
};
91+
};
8092
};
8193
};
8294

@@ -319,11 +331,14 @@ in
319331
boot = {
320332
kernelParams =
321333
if cfg.uboot.enable then [ ]
322-
else [
323-
"console=tty1"
324-
# https://github.com/raspberrypi/firmware/issues/1539#issuecomment-784498108
325-
"console=serial0,115200n8"
326-
"init=/sbin/init"
334+
else builtins.concatLists [
335+
[ "console=tty1" ]
336+
(if cfg.serial-console.enable then [
337+
# https://github.com/raspberrypi/firmware/issues/1539#issuecomment-784498108
338+
"console=serial0,115200n8"
339+
] else [ ]
340+
)
341+
[ "init=/sbin/init" ]
327342
];
328343
initrd = {
329344
availableKernelModules = [

0 commit comments

Comments
 (0)