coreboot: uniformize serial console handling

This commit cleans up the selection of the serial console device and
gives it sensible default values (usually, the DB9 header on the
back I/O panel) on each platform.
master
Adam Joseph 2 years ago
parent 8ee3c8a13b
commit aa61ed1bd2

@ -128,7 +128,7 @@ stdenv.mkDerivation {
echo 'CONFIG_LINUX_INITRD="${initramfs_image}"' >> .config echo 'CONFIG_LINUX_INITRD="${initramfs_image}"' >> .config
sed -i 's/^CONFIG_UART_FOR_CONSOLE=.*//' .config sed -i 's/^CONFIG_UART_FOR_CONSOLE=.*//' .config
'' + lib.optionalString (uart-for-console != null) '' '' + lib.optionalString (uart-for-console != null) ''
echo 'CONFIG_UART_FOR_CONSOLE=${builtins.toString uart-for-console}"' >> .config echo 'CONFIG_UART_FOR_CONSOLE=${builtins.toString uart-for-console}' >> .config
'' + lib.optionalString (iasl != null) '' '' + lib.optionalString (iasl != null) ''
echo CONFIG_ANY_TOOLCHAIN=y >> .config echo CONFIG_ANY_TOOLCHAIN=y >> .config
'' + '' '' + ''

@ -88,17 +88,7 @@ CONFIG_MAINBOARD_DIR="asus/am1i-a"
CONFIG_MAINBOARD_PART_NUMBER="AM1I-A" CONFIG_MAINBOARD_PART_NUMBER="AM1I-A"
CONFIG_MAX_CPUS=4 CONFIG_MAX_CPUS=4
CONFIG_CBFS_SIZE=8387272 CONFIG_CBFS_SIZE=8387272
# this is the internal header, which exists on both board variants
CONFIG_UART_FOR_CONSOLE=0
CONFIG_TTYS0_BASE=0x3f8
# this is the back-panel connector, which exists only on the "more back-panel stuff" board variant
#CONFIG_UART_FOR_CONSOLE=1
#CONFIG_TTYS0_BASE=0x2f8
CONFIG_LINUX_INITRD="" CONFIG_LINUX_INITRD=""
CONFIG_MAINBOARD_VENDOR="ASUS" CONFIG_MAINBOARD_VENDOR="ASUS"
CONFIG_HW_MEM_HOLE_SIZEK=0x200000 CONFIG_HW_MEM_HOLE_SIZEK=0x200000
# CONFIG_HW_MEM_HOLE_SIZE_AUTO_INC is not set # CONFIG_HW_MEM_HOLE_SIZE_AUTO_INC is not set

@ -16,7 +16,7 @@
''; '';
}); });
console-device = "ttyS0"; console-device = "ttyS1";
coreboot = final.lib.makeOverridable (prev.coreboot.override { coreboot = final.lib.makeOverridable (prev.coreboot.override {
iasl = final.iasl_20180531; iasl = final.iasl_20180531;
@ -24,6 +24,11 @@
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;
uart-for-console =
if final.console-device == "ttyS0" then 0 # IDC ribbon-cable header on the motherboarod
else if final.console-device == "ttyS1" then 1 # DB9 connector on rear I/O panel; omitted from some board variants
else if final.console-device == null then null
else throw "am1i currently supports only `null` and `ttyS{0,1}` for `console-device`";
}).overrideAttrs (a: { }).overrideAttrs (a: {
/* /*
postConfigure = (a.postConfigure or "") + '' postConfigure = (a.postConfigure or "") + ''

@ -88,7 +88,6 @@ CONFIG_MAINBOARD_DIR="google/gru"
CONFIG_MAINBOARD_PART_NUMBER="Kevin" CONFIG_MAINBOARD_PART_NUMBER="Kevin"
CONFIG_MAX_CPUS=1 CONFIG_MAX_CPUS=1
CONFIG_CBFS_SIZE=7138520 CONFIG_CBFS_SIZE=7138520
CONFIG_UART_FOR_CONSOLE=0
CONFIG_MAINBOARD_VENDOR="Google" CONFIG_MAINBOARD_VENDOR="Google"
CONFIG_DIMM_SPD_SIZE=256 CONFIG_DIMM_SPD_SIZE=256
CONFIG_DEVICETREE="devicetree.cb" CONFIG_DEVICETREE="devicetree.cb"

@ -79,6 +79,10 @@ 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 ];
uart-for-console =
if final.console-device == "ttyS2" then 0
else if final.console-device == null then null
else throw "gru-kevin currently supports only `null` and `ttyS2` for `console-device`";
}).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

@ -89,8 +89,6 @@ CONFIG_MAINBOARD_DIR="asus/kgpe-d16"
CONFIG_MAINBOARD_PART_NUMBER="KGPE-D16" CONFIG_MAINBOARD_PART_NUMBER="KGPE-D16"
CONFIG_MAX_CPUS=32 CONFIG_MAX_CPUS=32
CONFIG_CBFS_SIZE=8387584 CONFIG_CBFS_SIZE=8387584
#CONFIG_UART_FOR_CONSOLE=0
CONFIG_UART_FOR_CONSOLE=1
CONFIG_MAINBOARD_VENDOR="ASUS" CONFIG_MAINBOARD_VENDOR="ASUS"
CONFIG_APIC_ID_OFFSET=0x0 CONFIG_APIC_ID_OFFSET=0x0
CONFIG_HW_MEM_HOLE_SIZEK=0x100000 CONFIG_HW_MEM_HOLE_SIZEK=0x100000
@ -193,7 +191,6 @@ CONFIG_PCIEXP_CLK_PM=y
CONFIG_BOOTBLOCK_NORTHBRIDGE_INIT="northbridge/amd/amdfam10/bootblock.c" CONFIG_BOOTBLOCK_NORTHBRIDGE_INIT="northbridge/amd/amdfam10/bootblock.c"
CONFIG_BOOTBLOCK_SOUTHBRIDGE_INIT="southbridge/amd/sb700/bootblock.c" CONFIG_BOOTBLOCK_SOUTHBRIDGE_INIT="southbridge/amd/sb700/bootblock.c"
CONFIG_TTYS0_BASE=0x3f8 CONFIG_TTYS0_BASE=0x3f8
#CONFIG_TTYS0_BASE=0x2f8
CONFIG_RAMTOP=0x400000 CONFIG_RAMTOP=0x400000
# CONFIG_CONSOLE_CBMEM is not set # CONFIG_CONSOLE_CBMEM is not set
CONFIG_UART_PCI_ADDR=0x0 CONFIG_UART_PCI_ADDR=0x0

@ -31,6 +31,8 @@
# insecure configurations? (63xx without microcode) # insecure configurations? (63xx without microcode)
microcode-blob = null; microcode-blob = null;
console-device = "ttyS0"; # the DB9 connector on the rear panel
# This contains the default values written into the # This contains the default values written into the
# battery-backed nvram when you boot with the recovery jumper # battery-backed nvram when you boot with the recovery jumper
# installed (which is something you should do the first time you # installed (which is something you should do the first time you
@ -41,15 +43,17 @@
# 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 ];
uart-for-console =
if final.console-device == "ttyS0" then 0 # the DB9 connector on the rear panel
else if final.console-device == "ttyS1" then 1 # the IDC header on the motherboard
else if final.console-device == null then null
else throw "kgpe currently supports only `null` and `ttyS{0,1}` for `console-device`";
}).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