Skip to content

Commit

Permalink
Specify consoles when booting linux kernel
Browse files Browse the repository at this point in the history
This lets us take advantage of the initialization for the underlying
console device that the kernel will do so that we can just do our normal
termios setup from there.
  • Loading branch information
jmbaur committed May 12, 2024
1 parent 5fdb74a commit e972f5a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 18 deletions.
1 change: 1 addition & 0 deletions boards/fizz-fizz/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
network = true;
chromebook = true;
linux = {
consoles = [ "ttyS0,115200n8" ];
kconfig = with lib.kernel; {
NET_VENDOR_REALTEK = yes;
R8169 = yes;
Expand Down
17 changes: 10 additions & 7 deletions boards/qemu-x86_64/config.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{ lib, ... }:
{ config, lib, ... }:
{
platform.qemu = true;
network = true;
video = true;
debug = true;
linux.kconfig = with lib.kernel; {
FB_VESA = yes;
FB_VGA16 = yes;
VGA_ARB = yes;
};
linux.consoles = [ "ttyS0,115200n8" ];
linux.kconfig = lib.mkIf config.video (
with lib.kernel;
{
FB_VESA = yes;
FB_VGA16 = yes;
VGA_ARB = yes;
}
);
coreboot.kconfig = with lib.kernel; {
BOARD_EMULATION_QEMU_X86_Q35 = yes;
VENDOR_EMULATION = yes;
Expand Down
2 changes: 1 addition & 1 deletion boards/volteer-elemi/config.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{ lib, ... }:
{
debug = true;
platform.tigerlake = true;
chromebook = true;
video = true;
linux.consoles = [ "ttyS0,115200n8" ];
coreboot = {
# start=0x01800000 length=0x00800000 (upper 1/4)
wpRange.start = "0x01800000";
Expand Down
1 change: 0 additions & 1 deletion kernel-configs/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ in
NLS = yes;
NLS_CODEPAGE_437 = yes;
NLS_ISO8859_1 = yes;
NULL_TTY = yes;
PCI = yes;
PINCTRL = yes;
PRINTK = yes;
Expand Down
10 changes: 5 additions & 5 deletions kernel-configs/video.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
...
}:
{
linux.kconfig = lib.mkIf config.video (
with lib.kernel;
{
linux = lib.mkIf config.video {
consoles = [ "tty0" ];
kconfig = with lib.kernel; {
BACKLIGHT_CLASS_DEVICE = yes;
DRM = yes;
DRM_SIMPLEDRM = yes;
Expand All @@ -22,6 +22,6 @@
GOOGLE_FRAMEBUFFER_COREBOOT = yes;
LOGO = yes;
LOGO_LINUX_VGA16 = yes;
}
);
};
};
}
10 changes: 6 additions & 4 deletions options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ in
type = types.package;
default = pkgs.linux_latest;
};
consoles = mkOption {
type = types.listOf types.str;
default = [ ];
};
kconfig = kconfigOption;
dtb = mkOption {
type = types.nullOr types.path;
Expand Down Expand Up @@ -217,10 +221,8 @@ in
linux.kconfig.CMDLINE = lib.kernel.freeform (
toString (
lib.optionals config.video [ "fbcon=logo-count:1" ]
++ [
"console=ttynull"
"loglevel=${if config.debug then "7" else "6"}"
]
++ [ (if config.debug then "debug" else "quiet") ]
++ map (c: "console=${c}") config.linux.consoles
)
);
extraInitrdContents = lib.optional (config.linux.firmware != [ ]) {
Expand Down

0 comments on commit e972f5a

Please sign in to comment.