factor out serial console device choice

This commit generalizes the selection and activation of the serial
console by promoting it to a top-level package-set member.

The top-level package set is starting to attract clutter, so I will
soon be moving all the non-package constitutents into a `config`
attrset.
master
Adam Joseph 2 years ago
parent d791388304
commit 52e330e4aa

@ -6,7 +6,7 @@
, initramfs_image # path to the initramfs `cpio` archive , initramfs_image # path to the initramfs `cpio` archive
, iasl ? null # a specific iasl to use, if needed , iasl ? null # a specific iasl to use, if needed
, console_loglevel ? "7" , console_loglevel ? "7"
, linux-command-line ? "" , linux-command-line
}: }:
let let
version = "4.9"; version = "4.9";

@ -17,6 +17,13 @@ let
coreboot-toolchain = final.callPackage ./coreboot-toolchain { }; coreboot-toolchain = final.callPackage ./coreboot-toolchain { };
# TODO(amjoseph): move this into a `config` attrset
console-device = throw "platforms must override this (example: \"ttyS0\")";
console-parameters = "115200n8";
linux-command-line =
let console = "${final.console-device},${final.console-parameters}";
in "console=${console} earlyprintk=${console}";
iasl_20180531 = final.nixpkgsOnBuildForBuild.callPackage ./coreboot/iasl_20180531 { }; iasl_20180531 = final.nixpkgsOnBuildForBuild.callPackage ./coreboot/iasl_20180531 { };
coreboot = final.callPackage ./coreboot { coreboot = final.callPackage ./coreboot {
initramfs_image = final.initramfs; initramfs_image = final.initramfs;

@ -96,7 +96,6 @@ CONFIG_TTYS0_BASE=0x3f8
# this is the back-panel connector, which exists only on the "more back-panel stuff" board variant # this is the back-panel connector, which exists only on the "more back-panel stuff" board variant
#CONFIG_UART_FOR_CONSOLE=1 #CONFIG_UART_FOR_CONSOLE=1
#CONFIG_TTYS0_BASE=0x2f8 #CONFIG_TTYS0_BASE=0x2f8
#CONFIG_LINUX_COMMAND_LINE="console=ttyS1,115200n8"
CONFIG_LINUX_INITRD="" CONFIG_LINUX_INITRD=""

@ -16,13 +16,14 @@
''; '';
}); });
console-device = "ttyS0";
coreboot = final.lib.makeOverridable (prev.coreboot.override { coreboot = final.lib.makeOverridable (prev.coreboot.override {
iasl = final.iasl_20180531; iasl = final.iasl_20180531;
payload = "${final.kernel}/bzImage"; payload = "${final.kernel}/bzImage";
coreboot-toolchain = with final.coreboot-toolchain; [ x64 i386 ]; coreboot-toolchain = with final.coreboot-toolchain; [ x64 i386 ];
fmap = ./custom.fmap; fmap = ./custom.fmap;
config = ./coreboot.config; config = ./coreboot.config;
linux-command-line="console=ttyS0,115200n8";
}).overrideAttrs (a: { }).overrideAttrs (a: {
/* /*
postConfigure = (a.postConfigure or "") + '' postConfigure = (a.postConfigure or "") + ''

@ -59,6 +59,11 @@ in {
modules = modules_insmod ++ modules_noinsmod; modules = modules_insmod ++ modules_noinsmod;
}; };
# these pins are on the motherboard's "servo connector"; you'll
# need a breakout board like this:
# https://github.com/SolidHal/servo-v2-breakout-board
console-device = "ttyS2";
coreboot = coreboot =
let atf = final.nixpkgsOnBuildForHost.callPackage (import ./atf) { let atf = final.nixpkgsOnBuildForHost.callPackage (import ./atf) {
buildArmTrustedFirmware = (final.nixpkgsOnBuildForHost.callPackage (import <nixpkgs/pkgs/misc/arm-trusted-firmware>) { buildArmTrustedFirmware = (final.nixpkgsOnBuildForHost.callPackage (import <nixpkgs/pkgs/misc/arm-trusted-firmware>) {
@ -74,7 +79,6 @@ in {
fmap = ./custom.fmap; fmap = ./custom.fmap;
config = ./coreboot.config; config = ./coreboot.config;
coreboot-toolchain = with final.coreboot-toolchain; [ aarch64 ]; coreboot-toolchain = with final.coreboot-toolchain; [ aarch64 ];
linux-command-line="console=ttyS2,115200n8";
}).overrideAttrs (a: { }).overrideAttrs (a: {
postConfigure = '' postConfigure = ''
echo CONFIG_ARM64_BL31_EXTERNAL_FILE=\"${atf}/bl31.elf\" >> .config echo CONFIG_ARM64_BL31_EXTERNAL_FILE=\"${atf}/bl31.elf\" >> .config

@ -41,13 +41,15 @@
# TODO: use a NixOS-style structuredConfig for this. # TODO: use a NixOS-style structuredConfig for this.
cmos-default = null; cmos-default = null;
console-device = "ttyS0"; # the DB9 connector on the rear panel
#console-device = "ttyS1"; # the IDC header on the motherboard
coreboot = final.lib.makeOverridable (prev.coreboot.override { coreboot = final.lib.makeOverridable (prev.coreboot.override {
iasl = final.iasl_20180531; iasl = final.iasl_20180531;
payload = "${final.kernel}/bzImage"; payload = "${final.kernel}/bzImage";
fmap = ./custom.fmap; fmap = ./custom.fmap;
config = ./coreboot.config; config = ./coreboot.config;
coreboot-toolchain = with final.coreboot-toolchain; [ x64 i386 ]; coreboot-toolchain = with final.coreboot-toolchain; [ x64 i386 ];
linux-command-line = "console=ttyS1,115200n8";
}).overrideAttrs (a: { }).overrideAttrs (a: {
postConfigure = if final.microcode-blob != null then '' postConfigure = if final.microcode-blob != null then ''
echo CONFIG_CPU_MICROCODE_MULTIPLE_FILES=y >> .config echo CONFIG_CPU_MICROCODE_MULTIPLE_FILES=y >> .config

Loading…
Cancel
Save